Answer Posted / 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 |
Post New Answer View All Answers
What are the pertinent COBOL commands?
Write the code to count the sum of n natural numbers.
Is it possible that the redefines clause has different picture clauses compared to the one it redefined?
) what is the difference between AID and HANDLE AID?
Which Search verb is equivalent to PERFORM…VARYING?
What is the Purpose of POINTER Phrase in STRING command in COBOL?
Explain sorting techniques in cobol program? Provide the sort file definition, the sort statement, its syntax and meaning
What are the different types of condition in cobol and write their forms.
How to change size of Initial number of records to *NOMAX for ALL PF files from perticular library, how can I do that
Difference between cobol and cobol-ii?
Name the divisions, which are available in a cobol program?
How do you reference the following file formats from cobol programs?
Can you please let me know the centre name of INS certification in Kolkata.
What are the access modes of START statement?
What is the difference between Structured COBOL Programming and Object Oriented COBOL programming?