I have a table with 3 dimensions like this :
01 ws-table
04 ws-page occurs 3
08 ws-column occurs 2.
12 ws-record occurs 20 pic x(40).
How to code with PERFORM varying with 3 dimension...I

Answers were Sorted based on User's Feedback

I have a table with 3 dimensions like this : 01 ws-table 04 ws-page occurs 3 08 ws-..

Answer / lu

you have coding like this :
Working Storage Section.
77 I-page pic 99 value zero.
77 J-col pic 99 value zeroes.
77 K-record pic 99 value zeroes.
Procedure Division.
Perform 1000-move varying I-page from 1 by 1 until
I-page > 3
after J-col from 1 by 1 until
J-col > 2
after K-record from 1 by 1 until
K-record > 20.

move a-field to ws-record (I-page, J-col, K-record).

Is This Answer Correct ?    12 Yes 0 No

I have a table with 3 dimensions like this : 01 ws-table 04 ws-page occurs 3 08 ws-..

Answer / garry


Excellent Posts, I Really appreciate your time for giving wonderful and sure-shot results.

Pls keep it up.


Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More COBOL Interview Questions

Hi all, I have a following requirement to write the cobol program. I have to load the 129 variables from input sequential file which are in excel sheet to the cobol inernal table. and after loading into table i have to compare this data with the business file. here compare means controlling the data whether the format(numeric,alpha) is same in the business file and in the table??? i have the same data in input and business file. could anyone please give me any idea of the logic?// i have all the 129 different variables(129rows,1 column)is there .

4 Answers   IBM, Syntel, TCS,

In A cobol program , we can use COPY Statement in FILE- SECTION / WORKING-STORAGE SECTION / ENVIRONMENT DIVIION basically what is the difference

3 Answers   IBM,

How to Write the RESTART Logic Using COBOL?

4 Answers   GalaxE, L&T, Syntel, TCS,

what is the difference between start and startbr?

2 Answers  

With in these three which one is the default one Call Reference, Call By Value, Call By Content.-Which one is default?

4 Answers   IBM,

There is a production file which has millions of records in it.The program that uses it ends up with an SOC7 abend.It is sure that the abend is due to some invalid data in the file.Is there any way to debugg the SOC7 abend with out giving displays? I need the record which is cause for the abend.

8 Answers   iGate, Danske,

If i initialize the 01 level variable in array, will it initialize all the array elements (occurs)?

8 Answers   CTS,

I want ALL jcl ERROR cods

1 Answers  

sample code for read a 2nd record from last in flatfile how can do?

4 Answers   iNautix,

how can we get current dat and time thru cobol pgm

3 Answers   DELL,

Can anyone please give the example of Inline Perform.

6 Answers   TCS,

is it possible to rename 01 level?

4 Answers