Created On: 06 September 2010
Problem:
If you have more than one type of runtime, differentiated by the suffixes used when compiling them, and one type is spaces, you may run into trouble when trying to call a subroutine suffixed by spaces from a routine which is not suffixed by spaces.
If you are working with an Operating System that allows your runtimes to be formatted as:
Progname. (with a fullstop but no suffix)
...you may experience the following problem.
Problem Definition
You have two types of runtimes, one is suffixed *.COB (compiled as –o @.COB) and the other is suffixed *.CB2 (compiled as –o @.CB2). Thus:
Type 1 : progname.COB
Type 2 : progname.CB2
Your config file has the following variable set:
CODE_SUFFIX COB
If you were running a COBOL program of Type 1, how would you call a COBOL program of Type 2 from within your Type 1 program?
If you are working with an Operating System that allows your runtimes to be formatted as:
Progname. (with a fullstop but no suffix)
...you may experience the following problem.
Problem Definition
You have two types of runtimes, one is suffixed *.COB (compiled as –o @.COB) and the other is suffixed *.CB2 (compiled as –o @.CB2). Thus:
Type 1 : progname.COB
Type 2 : progname.CB2
Your config file has the following variable set:
CODE_SUFFIX COB
If you were running a COBOL program of Type 1, how would you call a COBOL program of Type 2 from within your Type 1 program?
Resolution:
To change the CODE_SUFFIX variable from within your cobol program, add the following line:
SET ENVIRONMENT “CODE_SUFFIX” TO literal-name
where literal-name is defined in working storage as a PIC X(3) with a value of “CB2”, not forgetting to change it back to “COB” when you return to the calling module.
Complication
What happens if your two types of runtimes are *.COB and *. (compiled as –o @.), so your two runtime types become:
Type 1 : progname.COB
Type 2 : progname.
How would you call a routine of Type 2 from within a routine of Type 1?
Unfortunately, you cannot do this from within your cobol module. The following line of code could be added to your Type 1 module, if your Type 2 module was named progname (without the fullstop, i.e. compiled as –o @) :
SET_ENVIRONMENT “CODE_SUFFIX” TO SPACES
Explanation
If a CODE_SUFFIX is defined, the system automatically appends a fullstop followed by the stated suffix. If, however, the CODE_SUFFIX is changed to spaces, then the fullstop is not appended to the name.
SET ENVIRONMENT “CODE_SUFFIX” TO literal-name
where literal-name is defined in working storage as a PIC X(3) with a value of “CB2”, not forgetting to change it back to “COB” when you return to the calling module.
Complication
What happens if your two types of runtimes are *.COB and *. (compiled as –o @.), so your two runtime types become:
Type 1 : progname.COB
Type 2 : progname.
How would you call a routine of Type 2 from within a routine of Type 1?
Unfortunately, you cannot do this from within your cobol module. The following line of code could be added to your Type 1 module, if your Type 2 module was named progname (without the fullstop, i.e. compiled as –o @) :
SET_ENVIRONMENT “CODE_SUFFIX” TO SPACES
Explanation
If a CODE_SUFFIX is defined, the system automatically appends a fullstop followed by the stated suffix. If, however, the CODE_SUFFIX is changed to spaces, then the fullstop is not appended to the name.