View previous topic :: View next topic
|
Author |
Message |
sandippawar21 Currently Banned New User
Joined: 09 Sep 2008 Posts: 9 Location: Pune
|
|
|
|
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 |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
sandippawar21 Currently Banned New User
Joined: 09 Sep 2008 Posts: 9 Location: Pune
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
sandippawar21 Currently Banned New User
Joined: 09 Sep 2008 Posts: 9 Location: Pune
|
|
|
|
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 |
|
|
sandippawar21 Currently Banned New User
Joined: 09 Sep 2008 Posts: 9 Location: Pune
|
|
|
|
Sorry......called PGM is not called many times. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
|