Adding/revising Sub program without compiling Main program



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Adding/revising Sub program without compiling Main program

Postby seiko » Fri Aug 31, 2012 8:25 am

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 ;)
seiko
 
Posts: 8
Joined: Fri Aug 31, 2012 8:04 am
Has thanked: 0 time
Been thanked: 0 time

Re: Adding/revising Sub program without compiling Main program

 

Re: Adding/revising Sub program without compiling Main progr

Postby dick scherrer » Fri Aug 31, 2012 8:56 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Adding/revising Sub program without compiling Main progr

Postby BillyBoyo » Fri Aug 31, 2012 11:15 am

I'm not sure what you mean by "adding" a new sub-program.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Adding/revising Sub program without compiling Main progr

Postby NicC » Fri Aug 31, 2012 12:56 pm

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?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Adding/revising Sub program without compiling Main progr

Postby seiko » Fri Aug 31, 2012 4:31 pm

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
seiko
 
Posts: 8
Joined: Fri Aug 31, 2012 8:04 am
Has thanked: 0 time
Been thanked: 0 time

Re: Adding/revising Sub program without compiling Main progr

Postby enrico-sorichetti » Fri Aug 31, 2012 4:43 pm

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:
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: Adding/revising Sub program without compiling Main progr

Postby BillyBoyo » Fri Aug 31, 2012 5:09 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Adding/revising Sub program without compiling Main progr

Postby dick scherrer » Fri Aug 31, 2012 7:53 pm

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Adding/revising Sub program without compiling Main progr

Postby BillyBoyo » Fri Aug 31, 2012 8:09 pm

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...
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Adding/revising Sub program without compiling Main progr

Postby dick scherrer » Fri Aug 31, 2012 8:31 pm

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post