How do u initialize an array?
Answers were Sorted based on User's Feedback
array can be initiazed by INITIALIZE verb or by moving the
values to the elements of a table.
if u initialise an array with INITIALIZE verb your
alphanumeric fields will be stored with space and numeric
fields with '0'.
| Is This Answer Correct ? | 9 Yes | 3 No |
Answer / nagaraj
You can initialize an array in several ways based on the
values in the array.
If you know the values in the array already, then you can
do it through REDEFINE clause. I will give an example here.
05 MONTHS-VAL PIC X(36)
VALUE 'JanFebMarAprMayJunJulAugSepOctNovDec'.
05 MONTHS REDEFINE MONTHS-VAL PIC X(3)OCCURS 12 TIMES.
If you want to initialize at run time based on the user
input, then you can pass the values via ACCEPT statement
(online) /SYSIN DD statement (batch) and initialize the
COBOL array.
If you want to initialize with default values then you can
do it using INITIALIZE verb but be careful doing so.
| Is This Answer Correct ? | 1 Yes | 0 No |
What is the difference between structured cobol programming and object alternativelyiented cobol?
what are the limitations of Inline Perform?
What COBOL construct is the COBOL II EVALUATE meant to replace?
Can we use goto statement in inline_perform ?
I have a sequential file of 100 records. How do I load the records into a two dimensional array ?
when COMP-3 is preferrable?
what is soc7 abend?how u can trace it?
If there are two copybooks which have same variables and we are using both the copybooks in our program. will there be an error and if i move values to the variable which copybook varibales gets the values i move in.
What is the difference between a binary search and a sequential search?
1.give the details about WHEN OTHER. 2. how many form are available in evaluate.
How do you set a return code to the JCL from a COBOL program?
can we display comp-3 variables. if we want to display what we have to do . give me one example