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

What is different between variable length and fixed length?

2 Answers   TCS,


I have files that contains both duplicates files(occur more than twice) and non-duplicate files.The file is already sorted by a key.I want to determine those records that are duplicate and will be move to a duplicate file and non- duplicate files to be move to a valid file.thank you.help please

2 Answers  


Following questions were asked in Capegemini on 8th sep,2012 mainframe test 1.)Condition code for dul recors in VSAM- 2.) Is NULL or =NULL in Select statement 3.)max size of CI 4.)What happens after CI is full 5.)Ques on COND parameter 6.)which among following can not be rolled back a)delete table b.)droptable c)Update d.)insert 7.)groupby and orderby sql querries 8.)Max extents in VSAM file 9.)quesn on DPRTY=(1,10) 10.)range of condition codes in COBOL 11.)occurs clase can not be used at which level? 12.)delimiter in jcl 13.)sort card for file in PGM=SORT 14.)PIC(6) value 120056 possible? 15)question on BLKSIZE Is (20,20) and (20,10) possible? 16.)number of bytes in RDF 17.)Can we use index in WS-section or LK-section 18.)Verify command in IDCAMS used for? 19.)question on Alternate Index 20.)Return code of file attribute mismatch 21.)In which format COBOL variables stored? 22.)what is Alternate of HANDLE? 23.)can SUM,AVG,MIN,ROUND used in numeric and char variable data types? 24.)What is the datatype of FILE STATUS codes in WS-section?

2 Answers   Cap Gemini,


What is the difference between comp and comp-3 usage?

0 Answers  


i have the following varibles in the working storage 05 ws-A PIC X(30) VALUE 'ABCDEFGHIJKLMNOPQRESTUVWXYZ ' 05 WS-B REDEFINES WS-A 10 WS-B1 PIC X(10). 10 WS-B2 PIC 9(10). 10 WS-B3 PIC X(10). If I Display B1, B2 and B3 respectively, what is the value displayed in B2

9 Answers  






I have a program with an Array of 5000 occurences which is being passed from 5 sub levels to the front end screen. Thess 5 programs using each 5*2 = 10 different arrays with size as 5000. This is causing the transaction to utilize more storage consupmtion. I am looking to reduce the storage consumption. As part of that initially i thought Dynamic array may solve my problem. After viewing the comments given i see its same as normal array. IS there any other way we can resolve this issue?

0 Answers   HCL,


What are differences between Static Call and Dynamic Call?

10 Answers   IBM, KBC, Keane India Ltd, Verizon,


Extract only those records from a PS file which are having word 'TEXT' in the records using COBOL? The word TEXT is not present in a particular position in all the records.

2 Answers   RBS,


what is meaning by design document? who can repared for this?

5 Answers   TCS,


In a file if a column account number conatain value 0001234.. how can we move the value to another variable without zero. value may contain any type such as 00123405. we need the value 1234 or 12305. how can we do that in cobol. Please help.

1 Answers   CSC,


which is better either static call or dynamic call? and why?

5 Answers   HCL,


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,


Categories