Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Cobol File Handling for VSAM Files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
sandippawar21
Currently Banned

New User


Joined: 09 Sep 2008
Posts: 9
Location: Pune

PostPosted: Tue Sep 09, 2008 4:00 pm    Post subject: Cobol File Handling for VSAM Files
Reply with quote

HI,

I have one calling program and called program. I want a one field value of vsam file back from called pgm to calling pgm.

So, tell me whether I will need FD entry of that file in called pgm or calling pgm?
Back to top
View user's profile Send private message

Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue Sep 09, 2008 4:13 pm    Post subject: Reply to: Cobol File Handling
Reply with quote

Sandip,

Quote:
I have one calling program and called program. I want a one field value of vsam file back from called pgm to calling pgm.


Check the manual for EXTERNAL which can be used in the File division.

Quote:
So, tell me whether I will need FD entry of that file in called pgm or calling pgm?


I think it FD entries should be in both the programs with an EXTERNAL clause.
Back to top
View user's profile Send private message
sandippawar21
Currently Banned

New User


Joined: 09 Sep 2008
Posts: 9
Location: Pune

PostPosted: Tue Sep 09, 2008 4:30 pm    Post subject: Cobol File Handling
Reply with quote

Aaru,

As per my knowledge,EXTERNAL clause we can use for a variable, which can by accessed by one pgm from other pgm.

Like, If there are 2 pgm Pgm A & Pgm B and if I want to acess Pgm B's any variable's value in PGM A. Then in this case I will need to declare that variable as External in Pgm B.

My concern is FD entry declaration.....not field/variable value access.

Please correct if i m wrong.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7997
Location: Bellevue, IA

PostPosted: Tue Sep 09, 2008 5:01 pm    Post subject:
Reply with quote

EXTERNAL can be applied to files. But why don't you just pass a variable from the calling program to the called program, let the called program set the value, and return with the value?

Is the called program being invoked many times from the calling program? If it's reading the VSAM file you don't want to open the file, read, and then close the file every time.
Back to top
View user's profile Send private message
sandippawar21
Currently Banned

New User


Joined: 09 Sep 2008
Posts: 9
Location: Pune

PostPosted: Tue Sep 09, 2008 5:52 pm    Post subject:
Reply with quote

1st solution is ok. But my requirment says I need to deal with the file only and called pgm is called many times.

So, please tell me how I will have to handle FD entry of that file.
Back to top
View user's profile Send private message
sandippawar21
Currently Banned

New User


Joined: 09 Sep 2008
Posts: 9
Location: Pune

PostPosted: Tue Sep 09, 2008 5:53 pm    Post subject:
Reply with quote

Sorry......called PGM is not called many times.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed Sep 10, 2008 11:09 am    Post subject: Reply to: Cobol File Handling for VSAM Files
Reply with quote

Sandip,

Quote:
So, please tell me how I will have to handle FD entry of that file.


From My first post:

Quote:
I think it FD entries should be in both the programs with an EXTERNAL clause.


By having FD entries with the EXTERNAL clause in both the calling and called programs, the file can be OPENed ONLY in the main program and all file operations (READ,WRITE) can be done in the called program.

If you are not OK with this, Post your requirement clearly.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us