1) can we display the index?




Answers were Sorted based on User's Feedback



1) can we display the index?..

Answer / shan

Ya correct,
To be more clear,
Declare a variable with usage is index (01 WS--VAR-DISPLAY
USAGE IS INDEX)

then SET WS-VAR-DISPLAY to WS-INDEX
Display WS-VAR-DISPLAY

Is This Answer Correct ?    10 Yes 5 No

1) can we display the index?..

Answer / naina

Yes, we can!!!
The easiest way, which would work in all versions of COBOL
is
SET W-S-VAR-PICS9(9)-USAGE-DISPLAY TO THE-INDEX-U-WANT-TO-
DISPLAY
DISPLAY W-S-VAR-PICS9(9)-USAGE-DISPLAY

Is This Answer Correct ?    4 Yes 4 No

1) can we display the index?..

Answer / jswan

You can't directly display the Index. But you can create a normal numeric field in your working storage and set that to the Index.

Example:

01 WS-TABLE.
05 WS-CUSTOMER PIC X(25) OCCURS 10 INDEXED BY INDEX1.

01 WS-NUMERICS.
05 WS-INDEX-COUNT PIC 9(02) VALUE 0.

SET WS-INDEX-COUNT TO INDEX1.
DISPLAY WS-INDEX-COUNT.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer



More COBOL Interview Questions

which one is the best of com and com-3.using of real time ?

7 Answers   Cap Gemini,


if we display var1 then what will b displayed in below condition. 77 var1 pic s9(2) value -10. 77 var1 pic s9(2) value -11. " " " -12. " " " -13. -14 ... ... -19.

2 Answers   IBM, Steria,


)If there are 10 steps in GDG, if I want to refer the step2 after step5 . what should I do?

0 Answers   IBM,


Differentiate COBOL and COBOL-II?

0 Answers  


can i use multiple when statements in search & search all ? justify ur answer?

2 Answers  






what is meant by binary search?

4 Answers  


I have a source program compiled with Cobol-2. The output file has a record length of 100 defined in the program but a record of 60 bytes getting written into it. i.e. The rest of 40 bytes I am not Writing anything. But it by default puts some values into the last 40 bytes. However it does not impact anything. But when Compiled the module with Enterprise Cobol the last 40 bytes were spaces as fillers. Can anyone explain?

5 Answers   Cognizant,


if someone is using my file,how can i find which user id is using?

4 Answers  


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

1 Answers  


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

3 Answers   Lehman Brothers,


u have passed sme charecters thru parm parameter in jcl. how do u code in cobol to recieve the values u gave in parm ?

2 Answers   IBM,


what is a zoned decimal data type and how it will be stored?

2 Answers   IBM,






Categories