What is the difference between subscript and index?



What is the difference between subscript and index?..

Answer / robertd903

Subscripts are programmer-defined variables, of numeric type--used to reference an array.
Example:
77 WS-SUB PIC 9(04) COMP.
01 WS-TABLE.
05 WS-TABLE-ENTRY OCCURS 5 Times PIC X(80).

In PROCEDURE DIVISION:
MOVE WS-TABLE-ENTRY(WS-SUB) TO...

Indexes are defined by the programmer, but the PICTURE clause is omitted.
Example:
01 WS-TABLE.
05 WS-TABLE-ENTRY OCCURS 5 TIMES INDEXED BY WS-IDX.
10 FILLER PIC X(80).

In PROCEDURE DIVISION:
MOVE WS-TABLE-ENTRY(WS-IDX) TO...

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More COBOL Interview Questions

How to read the last 100 records from a COBOL file. The file contains N number of records.

11 Answers   IBM,


Did anybody attend the walkin of TCS on 31st July in Gurgaon for any technology,If u have completed 3 round i.e till the HR round,have u received the Offer letter yet? Please let me know.Thanks.

1 Answers  


tell me about examine inspect and evaluate ?

2 Answers   CTS,


Move Zeroes to I move 5 to j perform para1 varying I from 10 by -2 until I = 0 display j. para1. Add 5 to j. What’ll be the value after execution of display stmt. A) 35 B) 40 C) 30 D) 25 please explain how?

5 Answers  


Without using move verb how to move one variable to another.

5 Answers  






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,


I want ALL ERROR codes in VSAM

3 Answers   American Express, TCS,


what is the use of outrecord?

0 Answers  


WT R TECHNICAL MAINFRAME QUESTION ASKED IIN ANJANASOFTEARE??

1 Answers  


What is the difference between Call and a Link?

0 Answers  


can we read in input the file with a variable length ? please , how ..could you help me ?

3 Answers   EDS,


Have you used comp and comp-3 in your project? And how?

0 Answers   IBM,


Categories