I want to get the length of the table (by which I mean the number of elements in the array) in COBOL. The agreement that I saw, as a rule, hardcodes it according to the entry in the working repository. But I want the code to get the length, so if the working repository is changed and the program is recompiled, then the instructions for the separation of procedures do not need to be changed. This is both a reduction in maintenance efforts, and the prevention of simply "lack" of use in 5000 lines of code and the potential for using code in copy code that can be used in several programs with different table lengths.
So here is the only solution I came up with.
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTPROG.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 THIS-LENGTH PIC 9(04).
01 THIS-GROUP.
05 THIS-TABLE PIC X(20) OCCURS 15 TIMES.
PROCEDURE DIVISION.
COMPUTE THIS-LENGTH = LENGTH OF THIS-GROUP
/ LENGTH OF THIS-TABLE.
DISPLAY LENGTH OF THIS-GROUP ' / ' LENGTH OF THIS-TABLE
' = ' THIS-LENGTH.
EXIT-PROG.
STOP RUN.
And it deduces
000000300 / 000000020 = 0015
, , . , . ?