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 ?..

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.
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 ?..

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 ?..

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.

 Is This Answer Correct ? 2 Yes 14 No

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.

What is Static and Dynamic linking ?

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

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

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

What are the pertinent COBOL

Are you comfortable in cobol or jcl?

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

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

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.

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?

What are the differences between COBOL and COBOL II?

Categories