IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

File Section variable definition


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Mon Nov 12, 2007 8:32 pm
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Nov 12, 2007 9:09 pm
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Nov 12, 2007 11:32 pm
Reply with quote

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
View user's profile Send private message
revel

Active User


Joined: 05 Apr 2005
Posts: 135
Location: Bangalore/Chennai-INDIA

PostPosted: Tue Nov 13, 2007 8:54 am
Reply with quote

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
View user's profile Send private message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Tue Nov 13, 2007 11:25 am
Reply with quote

That answers my question. Thank you.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
Search our Forums:

Back to Top