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

What is file status 92?

3 Answers  


i need a program by giving input as a abcd in any randem order but i need a output as 1234 related to abcd. i.e,. a for 1,b=2,c.....etc..

5 Answers   IBM,


What is the file organization clause ?

2 Answers  


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  


What is Comm?

2 Answers   IBM, Kemper Corporation,






In a program, there are 2 sections defined say SECTION-A and SECTION-B. There is a paragraph say CALC-INT in both the sections. If this para has to be called directly for SECTION-A, then PERFORM CALC-INT will not work as it is present in both sections. How the PERFORM statement has to be coded here?

5 Answers  


how can i see junk values in dclgen or in hostvariable of comp ?

0 Answers   DELL,


maximum of how many screens we can open in emulator

2 Answers  


Explain Restart Logic in Cobol?

1 Answers   Syntel, L&T,


what is the maximum error code in mainframe

2 Answers  


i declare a Table as OCCURS 2000 TIMES.If the input file has more than 2000 records will the COBOL program fail?

12 Answers  


is this below syntax correct? CALL 'subprg' using A,B Please help

2 Answers  






Categories