How do u initialize an array?

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


Please Help Members By Posting Answers For Below Questions

what is difference bt COND, REGION & TIME parameters at JOB & EXEC. give an exp.

8156


What is length is cobol?

646


What is perform what is varying?

701


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

639


What is the difference between binary search and sequential search?

638






How arrays can be defined in COBOL?

661


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?

2093


What is an in line perform? When would you use it? Anything else you wish to say about it.

642


What is the difference between a binary search and a sequential search what are the pertinent cobol?

730


What are declaratives and what are their uses in cobol?

706


which is Best IBM Mainframe Training and Placement Institute in Ameerpet Hyderabad

1020


how can we apply for HSBC exam(Mainframe) in India??? i went to their site and was told to submit my CV ,. etc..( totally confusing...)

1922


How do you code cobol to access a parameter that has been defined in jcl? And do you code the parm parameter on the exec line in jcl?

695


What guidelines should be followed to write a structured cobol prgm?

668


What is the difference between perform … with test after and perform … with test before?

877