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
Which mode is used to operate the sequential file?
What is Pic 9v99 Indicates in COBOL?
What is amode(24)?
What is the difference between a binary search and a sequential search what are the pertinent cobol?
Why is it necessary that file needs to be opened in I-O mode for REWRITE?
here is my requirement A1 is alphanumeric with value 'A1B2C3D4' as defined below 05 A1 PIC X(8) VALUE IS 'A1B2C3D4' but i need to have A2,A3 as ABCD & 1234 repectively...... A2 = ABCD A3 = 1234 Can you please explain me what are the different ways to do it?
How can i load all the data from a file to Table (array) in cobol.How i manage the occurs clause with out reading the file.Any options avilable ? Please can any one help me it is urgent?
how do you reference the fixed unblock file formats from cobol programs
Define cobol?
Write the code to count the sum of n natural numbers.
What are the different open modes available in cobol?
What are all the divisions of a COBOL program?
how do you reference the variable unblock file formats from cobol programs
what is search and searchall?what is the diffrence between them?give an best example?
How to traceback if I am getting SOC7 or SOC4 abend? List down the steps