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

Program A calls program B. Will the working storage variables declared in program B be initialized every time it is called by program A or will the values be retained until the end of program A?

7 Answers  


There is a variable with value 19446. Requirement is to convert it to 194.46. I tried it by doing divide by 100 and my receiving field data type is 9(03)v99. But the output is 194. I am not getting the decimal value. Could anyone pls let me know how to get this done?

2 Answers  


wht do u mean by (*,intrdr) wht is * used for ?

2 Answers  


If there are two files one with 100 records and other with 101 records. we have to find out the one record that is the odd man out . What are the steps to do it

7 Answers   BirlaSoft,


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

2 Answers  






wht is structured cobol pgm and non structred cobol pgm ?

1 Answers   CTS, DELL,


what is scope terminator

2 Answers   IBM,


what is the diff b/w select stsmt and cursor ?

2 Answers  


if a dataset is already created with fixed length but after that i want to change fixed length to variable length then how is it possible

3 Answers   IBM,


What is tne need to use sub programs in Cobol?

3 Answers   HSBC,


01 a pic 9(6) value is 123456 01 b pic 9(3) move a to b wht will be the value ?

6 Answers   Patni,


what is the difference between perform varying and perform until

4 Answers   TCS,


Categories