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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking

Status
Not open for further replies.

carolly

Programmer
Joined
Aug 2, 2001
Messages
27
Location
AU
I am a little confused about linking sub programs. My books state that the main program will call the subprogram from a library. It must have the same details in Working Storage as the linkage section in the subprogram to be called, but how does the subprogram become part of a library?
 
Carolly,

there are basically three ways of using a sub program:

1. including the code in the same source as the main program; in this way, they are compiled together in one object.
2. statically linking the object together with that of the main program into one executable; the location of the sub-program object has to be known at compile-time.
3. dynamically calling the sub-program.

Only in the last way there is actually a seperate object needed at run-time. The environment you are working in determines where that object should be, and how it is found.
Using JCL, for instance, the libraries / directories where called objects can be found are listed in the job.

Hope this helps; if not, please get back with us.

Regards,
Ronald.

 
When the subprogram (not a "nested" program) is compiled, it is put into a library, just as is a main program. In fact, in many shops, it is the same library. If it is called dynamically in an IBM mainframe environment, you will need a STEPLIB card pointing to that library.

Stephen J Spiro
Member, J4 COBOL Standards Committee
check it out at

stephenjspiro at hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top