Page 1 of 2

Adding/revising Sub program without compiling Main program

PostPosted: Fri Aug 31, 2012 8:25 am
by seiko
Great day to all out there! :)

I just want a help for this,
I want to develop a main cobol program that will call a sub program.
The main cobol program will not be compiled whenever I will add a new sub program or revised and compiled the sub program.
I will be have a 10 sub program for different specific computation and it can eventually increase.
Is it possible to add a new sub program without compiling the main program?
Is it possible to call and revised sub program without compiling the main program?

Help please ...

Thanks a lot ;)

Re: Adding/revising Sub program without compiling Main progr

PostPosted: Fri Aug 31, 2012 8:56 am
by dick scherrer
Hello and welcome to the forum,

Yes, you can do what i believe you want.

Learn about a dynamic call rather than a static call.

Also for this to easily work, you need to make sure the linkage secton of each of the called programs are the same - even if there are fields that are not used for a particular calulation.

Re: Adding/revising Sub program without compiling Main progr

PostPosted: Fri Aug 31, 2012 11:15 am
by BillyBoyo
I'm not sure what you mean by "adding" a new sub-program.

Re: Adding/revising Sub program without compiling Main progr

PostPosted: Fri Aug 31, 2012 12:56 pm
by NicC
Ditto to what BillyBoyo said. If you add a new sub-program how does your main program know a) the name and b) when to call it, if you do not amend it?

Re: Adding/revising Sub program without compiling Main progr

PostPosted: Fri Aug 31, 2012 4:31 pm
by seiko
NicC wrote:Ditto to what BillyBoyo said. If you add a new sub-program how does your main program know a) the name and b) when to call it, if you do not amend it?


This means that I will also revised the main program?
It is not possible not to revised and compile the main program when adding a new sub program?

Thanks , for further reference pls

Re: Adding/revising Sub program without compiling Main progr

PostPosted: Fri Aug 31, 2012 4:43 pm
by enrico-sorichetti
It is not possible not to revised and compile the main program when adding a new sub program?


if You do not revise the <calling> program how in hell will be the new subroutine invoked

better review Your understanding of things ....

let' s categorize the environment ...

DYNAMIC CALLS ONLY

1) existing programs - main, subroutines ( might be nested )

if the only changes affect the internal processing of the single subroutines
==> it is enough to <recompile> only the affected subroutine
if the changes affect parameter/argument passing ( number/definition )
==> You will have to recompile ALL the subroutines affected



2) adding new subroutines ( any level of nesting )
==> You will have to compile the new subroutine and EVIDENTLY the main/upper level subroutine which is supposed to call the new subroutuine

but You could have found out by Yourself using Your neuron :mrgreen:

Re: Adding/revising Sub program without compiling Main progr

PostPosted: Fri Aug 31, 2012 5:09 pm
by BillyBoyo
A slight caveat. It can be done, from Cobol, but due to the complexity it adds to understanding, it is something not to do unless you really, really, need to.

Re: Adding/revising Sub program without compiling Main progr

PostPosted: Fri Aug 31, 2012 7:53 pm
by dick scherrer
Hello,

Maybe i'm misunderstanding, but if the program(s) to be called were specified by a PARM or in some control file/member, the calling program need not be re-compiled just because a new subprogram is being invoked.

The work to do this should be rather trivial (again, unless i am missing something). This would need to be well documented for the ones to follow and add more sub-programs or change the ones being called.

Suggest you write a little stup "calling program" and a couple of test called modules and run a test. If there are questions/problems, post what you tried and what happened and someone will be able to help.

Re: Adding/revising Sub program without compiling Main progr

PostPosted: Fri Aug 31, 2012 8:09 pm
by BillyBoyo
Hello Dick,

That's the one. CALL lidentifier/dataname. If it is used to service one CALL with many modules, things can become somewhat opaque in ascertaining which modules were called when with what data.

If it is used as simply and straightforwardly as possible, with seperate CALL statements per parameter module, it is as manageable as you say.

Still, TS seems to have done a wander...

Re: Adding/revising Sub program without compiling Main progr

PostPosted: Fri Aug 31, 2012 8:31 pm
by dick scherrer
Hi Billy,

TS seems to have done a wander...
Seems to happen rather regularly - expecially if what TS wants to hear is not one of the earlier replies. Sometimes, they do reply again. Often, they get their answer and leave the topic :(

I believe the calling an unknown module is the easy part. If i wanted this to be even more independent, i'd make up a set of variables to be used in Every call and i'd probably have a "common" set of code in the calling module module to invoke whatever calculation module.

I's also have a naming convention such that the calculation sub-programs would be named "CALCxxxx" and if more was needed to gather info for the call a companion called module (GATHxxxx) to "complete" the common calling data. The xxxx would be the same to relate the two.