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 WE WILL SORT THE ARRAY WHICH IS GOING TO USE FOR SEARCH ALL?

2 Answers   Cap Gemini,


How do define Dymanic array in cobol how do u define single demensional arry and multidymensional arry in ur cobol.

4 Answers   Cap Gemini,


COMPUTE X = A * B - C * D and COMPUTE X = (A * B) - (C * D) (a) Are not the same (b) Are same (c) Syntactically wrong (d) Will yield a run time error

1 Answers   TCS,


If you are current on the owner of a set, what is the difference between obtain next and obtain first?

0 Answers  


how can we get current dat and time thru cobol pgm

3 Answers   DELL,






where will we code call by content and call by reference dude pls reply soon ?

2 Answers  


what is the purpose of linkage section?

10 Answers  


01 a pic 9(9v99) 01 b pic 9(9.99) wht will be the stored vales in both cases

6 Answers   Patni,


soc-7 is a bad data,invalid data. when ever we are moving the alphabets in the position of numeric then we got this abend. so my question is if o1 ws-data pic 9(1) value passing the alphabet some x. then we got soc-7 or not? i want clarification ?

7 Answers   CitiGroup, IBM,


in a indexed file what is procedure for read the records from 12 to 18. please give the code example

2 Answers   L&T,


what is internal sort and external sort ? which is preferable ?

2 Answers   TCS,


I have the requirement to compare the two files and pick up the matching records. File 1. file2 23 32 32 13 34 15 35 36 36 35 43 Get the matching records from this 2 files to out file. how you will do this in cobol program?

15 Answers   ADP, Broadridge, CTS, HSBC, L&T, RBS, TCS,


Categories