1 ^L
2
3
4
5
6
7
8
9
10
11
12
13 get_size_error_flag:proc(size_error_token_ptr,size_error_inst_ptr);
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 dcl size_error_token_ptr ptr;
34 dcl size_error_inst_ptr ptr;
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 dcl stz_op bit (10) int static init ("1001010000"b );
53
54
55
56 dcl ret_offset fixed bin;
57 dcl size_error_inst_word bit (36) based (size_error_inst_ptr);
58 dcl input_buffer (1:10) fixed bin;
59 dcl reloc_buffer (1:10) bit (5) aligned;
60
61
62
63
64
65
66
67
68
69 call cobol_alloc$stack(4,0,ret_offset);
70
71
72 size_error_token_ptr = null();
73 call cobol_make_type9$fixed_bin_35(size_error_token_ptr,1000 ,ret_offset);
74
75
76 input_ptr = addr(input_buffer(1));
77 reloc_ptr = addr(reloc_buffer(1));
78
79 input_struc_basic.type = 1;
80 input_struc_basic.operand_no = 0;
81 input_struc_basic.lock = 0;
82 input_struc_basic.segno = 1000;
83 input_struc_basic.char_offset = ret_offset;
84
85 size_error_inst_word = "0"b;
86
87
88 call cobol_addr(input_ptr,size_error_inst_ptr,reloc_ptr);
89
90
91 size_error_inst_ptr -> inst_struc_basic.fill1_op = stz_op;
92
93
94 call cobol_emit(size_error_inst_ptr,reloc_ptr,1);
95
96
97 size_error_inst_ptr -> inst_struc_basic.fill1_op = "0"b;
98
99 end get_size_error_flag;
100 ^L
101
102
103
104
105
106
107 receiving_field:proc(receiving_token_ptr,stored_token_ptr,function_code);
108
109
110
111
112
113 dcl receiving_token_ptr ptr;
114 dcl stored_token_ptr ptr;
115 dcl function_code fixed bin;
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140 dcl 1 move_eos int static,
141 2 size fixed bin (15) init (32),
142 2 line fixed bin (15) init (0),
143 2 column fixed bin (15) init (0),
144 2 type fixed bin (15) init (19),
145 2 verb fixed bin (15) init (18),
146 2 e fixed bin (15) init (0),
147 2 h fixed bin (15) init (0),
148 2 i fixed bin (15) init (0),
149 2 j fixed bin (15) init (0),
150 2 a bit (16) init ("0"b);
151 dcl always_an bit (1) static init ("0"b);
152
153
154
155 dcl temp_in_token (1:10) ptr;
156 dcl move_eos_ptr ptr;
157 dcl tin_ptr ptr;
158 dcl temp_save_ptr ptr;
159 dcl ret_offset fixed bin;
160
161 if function_code = 1 then call store;
162 else call restore;
163
164 ^L
165
166
167
168
169
170 store:proc;
171
172
173
174
175
176
177
178 if receiving_token_ptr->data_name.ascii_packed_dec_h="0"b then do;
179 receiving_token_ptr -> data_name.numeric = "0"b;
180 receiving_token_ptr -> data_name.alphanum = "1"b;
181 end;
182 else always_an="1"b;
183
184 temp_save_ptr = null();
185 call cobol_make_type9$copy(temp_save_ptr,receiving_token_ptr);
186
187
188 call cobol_alloc$stack(fixed(temp_save_ptr -> data_name.item_length,17),0,ret_offset);
189
190
191 temp_save_ptr -> data_name.seg_num = 1000;
192 temp_save_ptr -> data_name.offset = ret_offset;
193 temp_save_ptr -> data_name.subscripted = "0"b;
194 temp_save_ptr -> data_name.variable_length = "0"b;
195 temp_save_ptr -> data_name.occurs_ptr = 0;
196
197
198
199 tin_ptr = addr(temp_in_token(1));
200 move_eos_ptr = addr(move_eos);
201 stored_token_ptr = temp_save_ptr;
202
203 tin_ptr -> in_token.n = 4;
204 tin_ptr -> in_token.token_ptr(1) = null();
205 tin_ptr -> in_token.token_ptr(2) = receiving_token_ptr;
206 tin_ptr -> in_token.token_ptr(3) = stored_token_ptr;
207 tin_ptr -> in_token.token_ptr(4) = move_eos_ptr;
208
209
210 if always_an="1"b then move_eos_ptr->end_stmt.e=10001;
211 else
212 move_eos_ptr -> end_stmt.e = 1;
213
214
215 call cobol_move_gen(tin_ptr);
216
217
218 receiving_token_ptr -> data_name.numeric = "1"b;
219 receiving_token_ptr -> data_name.alphanum = "0"b;
220 always_an="0"b;
221
222 end store;
223
224 ^L
225
226
227
228
229
230 restore:proc;
231
232
233
234
235
236
237 tin_ptr = addr(temp_in_token(1));
238 move_eos_ptr = addr(move_eos);
239
240 tin_ptr -> in_token.n = 4;
241 tin_ptr -> in_token.token_ptr(1) = null();
242 tin_ptr -> in_token.token_ptr(2) = stored_token_ptr;
243 tin_ptr -> in_token.token_ptr (3) = receiving_token_ptr;
244 tin_ptr -> in_token.token_ptr(4) = move_eos_ptr;
245
246
247 move_eos_ptr -> end_stmt.e = 1;
248
249
250
251
252 if receiving_token_ptr->data_name.ascii_packed_dec_h="0"b then do;
253 receiving_token_ptr -> data_name.numeric = "0"b;
254 receiving_token_ptr -> data_name.alphanum = "1"b;
255 end;
256
257
258
259 call cobol_move_gen(tin_ptr);
260
261
262 receiving_token_ptr -> data_name.numeric = "1"b;
263 receiving_token_ptr -> data_name.alphanum = "0"b;
264
265 end restore;
266
267 end receiving_field;
268 ^L
269
270
271
272
273
274 test_for_overflow:proc(no_overflow_tag,size_error_inst_ptr,move_in_token_ptr);
275
276
277
278
279
280
281
282
283
284
285
286
287
288 dcl no_overflow_tag fixed bin;
289 dcl size_error_inst_ptr ptr;
290 dcl move_in_token_ptr ptr;
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307 dcl tov_op bit (10) int static init ("1100011110"b );
308 dcl tra_op bit (10) int static init ("1110010000"b );
309 dcl aos_op bit (10) int static init ("0001011000"b );
310
311
312
313 dcl temp_inst_word bit (36);
314 dcl temp_inst_ptr ptr;
315
316 dcl reloc_buffer (1:10) bit (5) aligned;
317 dcl reloc_ptr ptr;
318
319 dcl save_locno fixed bin;
320 dcl overflow_tag fixed bin;
321
322
323
324
325
326
327
328 temp_inst_word = "0"b;
329 temp_inst_ptr = addr(temp_inst_word);
330
331
332 temp_inst_ptr -> inst_struc_basic.fill1_op = tov_op;
333
334
335 overflow_tag = cobol_$next_tag;
336
337 cobol_$next_tag = cobol_$next_tag + 1;
338
339
340 reloc_ptr = addr(reloc_buffer(1));
341 reloc_buffer(1) = "0"b;
342 reloc_buffer(2) = "0"b;
343
344
345 call cobol_emit(temp_inst_ptr,reloc_ptr,1);
346
347
348 call cobol_make_tagref(overflow_tag, cobol_$text_wd_off - 1,null());
349
350
351 if move_in_token_ptr ^= null() then
352 if move_in_token_ptr -> in_token.code ^= 0
353 then call cobol_move_gen(move_in_token_ptr);
354
355
356
357 temp_inst_word = "0"b;
358 temp_inst_ptr -> inst_struc_basic.fill1_op = tra_op;
359
360 save_locno = cobol_$text_wd_off;
361
362
363 call cobol_emit(temp_inst_ptr,reloc_ptr,1);
364
365
366 call cobol_make_tagref(no_overflow_tag,save_locno,null());
367
368
369
370 call cobol_define_tag(overflow_tag);
371 size_error_inst_ptr -> inst_struc_basic.fill1_op = aos_op;
372
373
374 call cobol_emit(size_error_inst_ptr,reloc_ptr,1);
375
376
377 size_error_inst_ptr -> inst_struc_basic.fill1_op = "0"b;
378
379
380 end test_for_overflow;
381 ^L
382
383
384
385
386
387
388 test_size_error:proc(size_error_token_ptr,size_error_inst_ptr,next_stmt_tag,overflow_code_generated,not_bit);
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411 dcl size_error_token_ptr ptr;
412 dcl size_error_inst_ptr ptr;
413 dcl next_stmt_tag fixed bin;
414 dcl (overflow_code_generated,not_bit) bit (1);
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440 dcl lda_op bit (10) int static init ("0100111010"b );
441 dcl ldq_op bit (10) int static init ("0100111100"b );
442 dcl tze_op bit (10) int static init ("1100000000"b );
443 dcl tnz_op bit (10) int static init ("1100000010"b );
444 dcl tra_op bit (10) int static init ("1110010000"b );
445
446
447
448
449
450
451 dcl 1 register_struc,
452 2 what_reg fixed bin,
453 2 reg_no bit (4),
454 2 lock fixed bin,
455 2 already_there fixed bin,
456 2 contains fixed bin,
457 2 dname_ptr ptr,
458 2 literal bit (36);
459
460 dcl temp_inst_word bit (36);
461 dcl temp_inst_ptr ptr;
462
463 dcl save_locno fixed bin;
464 dcl reloc_buffer (1:10) bit (5) aligned;
465 dcl reloc_ptr ptr;
466 dcl size_error_inst bit (36) based (size_error_inst_ptr);
467
468
469
470
471
472
473 reloc_ptr = addr(reloc_buffer(1));
474 reloc_buffer(1) = "0"b;
475 reloc_buffer(2) = "0"b;
476
477
478 if overflow_code_generated
479 then do;
480
481 size_error_inst_ptr = addr(size_error_inst);
482
483
484 register_struc.what_reg = 0;
485 register_struc.lock = 0;
486 register_struc.contains = 1;
487 register_struc.dname_ptr = size_error_token_ptr;
488
489 call cobol_register$load(addr(register_struc));
490
491
492
493 if register_struc.reg_no = "0001"b
494 then size_error_inst_ptr -> inst_struc_basic.fill1_op = lda_op;
495 else size_error_inst_ptr -> inst_struc_basic.fill1_op = ldq_op;
496
497
498
499
500 call cobol_emit(size_error_inst_ptr,reloc_ptr,1);
501 end;
502
503
504
505 temp_inst_word = "0"b;
506 temp_inst_ptr = addr(temp_inst_word);
507 if overflow_code_generated
508 then if not_bit
509 then temp_inst_ptr -> inst_struc_basic.fill1_op = tnz_op;
510 else temp_inst_ptr -> inst_struc_basic.fill1_op = tze_op;
511 else temp_inst_ptr -> inst_struc_basic.fill1_op = tra_op;
512
513
514 save_locno = cobol_$text_wd_off;
515
516
517 call cobol_emit(temp_inst_ptr,reloc_ptr,1);
518
519
520 call cobol_make_tagref(next_stmt_tag,save_locno,null());
521
522
523 end test_size_error;
524
525
526
527 ^L
528 not_dec_operand:proc(token_ptr) returns (bit (1));
529
530
531
532
533
534
535
536
537 dcl token_ptr ptr;
538
539 if token_ptr -> data_name.bin_18
540 | token_ptr -> data_name.bin_36
541 | token_ptr -> data_name.sign_type = "010"b
542 | token_ptr -> data_name.sign_type = "001"b
543 | (token_ptr -> data_name.display & token_ptr -> data_name.item_signed
544 & token_ptr -> data_name.sign_separate = "0"b)
545 then return ("1"b);
546 else return ("0"b);
547
548 end not_dec_operand;
549 ^L
550
551