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

If by mistake we MOVE a working storage variable into LINKAGE area. What will happen??

4 Answers   Accenture,


consider the following PROCEDURE DIVISION entry OPEN EXTEND IN-FILE identify the correct statement a.organization of IN-FILE is sequential and records can be added in the beginning b.organization of IN-FILE is sequential and records can be added in the end c.organization of IN-FILE is indexed and records can be added in the beginning d.organization of IN-FILE is indexed and records can be added in the end

3 Answers   TCS,


i want to store 20 digits . h will u do it in cobol ?

4 Answers   TCS,


How to replace the GOTO statement in COBOL without changing the structure of program. e.g. consider following code... I.D. E.D. D.D. P.D. compute C = A + B. GOTO para 100-display. compute D = C - D. GOTO 200-display. some other logic...... ........ GOTO 300-para. ...... ...... GOTO 400-para. Now I want to replacce all GOTO statements without changing the structure and otput of program.

6 Answers   Accenture,


What compiler option would you use for dynamic linking?

2 Answers  






I have two questions here. 1. How to read a flat file in reverse order? 2. How to read a VSAM KSDS file in reverse order? In both the cases we donot know the total number of records.

2 Answers   L&T,


What is the difference between NEXT SENTENCE and CONTINUE?

2 Answers   Mphasis,


What is rmode(24)

0 Answers  


What is amode(24)?

0 Answers  


Describe the difference between subscripting and indexing ?

2 Answers  


given the following piece of code: CALL SUB-PGM USING A, B, C. CALL SUB-PGM USING A, C, C. (a) Both CALL statements will always produce same result. (d) Both CALL statements may produce different result. (c) Compile-time error because SUB-PGM is a dataname. (d) Compile-time error because A, B, C are used twice.

2 Answers   TCS,


Is It Possible to Update or change in VIEW Mode?

5 Answers   CSC,


Categories