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 ?    12 Yes 7 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 ?    2 Yes 1 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 5 No

Post New Answer

More COBOL Interview Questions

what is mainframe? what is the mainframe software ? what is use in s/w field?

7 Answers   CSE,


I have a Flat file in which certain records are present in a tabular format. I need to extract some of the records on some basis from it and copy them into a flat file...how it can be done ??

2 Answers   HCL,


how would find total records in files using seqientional

1 Answers   HSBC,


WHY LRECL NEEDS TO BE 4 EXTRA THEN THE COBOL FILE LENGTH & WHAT IT CONTAIN IN THAT LENGTH

2 Answers   Cap Gemini,


what is the difference between PA & PF keys?

1 Answers   IBM,






why occurs clause not mentioned in 01 level

6 Answers   HCL, NIIT, TCS, Tesco,


Why we should use cursor ?

3 Answers  


Difference between lrecl, blksize among PS, PDS issues? i.e in jcl at dcb

1 Answers  


i have a variable block which is used in my cobol program as input file having records of 4080 after compilation while runing the program im getiing file attribut mismatch and it is saying tht the record length of the file is 4084 can any one knw the answer how to reslove it ?

2 Answers  


What is the difference between a binary search and a sequential search?

10 Answers  


Difference between next and continue clause

4 Answers   Kanbay,


what is the diff b/w select stsmt and cursor ?

2 Answers  


Categories