How do u initialize an array?

Answers were Sorted based on User's Feedback



How do u initialize an array?..

Answer / snehatechm

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

How do u initialize an array?..

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

Post New Answer

More COBOL Interview Questions

how to remove leading spaces and zeroes in a cobol variable.is there any easy way to do it

2 Answers  


Explain the configuration section of a cobol program with examples of syntax.

0 Answers  


if we have " ibm mainframe ",in that how to remove first and last leading space eg:"ibm mainframe" like that the answer we need

0 Answers  


Write the code implementing the perform … varying.

0 Answers  


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

0 Answers  






What is the default value of DISP for temp datasets

5 Answers   IBM,


Where the Plan is located in CICS-DB2

2 Answers   IBM,


What is difference between COBOL and VS COBOL II?.

1 Answers   Winsol Solutions,


) How do u handle errors in BMS macro

0 Answers   IBM,


What are ISOLATION LEVELS? Where do we need to specify them?

3 Answers   EXL,


How to find out the closest prime number of an input number? I believe it has something to do with SEARCH and COBOL Linear Array.

0 Answers   Infosys,


How many sections are there in data division?.

10 Answers   Amdocs, TCS,


Categories