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
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.
What are the rules of the move verb?
how do you reference the ksds vsam file formats from cobol programs
how do you reference the variable unblock file formats from cobol programs
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?
How to read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)
What is the difference between Structured COBOL Programming and Object Oriented COBOL programming?
Whats the difference between search & search ALL?
Have you used the sort in your project?for this type of questions any working on real time project give the eg. with real time scenario.
How do we get current date from system with century in COBOL?
Program A (Normal COBBAT) calling a B Program (DB2COBOL, COBBATDB which is using a VSAM file. its a dynamic call. How we will handle VSAM file decleration in our from JCL from where we are running A PGM. And should we have PLAN for A pGM also. if possible can some one post a sample JCL. Thanks for help in advance.
Is it possible that the redefines clause has different picture clauses compared to the one it redefined?
How to know whether the module is dynamical or statistical?
What is static and dynamic call in cobol?
What is rmode(24)