Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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

Answers were Sorted based on User's Feedback



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

Answer / 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 ?    11 Yes 0 No

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

Answer / neilsh

It should be
01 xyz
05 pqr occurs 2 times indexed by i
07 abc occurs 50 times indexed by j
09 rec pic x(40).

so it would be like 50 occurance of rec and then 2 occurance
of abc

50 + 50 = two divisions

Is This Answer Correct ?    3 Yes 0 No

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

Answer / 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 14 No

Post New Answer



More COBOL Interview Questions

input:- 12233344445555566666... output:- 1=1,2=4,3=9... Here firstno i.e 1 should be displayed and after that the alikeno.s should be added n displayed.i.e 2+2=4 like tat it goeson.

1 Answers  


What is Static and Dynamic linking ?

3 Answers  


How to get the last record in vsam file in cluster? And how can you get the ksds file records into your cobol program?

0 Answers  


can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there

0 Answers  


SSRange is used to do a range check on which of the Following. SUBSCRIPT,INDEX,REFERENCE MODIFICATION,Run-time option.

3 Answers   Lehman Brothers,






What are the pertinent COBOL

0 Answers   IBM,


Are you comfortable in cobol or jcl?

0 Answers  


When can the USING phrase be included in the call statement ?

2 Answers  


where will we code call by content and call by reference dude pls reply soon ?

2 Answers  


How many bytes will be allocated for the following record description entries? 01 REC-A. 05 A PIC S9(4). 05 B PIC XXXBXXX. 05 C PIC ____9.99. 05 D PIC S9(5) COMP-3. 05 E PIC 9(3) COMP.

16 Answers   IBM, TCS,


I have the file which is having the extension no as records. sample file will look like below. 2310 3410 3256 4350 3781 5408 I need to replace the record which is starting with 3 to 5 (i.e) 3410 to 5410. How can we do it through cobol and cobol-db2 program? I need the possible logic?

5 Answers   RBS,


What are the differences between COBOL and COBOL II?

1 Answers   CSC,






Categories