1 2 /* 3 4 The procedure cobol_open_gen.pl1 generates the code which realizes 5 the COBOL open statement. Two important indicators are involved, cobol_mode 6 and multics_mode. 7 8 OPEN fn eos 9 10 (repeated if necessary) 11 12 eos d=00 input 13 01 output 14 10 i-o 15 11 extend 16 17 f=00 rewind 18 01 no-rewind 19 10 reversed 20 21 verb=19 22 23 cobol_mode 24 25 1 e, str 26 5 e, seq 27 17 i, str 28 21 i, seq 29 30 25,26,27 i,rel(seq, ran, dyn) 31 29,30,31 i,ind(seq, ran, dyn) 32 37 i-o, seq 33 34 41,42,43 i-o,rel(seq, ran, dyn) 35 45,46,47 i-o, ind(seq, ran, dyn) 36 49 o, str 37 38 53 o, seq 39 57,58,59 o, rel(seq, ran, dyn) 40 61,62,63 o, ind(seq, ran, dyn) 41 42 43 44 cobol_mode(multics_mode) COBOL verbs 45 46 org=seq i 21(4) fr first record read 47 o 53(5) eof write 48 i-o 37(5,7) fr read rewrite 49 e 5(6) eof(append bit = "1"b) write 50 51 org=rel 52 53 acc=seq i 25(8) fr read,start 54 o 57(9) eof. write 55 i-o 41(9,10) fr i-verbs modify 56 57 acc=ran i 26(11) fr read 58 o 58(12) eof write 59 i-o 42(12,13) fr i,o-verbs modify 60 61 acc=dyn i 27(8) fr read,start 62 o 59(9,10) fr write 63 i-o 43(9,10) fr i,o-verbs modify 64 65 org=ind 66 67 acc=seq i 29(8) fr read_next,start 68 o 61(9) eof write 69 61(9,10) if alt keys 70 i-o 45(10) fr i-verbs modify 71 72 acc=ran i 30(11) fr read_key 73 o 62(12) eof write 74 i-o 46(12,13) fr i,o-verbs modify 75 76 77 acc=dyn i 31(8) fr read,start 78 o 63(9,10) fr write 79 i-o 47(9,10) fr i,o-verbs modify 80 81 org=str i 17(1) fb first byte 82 o 49(2) eof 83 e 1(2) eof 84 85 last_cobol_op 86 87 1 open 5 read_key 88 2 close 6 rewrite 89 3 start 7 delete 90 4 read_next 8 write 91 92 multics_mode 93 94 1,2,3 stream_(i o i-o) 95 4,5,6,7 seq_(i o i-o u) 96 8,9,10 k_s_(i o u) 97 11,12,13 d_(i o u) 98 99 1 mp based 100 2 n fixed bin 101 2 ptr(1) ptr type-1("OPEN") 102 2 ptr(2) ptr type-12(fn) 103 2 ptr(3) ptr eos 104 105 Flow Chart 106 107 108 alt_sw = file_table.organization = 3 ind 109 & 110 file_table.alternate_keys ^= 0 111 112 alt_output = alt_sw & cobol_mode = 61 113 114 TAG(ioerror.retry_tag) 115 116 if file_table.external 117 then OP30(open_ext_file,good_tag) 118 else OP31(open_int_file,good_tag) 119 120 GEN_IOERROR 121 122 TAG(good_tag): 123 124 OP32(find_iocb,iocb_tag) 125 GEN_IOERROR 126 127 TAG(iocb_tag): 128 129 if file_table.external 130 then OP33(check_attach,attach_tag) 131 132 call ATTACH_OPTIONS_STRING 133 OP34(attach_iocb,attach_tag);GEN_IOERROR 134 135 TAG(attach_tag): 136 137 OP37(check_file,open_tag1) 138 139 if alt_output 140 | 141 cobol_mode = 59 o(rel-dyn) 142 | 143 cobol_mode = 63 o(ind-dyn) 144 145 then OP36(open_close_file,open_tag2);GEN_IOERROR 146 147 TAG(open_tag2): 148 149 OP35(open_file,open_tag1) 150 151 if alt_output 152 | 153 multics_mode = 10 k_s_u 154 | 155 ( multics_mode = 13 d_u 156 & 157 cobol_mode < 48 i,o 158 ) 159 | 160 multics_mode = 7 seq_u 161 162 then OP29(close_op_file,open_tag2) 163 164 GEN_IOERROR 165 166 TAG(open_tag1): 167 168 if alt_sw 169 170 then IO_UTIL$FILE_DESC;OP78(alt_open_file,0);SET_FSBPTR 171 172 if file_table.linage 173 then OP24(set_line_file_status,0) 174 else OP25(set_file_status,0) 175 176 return; 177 178 ATTACH_OPTIONS_STRING: proc; 179 180 if file_table.device = 7 device is unattached 181 then IOERROR(10) 182 else 183 if file_table.eao_len > 0 explicit options 184 then IO_UTIL$MOVE_LIT 185 else do; if file_table.catalogued < 2 no pathname 186 & 187 file_table.device ^= 5 non-tape 188 189 then do; 190 end; 191 else if file_table.catalogued 192 then do; 193 end; 194 else do; 195 end; 196 197 if file_table.device = 5 tape 198 then do; 199 end; 200 else do; extend_sw => " -extend" 201 file_table.dup__alt => " dup_ok" 202 end; 203 204 end; 205 end; 206 207 */ 208 209 %include cobol_opr_open; 210