1) can we display the index?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
hw to create 3 dimensional array & hw to access it?
How to Pass table from a cobol program to another cobol program and how to use that table in called program
What is diff betn PS and ESDS file? What is the diffrent compiler options in cobol and there discription? What is retrive nth maximum salary from salary DB2 table. Can we redefine COM-3 variable with varchar variable?
WORKING-STORAGE SECTION. 01 A PIC X(3) VALUE 'ABC' 01 B PIC 9(3). PROCEDURE DIVISION. MOVE A TO B. STOP RUN. OUTPUT IS: AB3 WHY AND HOW THIS IS HAPPENING.
whats the difference between search and search all?
When search all is used in cobol program without sorted input data?
6 Answers CGI, Principal Finance,
what is difference bt COND, REGION & TIME parameters at JOB & EXEC. give an exp.
What is SDSF?
How to covert given string into ASCII value in COBOL/MF COBOL
Can the OCCURS clause be at the 01 level?
How will 128 be saved in s9 (3) comp-3 How will 12 be saved in s9 (2) comp
What is the Purpose of POINTER Phrase in STRING command in COBOL?