View previous topic :: View next topic
|
Author |
Message |
draviki
New User
Joined: 02 Dec 2005 Posts: 5
|
|
|
|
Hi
Which one is correct ?
01 IN-RECORD.
03 A PIC S9(8)V9(2) COMP-3.
03 B REDEFINES A .
05 C PIC 9(5).
05 D PIC 9(5).
01 A PIC S9(8)V9(2) COMP-3.
01 B REDEFINES A .
05 C PIC 9(5).
05 D PIC 9(5). |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
The REDEFINES clause cannot be used in a level 01 entry in the File Section.
Regards,
Priyesh. |
|
Back to top |
|
|
iknow
Active User
Joined: 22 Aug 2005 Posts: 411 Location: Colarado, US
|
|
|
|
Hi draviki
Priyesh you are right. So for your query option one is correct.
More information on REDEFINES
Allows the same area of memory to be referenced by more than one data-name with different format and sizes.
Multiple 01 levels of same FD are Implicitly Redefined
Restrictions on REDEFINES
OCCURS and REDEFINES cannot be combined
Qualification of data-name-2 not required
Value Clauses only in Condition Names
Redefinition Ceases Whenever a Level No is <= that of data-name-1 or data-name-2 is encountered
The Size of Data-name-1 must be Less than or equal to Data-name-2
Data item lengths and types can also be respecified within an area
Hope this helps. |
|
Back to top |
|
|
akashs
New User
Joined: 24 Nov 2005 Posts: 49 Location: chennai
|
|
|
|
hi,
Multiple 01 levels of same FD are Implicitly Redefined ?....plz explain me this one..
regards,
akashs |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
He means that if you define more than 1 01 level in an FD they all define the same space that the rec was read into.
This means that you can use any dataname of any 01 level to reference the various offsets in the FD rec.
This is usually done where you have multiple rec types in a file. Each 01 would be used to access a different rec type. |
|
Back to top |
|
|
iknow
Active User
Joined: 22 Aug 2005 Posts: 411 Location: Colarado, US
|
|
|
|
Hi mmwife,
That was a wonderful expalnation. Thanks for your valuable information. |
|
Back to top |
|
|
mk_kumar315
New User
Joined: 21 Nov 2005 Posts: 10
|
|
|
|
Hi priyesh and iknow,
As for as my Knowledge, what i learnt is:
We can REDEFINE an element of 01 level,if both are at the same level and both should have the same data type.
And also REDEFINES can be used with OCCURS clause if REDEFINES is sub-ordinate to the OCCURS clause.
If Iam WRONG, Please Let Me Know.
M.K.Kumar. |
|
Back to top |
|
|
|