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
HOw can I get the negative sign while deduct high value from low value
Why would you use find and get rather than to obtain?
Is it possible that the redefines clause has different picture clauses compared to the one it redefined?
What are INPUT PROCEDURE and OUTPUT PROCEDURE?
How to find out the closest prime number of an input number? I believe it has something to do with SEARCH and COBOL Linear Array.
What is length is cobol?
What is the difference between PIC 9.99 and PIC9v99?
i want a program using by if, evaluate , string, unstring, perform, occurs?
Which division and paragraphs are mandatory for a COBOL program?
What is the difference between perform … with test after and perform … with test before?
Have you used comp and comp-3 in your project? And how?
What are the cobol coding sheets?
How did the release of cobol/370 version 1.3 improve the performance of release 1.1?
What is the difference between Global and External Variables?
) how do u code after getting data?