If i initialize the 01 level variable in array, will it
initialize all the array elements (occurs)?
Answers were Sorted based on User's Feedback
occurs clause of an array cant be coded in 01 level.
it should always be coded in work area 2
01 xxx-yyy.
03 XX-YYY-ARRAY OCCURS 10 TIMES.
05 XX-YYY-MEM1 COMP-3 PIC S9(9).
05 XX-YYY-MEM2 COMP-3 PIC S9(9)V9.
Is This Answer Correct ? | 16 Yes | 1 No |
All ryt.Answer is no.array elements will not be initialised
automatically.
you can initialise the table with INITIALIZE verb.
INITIALIZE XXX-YYY
this will initialize your alphanumeric with space and
numeric with '0'.
apart from this by moving also u can initialise.
Is This Answer Correct ? | 8 Yes | 2 No |
Answer / rakesh
I know we cant use occurs in 01 level. My question was, if
we initialize 01 level variable, in ur example, xxx-yyy,
will all the elements be initialized as well (xx-yyy-array,
xx-yyy-mem1 and xx-yyy-mem2)?
Is This Answer Correct ? | 6 Yes | 3 No |
Answer / chandrababu naidu
we can't use array or table in 01 level item.
(or)
01 name.
02 name2 pic x(5) occurs 10 times.
INITIALIZE NAME.----> means the variable name contains 'spaces'.
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / nag(igate)
hi rakesh and sneha
we can initialize the array at group level.
01 xxx-yyy VALUE "ABCDEFGH"
03 XX-YYY-ARRAY OCCURS 2 TIMES.
05 XX-YYY-MEM1 PIC X(2).
05 XX-YYY-MEM2 PIC X(2).
the initialize value should depend on the number of times
the, occurs clause repeat.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / sharath
Assuming we have to initialize the array variables with
zeroes.
MOVE ALL '0' to the '01' group variable will initialize the
whole array.
Is This Answer Correct ? | 1 Yes | 5 No |
01 a pic 9(9v99) 01 b pic 9(9.99) wht will be the stored vales in both cases
file status 00 is checked after opening the file or reading the file
Differentiate COBOL and COBOL-II?
How to read records from flat file in reverse order through COBOL program?
14 Answers Accenture, Broadridge, IBM, MAT, Polaris, SPIC, Syntel, TCS, Wipro,
What is the default value of DISP parameter?
Can anybody give me example of subscript and index
What is the difference between external and global variables in COBOL?
In file1 have 80 records are like d1,d2,d3......D80. File2 have 1000records are like a1d1,a1d2,a3d3.....Etc. I want matching records in file3 ? Plse tell me the matching logic???I want answer only in cobol ?Not using any tool or jcl?
what is scope terminator
I have a variable account-number declared as comp-3, s9(10) comp-3 in a file. How do i find a particular account number say 123456 in that file?
In A cobol program , we can use COPY Statement in FILE- SECTION / WORKING-STORAGE SECTION / ENVIRONMENT DIVIION basically what is the difference
How do define dynamic array in cobol.