how will u retreive value from a table.write it with syntex.
01 ws-table
05 ws-table1 occurs 10 times.
05 ws-table2 occurs 10 times.

the above is 2 dimensional array..how will u retrieve 1st
element of an array

Answers were Sorted based on User's Feedback



how will u retreive value from a table.write it with syntex. 01 ws-table 05 ws-table1 occurs 10..

Answer / veenaibm

Multidimentional array is as follows:

01 TABLE-REC-1.
05 ROWS OCCURS 1 TO 10 TIMES.
10 COLUMNS OCCURS 1 TO 10 TIMES.
20 CELL PIC X(1).

Now if we want to access the value of the variable CELL,

we can use
Perform x from 1 by 1 until x>10
Perform y from 1 by 1 until y>10
cell(x,y).

In the question, it is not a 2 dimentional array.

It is 2 single dimentional array which can be accessed
independently.

Is This Answer Correct ?    7 Yes 0 No

how will u retreive value from a table.write it with syntex. 01 ws-table 05 ws-table1 occurs 10..

Answer / talluri

01 ws-array
05 ws-table1 occurs 10 times.
05 ws-table2 occures 10 times.
01 i pic 9(2).
01 j pic 9(2).
procedure division.
perform varing i from 1 by 1 until i>10
perform varing j from 1 by 1 until i>10
accept ws-table1(i,J)
accept ws-table2(i,J)
end-perform
end-perform.
perform varing i from 1 by 1 until i>10
display ws-table1(i,J)
end-perfrom.

Is This Answer Correct ?    4 Yes 2 No

how will u retreive value from a table.write it with syntex. 01 ws-table 05 ws-table1 occurs 10..

Answer / abhishek

while declaring a two dimensional array we have to use the
INDEXED BY clause

01 ws-array
05 ws-table1 occurs 10 times INDEXED BY I
10 ws-table2 occures 10 times INDEXED BY J
15 var-1 pic x(4)
15 var-2 pic x(5)

01 i pic 9(2).
01 j pic 9(2).

procedure division.
perform varing i from 1 by 1 until i>10

AFTER varing j from 1 by 1 until i>10
accept var-1(i,J)
accept var-2(i,J)

end-perform.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More COBOL Interview Questions

Is this allowed? 01 WS-TABLE. 03 FILLER-X PIC X(5) VALUE 'AAAAA'. 03 WS-EX REDEFINES FILLER-X OCCURS 5 TIMES PIC X(1). can redefines clause be used with occurs clause?

4 Answers  


What is SQL Code -904 and -903 in DB2 And how to handle it?

1 Answers   IBM,


What is Static,Dynamic linking ?

2 Answers  


Write a program to explain size error.

0 Answers  


COBOL Snippet: Tell where the control will when the below code execute IF (A=B) CONTINUE ELSE NEXT SENTENCE PERFORM <IMP-STMT> END-IF.

7 Answers   HCL,






what are decleratives in cobol?

0 Answers   GGG, Satyam,


I know my query will return more than one row but I don't want cursor what should I do?

1 Answers  


How to open and see copy book ?

3 Answers  


Can you call an OS VS COBOL pgm from a VS COBOL II pgm ?

3 Answers   Microsoft,


what is filler and what is use of filler

3 Answers   Syntel,


How do we get current date from system with century?

2 Answers  


There are 5 fields and 1000 records in a file. Unload it into an array. Write the syntax for declaration and how will you unload it.

0 Answers  


Categories