Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Static vs dynamic

Status
Not open for further replies.

delugir

Programmer
Mar 26, 2009
4
0
0
US
My system uses static batch calls for almost all existing programs. For new programs, however, they want us to use dynamic calls where we can. We are creating some new programs that we want to use dynamic calls for, but we are also calling some existing programs statically.

My question is this...

ProgramA opens a VSAM file
ProgramA dynamically calls ProgramB
ProgramB statically calls ProgramC
ProgramC reads the same VSAM file ProgramA opened

Why am I getting a file status 47 (trying to read a file that was not opened) in ProgramC?

If I change the code so that ProgramB opens the file (with no other changes), then I don't get the error in ProgramC.

Any ideas?

Thanks!
 
The behavior you describe is very strange. AFAIK, FDs in separate routines are independent of each other unless EXTERNAL is specified. You should ALWAYS get a 47 unless the file is opened by ProgramC.

What is your environment?

Regards,

Glenn
 
Thanks for your response.

We are using Enterprise COBOL for z/OS 4.1.0.

Our entire batch flow is currently statically linked. We have a driver program that has many programs called from there and then those programs call other programs etc. Uually, the driver will open all the files (or call other programs to open the files) and then any program in the calling chain can read the file without a problem. The FD is always in the program that opens the file, but the file isn't always read from that program.

It didn't seem to be a problem until we created a new driver program (ProgramA in my example) that dynamically called ProgramB, which then statically called ProgramC.
 
The statically called program is a new instance, so it has it's own status, also in relation to the file.

If you define the file EXTERNAL, you can at least solve some of the troubles.

The best is to access the file using only one dynamically called program that understands the status of the file: opened, closed, etc. The interface to such a program can also be external, can be easy.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top