I have a sequential file of 100 records. How do I load the
records into a two dimensional array ?
Answer Posted / gopal
01 INPUT-REC.
02 REC-ROWS OCCURS 10 TIMES INDEXED BY I.
03 REC-COLS OCCURS 10 TIMES INDEXED BY J.
04 REC-DATA PIC X(20 ) - assume
PROCEDURE DIVISION.
READ FILE(INPUT) INTO(WORK-REC) - assume length as 100
SET I TO 1. SET J TO 1.
PERFORM 1000-WRITE 10 TIMES
STOP RUN.
1000-SECTION.
MOVE WORK-REC TO REC-DATA(I J).
SET J UP BY 1.
READ FILE(INPUT) INTO(WORK-REC).
This will move the 10 occurences of J that is (I 1) to (I
10)
Then the outer loop should be incremented 10 times that is
I from 1 to 10.
| Is This Answer Correct ? | 12 Yes | 0 No |
Post New Answer View All Answers
what happens if parmparameter passes zero bytes to the program
What guidelines should be followed to write a structured cobol prgm?
For rewrite, why is it mandatory that file needs to be opened?
In COBOL programming, what is PERFORM? What is VARYING?
How can we find that module can be called – whether DYNAMICALLY or STATICALLY?
How do we get current date from system with century in COBOL?
I have a program with an Array of 5000 occurences which is being passed from 5 sub levels to the front end screen. Thess 5 programs using each 5*2 = 10 different arrays with size as 5000. This is causing the transaction to utilize more storage consupmtion. I am looking to reduce the storage consumption. As part of that initially i thought Dynamic array may solve my problem. After viewing the comments given i see its same as normal array. IS there any other way we can resolve this issue?
) How do u handle errors in BMS macro
What is the utilization of copybook in cobol? Could we utilize a similar copybook?
can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there
Define static linking and dynamic linking.
how can i see junk values in dclgen or in hostvariable of comp ?
I have a File that has duplicate records. I need only those records that occur more than thrice.?
What is perform what is varying?
What rules are to be followed while using the corresponding options?