I have a sequential file of 100 records. How do I load the
records into a two dimensional array ?

Answer Posted / ameet

The answer for this is as below:

01 INPUT-REC.
02 REC-DETAIL OCCURS 100 TIMES INDEXED BY I.
03 REC-DATA PIC X(10 ) - assume

PROCEDURE DIVISION.
READ FILE(INPUT) INTO(WORK-REC) - assume length as 100
SET I TO 1.
PERFORM 1000-WRITE 100 TIMES
STOP RUN.
1000-SECTION.
MOVE WORK-REC TO REC-DATA(I).
SET I UP BY 1.
READ FILE(INPUT) INTO(WORK-REC).

Is This Answer Correct ?    2 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we change the password using ALTER? anyone tried and changed?

1532


State the various causes of s0c1, s0c5 and s0c7.

652


Our issue is there seems to be a disconnect, or no link, between our SELECT statement and our SD. We had SELECT SORT-FILE and SELECT SORT-FILE ASSIGN TO SORTWRK. ASSIGN TO SORTWRK1 SORTWRK2 SORTWRK3 SORTWRK4. with SD SORT_FILE RECORD CONTAINS 7833 CHARACTERS. In either case, at run time, the system ignored our SORTWRK# DD statements and allocated 16 sort works with the SORTWK## naming convention. Any ideas why the system does not recognize the connection? We do not even need the SORTWRK DD statements. Thanks

2316


Write the code implementing the perform … varying.

629


example for sub strings ? and refernce modifications whit output pls

1829






How do you reference the fixed block file formats from cobol programs

690


How to change size of Initial number of records to *NOMAX for ALL PF files from perticular library, how can I do that

2711


Can a Search can be done on a table with or without Index?

793


what is s000 u4087 error? please give the all error codes in cobol,jcl.

17008


How to know whether the module is dynamical or statistical?

644


How do define dynamic array in cobol.

654


What are the pertinent COBOL commands?

2614


System Testing for Mainframe Developers What is System Testing? integration testing ? what's the procedure ..

1573


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

4030


What is the difference between Global and External Variables?

652