Arrays is such an important concept in Cobol. An array saves a lot of Developer’s time, also CPU time.
Lot of data fields, we can define with minimal lines of code. We can use these in Variable file description also.
I am giving here two usages. These will give great help in your coding.
02 ACCT-NUMB PIC X(8).
02 PAYMENTS OCCURS 1 TO 5 TIMES DEPENDING ON
NO-OF-PAYMENTS INDEXED BY INX.
03 DATE PIC 9(6).
03 AMOUNT PIC 9(5)V99.
The other way of coding VB files:
02 General-info Pic x(6).
Special-info Pic X(8).
Developer noting points:
- The variable where “depending on” defined, can not be used redfines of other variable.
- The values “NO-OF-PAYMENTS” and “INX” must be equal, or, INX value less than NO-OF-PAYMENTS value (this applies to both Index and Subscript).