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

We have 3 programms A,B,C.In the middle of the program A the controls goes to program B and in the middle of the program B control wants to go program C,after completion of program C again control comes to program B and again after completion of program B control comes to program A.How the process will takes and what are the controls we use for that process.If it is possible anybody of you explain with example?

5 Answers   IBM,


Program A (Normal COBBAT) calling a B Program (DB2COBOL, COBBATDB which is using a VSAM file. its a dynamic call. How we will handle VSAM file decleration in our from JCL from where we are running A PGM. And should we have PLAN for A pGM also. if possible can some one post a sample JCL. Thanks for help in advance.

0 Answers   iNautix,


i WANT ALL ERROR codes IN CICS and DB2

2 Answers  


COMP?

2 Answers  


what will be the output when a)pic 9(6)value 000178 is moved to pic ***,***. b)pic 9(5) value 57397 is moved to pic $$,$$9.

5 Answers  






how to transfer the file from pc to mainframe??

5 Answers   TCS,


What is difference between comp & comp-4?

6 Answers  


Can we move SPACES to numeric field and ZEROES to alphabetic field? If yes what are the way doing this?

6 Answers   T systems,


what is the difference between Plan & package

3 Answers   IBM,


What are the steps you go through while creating a COBOL program executable?

3 Answers  


Determine the total no of bytes in the following. 01 rec1. 02 a pic x(6) 02 b redefines a. 03 c occus 6 times pic 9. 02 d occurs 6 times pic 9. 03 e pic x(5) 03 f pic 999.

12 Answers  


How can we know that cobol program is using report file or simple file....?

4 Answers  






Categories