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

CALL [Linux or Unix shellscript]

Status
Not open for further replies.

SiouxCityElvis

Programmer
Jun 6, 2003
228
US
Hello. I use RMCOBOL-85 on Linux.

Does anyone know if I can use a CALL Statement to kick off a shell script and control would come back to the "calling" cobol program so that it would continue to execute it's code after the call statement?

Basically, I want to CALL a Unix shell script instead of a COBOL subprogram.

Thanks.
-David
 
Can you please give me an example? And will it return control to my "calling" program even though my shell script needs to kick off a java program AND another COBOL program?

Thanks.
-David
 
And if you are on a COBOL program you should NEVER start another runtime from within this first one, as it will take up another license.


Whether the control returns to you will depend on how you execute the commands within the shell script.

If they are submitted to the background then control will return to the calling program otherwise it will wait until they are finished. This is the normall shell programming issues, nothing to do with COBOL.




Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
It will take up another license? Does that mean I should never use CALL to another "sub-cobol program"?
 
Your runtime license specifies a certain number of simultaneous "uses". On Linux each time you start the runtime from the command line counts as a use. So, using CALL to call a subprogram does not constitute another use, but using CALL"SYSTEM" to start another main program from the command line does constitute an additional use (and it is to this that Frederico refers).

Liant technical support can answer this question authoritatively if this remains confusing.

Tom Morrison
 
Okay. I think it's clear to me now. Since I would be calling a script that would in turn execute another COBOL program, that would qualify it as an additional "runtime" being used.

Curious...is it common that programmers on Linux/Unix call a script from a COBOL program? What are some typical scenarios that provoke a programmer to call a script program?(just curious as you experts have probably been exposed to needing to use that kind of call or have heard of other programmers needing to do such a call).

Thanks.
-David
 
AmarilloElvis,

Yes there are loads of reasons why a script would be called from a COBOL program.

For example a script to initialize a "/dev/tty" device to a correct stty settings. Or another one to create a backup of your application folders. Or to install (with uncompress) a new version of your "accounting module".




Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Frederico,

How do I ensure that it does get redirected to the background per your email above that stated:

"Whether the control returns to you will depend on how you execute the commands within the shell script.

If they are submitted to the background then control will return to the calling program otherwise it will wait until .."?

-David
 
Use a @ at the end of the script

e.g.

call "system" using "/bin/yourscript param1 @"
 
Depending on the shell you may need to add a "." before
the system command.

system-command = ". /bin/runme"
call "system" using system-command"

Otherwise the call will start another occurance of the shell
when the script finished it will still be in that shell and
not return to the calling program. This can also leave
the cobol job in limbo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top