View previous topic :: View next topic
|
Author |
Message |
niks_jude Warnings : 1 Active User
Joined: 01 Dec 2006 Posts: 144 Location: Mumbai
|
|
|
|
I have defined my file section entry like this.
FD FBPFILE-FILE
RECORD CONTAINS 6000 CHARACTERS
BLOCK CONTAINS 0 RECORDS
RECORDING MODE IS F.
01 FBPFILE-CASE-REC-AREA PIC X(6000).
COPY PTUBFPCR.
The copybook PTUBFPCR has its own 01 variable.
My question is that - When I read file into FBPFILE-CASE-REC-AREA variable, the copybook is also populated. I am not sure why this is happening because FBPFILE-CASE-REC-AREA and 01 variable of the copybook are 2 entirely different variables. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hey Jude,
The 01 levels in an FD are treated as redefs of each other, so if you READ INTO either 01, it uses the same area of the file buffer and any lower level variable of either 01 can be referenced from the PD. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
niks_jude wrote: |
I have defined my file section entry like this.
01 FBPFILE-CASE-REC-AREA PIC X(6000).
COPY PTUBFPCR.
The copybook PTUBFPCR has its own 01 variable.
My question is that - When I read file into FBPFILE-CASE-REC-AREA variable, the copybook is also populated. I am not sure why this is happening because FBPFILE-CASE-REC-AREA and 01 variable of the copybook are 2 entirely different variables. |
That is standard COBOL processing. |
|
Back to top |
|
|
revel
Active User
Joined: 05 Apr 2005 Posts: 135 Location: Bangalore/Chennai-INDIA
|
|
|
|
Hi jude
Quote: |
When I read file into FBPFILE-CASE-REC-AREA variable, the copybook is also populated. I am not sure why this is happening because FBPFILE-CASE-REC-AREA and 01 variable of the copybook are 2 entirely different variables |
This is because, The 01 Variables in FILE SECTION is treated as REDEFINING Items
say
01 WS-GROUP-1 PIC X(80)
01 WS-GROUP-2 PIC X(50)
WHICH INTERNALLY REDEFINED
Ie WS-GROUP-2 REDEFINES WS-GROUP-1 AND WS-GROUP-2 WILL HAVE A VALUE OF WS-GROUP-1 TILL 50 BYTES.. |
|
Back to top |
|
|
niks_jude Warnings : 1 Active User
Joined: 01 Dec 2006 Posts: 144 Location: Mumbai
|
|
|
|
That answers my question. Thank you. |
|
Back to top |
|
|
|