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 |
Can anybody give me example of subscript and index
please..could u give an example about USAGE IS POINTER ..and explain why and when we use it ?
01 var1 pic x(10) 01 var2 redefines var1 pic 9(10). then in procedure division move 'abcde' to var1 then waht is the value of var1 and var2
What does EXIT do ?
what is index and how to use two tables using index?
Hi all, I have a following requirement to write the cobol program. I have to load the 129 variables from input sequential file which are in excel sheet to the cobol inernal table. and after loading into table i have to compare this data with the business file. here compare means controlling the data whether the format(numeric,alpha) is same in the business file and in the table??? i have the same data in input and business file. could anyone please give me any idea of the logic?// i have all the 129 different variables(129rows,1 column)is there .
i have mainprogram and subgram...if i compile mainprogram without stop run..what will u get in compilation time?
Which of the following characters is NOT valid in column 7? a. - b. \ c. * d. # e. $
When the working storage variables get allocated? a.At Compile time b.At starting of the run time c.At end of the run time. d.None of these
how can u pass the values into db2 values from cobol ?
I have put two write operations in a single para for two different conditions.Will that lead to an abend or run successfully and write two records?
I have File 1 occurs 5 times with Employee-ID,Employee-Name,Employee-Dept (EEE and MECH). I have File 2 occurs 10 times with Employee-ID,Employee-Name,Employee-Dept (EEE,CIVIL,CHEMICAL and MECH). In FIle 1 and FIle 2 , for matching Employee-DEPT (Only MECH) , we need to move entire records from file1 to file 2. We should not use 2D array. Your help is needed here.