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


Please Help Members By Posting Answers For Below Questions

HOw can I get the negative sign while deduct high value from low value

1775


Why would you use find and get rather than to obtain?

671


Is it possible that the redefines clause has different picture clauses compared to the one it redefined?

661


What are INPUT PROCEDURE and OUTPUT PROCEDURE?

674


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.

3703






What is length is cobol?

636


What is the difference between PIC 9.99 and PIC9v99?

763


i want a program using by if, evaluate , string, unstring, perform, occurs?

4030


Which division and paragraphs are mandatory for a COBOL program?

701


What is the difference between perform … with test after and perform … with test before?

861


Have you used comp and comp-3 in your project? And how?

2001


What are the cobol coding sheets?

655


How did the release of cobol/370 version 1.3 improve the performance of release 1.1?

630


What is the difference between Global and External Variables?

652


) how do u code after getting data?

1575