Can we use redefine clause in occurs clause?
Answers were Sorted based on User's Feedback
Answer / leroy
Answer #2 is incorrect for IBM COCOL compiler.
Answer #1 is correct but incomplete. a) "VALUE" close can
not be used in occurring fields b) Occuring fields are the
ones that will redefine other fields not the other way
round.
Example: CORRECT
01 LIT-FIELD PIC X(21) VALUE 'SUNMONTUEWEDTHUFRISAT'.
01 DAYS REDEFINES LIT-FIELDS.
05 WEEK-DAY OCCURS 7 PIC X(03).
INCORRECT:-
01 DAYS.
05 WEEK-DAY OCCURS 7 PIC X(03).
05 LIT-FIELDS REDEFINES WEEK-DAY VALUE 'SUNMONTUE.........'
Is This Answer Correct ? | 16 Yes | 2 No |
Answer / manthan
yes........we can redefine occurs clause but not having
depending clause
Is This Answer Correct ? | 6 Yes | 1 No |
Answer / jagadesh
not possible because memory allocation can not be
reallocated
Is This Answer Correct ? | 4 Yes | 3 No |
Answer / john
All fine but, Nikhitha's Question has to be confirmed
first;
1. Whether a redefines can be used within an occurs (OR)
2. Whether an occurs can be redefined?
Looks like Nikhita's Question is 1, but all of your answers
were for Question 2.
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / sroul4
Redefines is just a pointer to the memory add, thus can be
done.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / saravanan
yes we can use redifines claues at level num 01... and alos
we can use both (redifine and occurs clause) together......
Is This Answer Correct ? | 2 Yes | 2 No |
Answer / sivakumar sekharannair
Leroy's answer is correct. Redefined variable can have
occurs clause not in the same level but subordinate to the
higher level
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / subharaj
We can do that. I have done it multiple times and it works
in Enterprise Edition in mainframe.
Is This Answer Correct ? | 0 Yes | 0 No |
I have two questions here. 1. How to read a flat file in reverse order? 2. How to read a VSAM KSDS file in reverse order? In both the cases we donot know the total number of records.
What is the difference between comp and comp-3?
Consider the below example call a-test1. -- -- -- a-test1. if a=b perform a-test through a-exit next sentence else if b=c perform c-test through c-exit. if a=d perform d-test through d-exit. a-test. -- -- a-exit. exit. can u tell me what will happen if a=b after looping into a-exit will the control go back to a- test1. will the condition a=d be checked???
Can we redefine the field of x(200) to less than 200?
How include time & date in the report generation in cobol programing?
How To move a value to an array using move verb?
01 WS-NAME PIC X(10) OCCURES 2. by this we can get ws-name 2 times. My qustion is how can we access the second name
If you were passing a table via linkage, which is preferable - a subscript or an index?
in a indexed file what is procedure for read the records from 12 to 18. please give the code example
What is wrong with the following data declaration? 01 W-DATE PIC X(6). 05 DD PIC 99. 05 MM PIC 99. 05 YY PIC 99. (a) Nothing is wrong. (b) Under W-DATE all level 05 items are having a PIC 99 but level 01 has PIC X(6). (c) PIC can't be specified for a group item. (d) DD, MM, and YY are invalid datanames.
)If there are 10 steps in GDG, if I want to refer the step2 after step5 . what should I do?
Program A calls program B. Will the working storage variables declared in program B be initialized every time it is called by program A or will the values be retained until the end of program A?