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

What are the different open modes available in cobol?

821


how do you define single dimensional array and multidimensional array in your cobol?

766


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

2836


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

2447


How you can characterize tables in cobol?

817






What are the different rules to perform a Search?

700


What are the rules of the move verb?

813


what is difference between cobol and cobol/400

21859


what happens if parmparameter passes zero bytes to the program

1751


How can you get the ksds file records into your cobol program?

726


What are the access modes of START statement?

813


How are the next sentence and continue different from each other?

875


What is amode(31)

807


) what is the difference between AID and HANDLE AID?

1741


Describe the cobol database components?

776