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

Cobol File Handling for VSAM Files


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 1287
Location: Chennai, India

PostPosted: Tue Sep 09, 2008 4:13 pm
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Sep 09, 2008 5:01 pm
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
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
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: 1287
Location: Chennai, India

PostPosted: Wed Sep 10, 2008 11:09 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
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
Search our Forums:

Back to Top