Getting Started with TRANSACT (32247-90007)

Chapter 8 143
Special Topics
Subprograms
Figure 8-22. The Called COBOL Procedure
The subprogram can only be accessed from an SL. A way to load the COBOL subprogram
into an SL is:
1 $control dynamic
1.1 identification division.
1.2 program-id. ex72a.
1.3 environment division.
1.4 data division.
1.5 working-storage section.
1.6 01 i pic 9(4) comp.
1.7 linkage section.
1.8 01 yr pic 99.
1.9 01 mo pic 99.
2 01 data-table.
2.1 02 yrs occurs 10.
2.2 04 tab-yr pic 99.
2.3 04 tab-qty pic 9(4) occurs 12.
2.4 01 end-tab pic 9(4) comp.
2.5 01 qty pic 9(6) comp.
2.6 procedure division using data-table end-tab yr mo qty.
2.7 100-start.
2.8 perform 200-find varying i from 1 by 1 until yr = tab-yr (i)
2.9 or i = end-tab.
3 if i = end-tab
3.1 move yr to tab-yr (i)
3.2 compute end-tab = end-tab + 1.
3.3 compute tab-qty (i, mo) = tab-qty (i, mo) + qty.
3.4 goback.
3.5
3.6 200-find.