Problem:
Following is an example of the type of error that can occur at runtime when using a database such as Sybase that requires a pre-compiler.
Load error : file 'CSBCTXGLOBAL'
error code: 173, pc=0, call=1, seg=0
173 Called program file not found in drive/directory
In this instance the Sybase runtime files had only been compiled to .gnt
Resolution:
This problem is due the Sybase run-time not being loaded.
We can get the Sybase run-time linked into COBOL program executable by compiling them to shared object (.so) files.
Following is an example of a portion of a compile script. Originally the Sybase files were compiled using cob -ug ....This has been changed to compile them as shared objects - cob -zUg. Also, note the inclusion of the U switch - this tells the compiler that subprograms will be dynamically loaded and will cause a compiler error if not included.
..........
# -ug compiles to gnt (u) and animate (g).
if (($line == 0));
then
echo No SQL statements found, standard compile
#
cob -ug $1 -C anim -C "COBIDY ASSIGN(EXTERNAL)" -C LIST="" -C SETTINGS=COL
# rc=$?
cob -zUg $1 -C anim -C "COBIDY ASSIGN(EXTERNAL)" -C LIST="" -C SETTINGS=COL
rc=$?
else
echo Found "$line" SQL statements, using Sybase pre-compiler
dos2unix -437 $1 $1
# in case source contains CR
#
cob -ug $1 -C "p(cobsql) csqlt==sybase endp" -L $SYBASE/OCS-12_5/devlib -lcobct -lct -lcs # -lcomn -ltcl -lintl -lnsl -lm -C LIST="" -C SETTINGS=COL
#
rc=$?
cob -zUg $1 -C "p(cobsql) csqlt==sybase endp" -L $SYBASE/OCS-12_5/devlib -lcobct -lct -lcs -lcomn -ltcl -lintl -lnsl -lm -C LIST="" -C SETTINGS=COL
rc=$?
fi
etc.......
The compile script will now create an executable with a .so extension instead of .gnt. This can be run the same way ie. cobrun jobexec.so

