|
The compiling of an xframe-targeted COBOL source (TP or batch) follows normally the same steps like on the original mainframe environment, in dependence with the program's typology and language. It comprehends :
In order to give an user-friendly interface to all compiling processes, the “xcob” script is supplied.
Synopsis
xcob [options] <source>
Use
xcob is used to compile both TP and batch COBOL programs. The filename specified as source has to be suffixed with “.pre”, and all files generated have the base name of the source.
Options
-b
|
handles programs as batch. By default xcob handles programs as TP.
|
-x
|
handles programs as TP. By default xcob handles programs as TP.
|
-m
|
handles programs as an IMS online program.
|
-i
|
generates .INT code
|
-u
|
generates .GNT code
|
-c
|
generates a link-editable object (.o)
|
-z
|
generates a .o object to build a shared library
|
-a
|
generate debug information
|
-o<path>
|
output to specified directory
|
-U<cmd>
|
specifies a user exit filter
|
-k
|
activates BLL handling
|
-E<ext>
|
handles input files is with specified extention
|
-s
|
preprocess for E/SQL
|
-R(oracle|sybase|db2|odbc|mssql)
|
specifies RDBMS: oracle, sybase, db2, odbc or mssql
|
-I<path>
|
alternative path for SQL include
|
-C<path>
|
alternative path for COBOL copybooks
|
-E
|
xprecob nosevere mode: precompiler doesn’t stops on error.
|
-L
|
let the COBOL compiler generating a list file.
|
-x
|
let the COBOL compiler to generate a cross-reference file.
|
-v
|
produces verbose output.
|
-h
|
produces command line help
|
-l
|
(lowercase L) activity is logged ob ‘xcob.log’
|
-A
|
forces ACUCOBOL compiler invocation
|
-M
|
forces Microfocus compiler invocation
|
-F
|
forces OpenCOBOL compiler invocation
|
-D
|
debug: all itemediate files are left in $PWD
|
-O <options>
|
specifies one or more of the following options:
|
HOST2UNIX
|
process source with 'cobconv' (former host2unix)
|
MFCOPY
|
uses MF copy/include preprocessor
|
ACUCOPY
|
use ACU copy/include preprocessor
|
NOMFCOPY
|
uses xframe internal copy/include preprocessors
|
NOACUCOPY
|
uses xframe internal copy/include preprocessors
|
MFCOBOL
|
enables MF COBOL dialect
|
OSVS
|
enables OSVS dialect (default)
|
VSC2
|
enables VSC2 dialect
|
COBSQL
|
uses COBSQL oracle interface
|
NOCOBSQL
|
uses SQL precompiler directly
|
NOCICS
|
compile a TP program without EXEC CICS (CALLs)
|
ANIM
|
same as -a
|
NOANIM
|
do not generate debug information
|
COBOL1
|
source file contains COBOL 1 limitations
|
SQL
|
same as -s
|
LOG
|
same as -l
|
ORACLE
|
same as -R oracle
|
DB2
|
same as -R db2
|
ODBC
|
same as -R odbc
|
MSSQL
|
same as -R mssql
|
SYBASE
|
same as -R sybase
|
SQLCA
|
includes SQLCA
|
CVDA
|
enables precompiler to handle CVDA values (DFHRESP)
|
POOLDIR
|
includes XCICS POOLDIR addressing
|
NOLINK
|
no CALL to LINK conversion performed
|
TRACE
|
enables script trace
|
NOERROR
|
manage COBOL errors (non severe) as warnings
|
DL1PRE
|
processs source with dl1 precompiler 'dl1pre.pl'
|
INTGNT
|
same as -u -a
|
AUTOCA
|
enables precompiler automatic COMMAREA definition
|
NORETURN
|
inhibits RETURN command
|
MAKESYN
|
forces COBSQL convert all COMP host variables to COMP-5 host variables (default on Linux)
|
NOMAKESYN
|
forces COBSQL to do no conversion of variables or host variables from COMP to COMP-5
|
ALTSPLIT
|
enables alternative parsing routine in precompiler
|
xcob produces the following files:
<sourcename>.errors List of errors caught during (pre)compiling phases
<sourcename>.lst List file if required (-L)
Moreover it generates debugable and non debugable code in fixed directories receiving this kind of coding.
Return codes
A return code of 0 (zero) is returned if compiling succeeded. Non zero if something went wrong.
Configuration
xcob may be configured both using environment variables and a configuration file.
The enviroment
Some environment variables should be previously set to let xcob work properly:
XCOBCONF
|
specifies an alternate configuration file (default is $HOME/etc/xcob.conf)
|
XCOB_INT_DEST
|
specifies output destination for executable code with debug symbols(-i option)
|
XCOB_GNT_DEST
|
specifies output destination for executable code without debug symbols (-u option)
|
XCOB_OBJ_DEST
|
specifies output destination for .o files (-c option)
|
XCOB_TP_COBOPT[1-9]
|
XCOB_TP_COBOPT1 up to XCOB_TP_COBOPT9 are used to pass compiler directives (COBOPTs) to the Microfocus COBOL compiler, while compiling TP programs. Please refer to your MicroFocus COBOL documentation.
|
XCOB_BATCH_COBOPT[1-9]
|
XCOB_BATCH_COBOPT1 up to XCOB_BATCH_COBOPT9 are used to pass compiler directives (COBOPTs) to the MicroFocus COBOL compiler, while compiling batch programs. Please refer to your MicroFocus COBOL documentation.
|
XCOB_TP_CBLFLAGS
|
ACUCOBOL compiler options for TP compiling
|
XCOB_BATCH_CBLFLAGS
|
ACUCOBOL compiler options for BATCH compiling
|
XCOB_CBLFLAGS
|
common ACUCOBOL compiler option for both TP and batch compiling
|
XCOB_TP_OCFLAGS
|
OpenCOBOL compiler options for TP compiling
|
XCOB_BATCH_OCFLAGS
|
OpenCOBOL compiler options for BATCH compiling
|
XCOB_OCFLAGS
|
common OpenCOBOL compiler option for both TP and batch compiling
|
XCOB_OC_CONF
|
configuration file to be provided to OpenCOBOL. The default is $XFRAMEHOME/etc/opencobol.conf
|
XCOB_COPYCOB
|
path for COBOL copybooks
|
XCOB_RDBMS
|
rdbms type (oracle, db2 or odbc; oracle is the default)
|
XCOB_DBCID
|
RDBMS connection string in the format user/password@dbname.
Mandatory to precompile with Oracle, UDB and MS SQL Server.
|
XCOB_SQLINCLUDE
|
default path for SQL include files.
|
XCOB_SQLOPT
|
option passed to SQL precompiler (procob, db2 prep, etc.).
The format of this variable depends on the precompiler type
|
XCOB_USEREXIT
|
contains the absolute path to an user supplied precompiling step. If this variable has been initialized with the name of a command or a shell script, the corresponding command or shell script will be executed during the pre-compiling step. It should contain path of directories and name of the shell script to be executed.
|
XCOB_COBOPTS
|
Additional options for XCOB
|
XCOB_OPTS4EXT_<ext>
|
Specifies particular options for the <ext> extention.
I.E.
export XCOB_OPTS4EXT_BT="-b -s"
will handle sources suffixed by .BT with options "-b -s".
|
The configuration file
The environment variable listed above may be contained in a file named xcob.conf which is loaded at XCOB startup. In this phase, xcob looks for the xcob.conf in present working directory and then in $HOME/etc. An alternative file may be specified setting the XCOBCONF environment with the full path to the desired configuration file.
Example configuration file 1
#
# xcob configuration file
# compile with Microfocus COBOL and Oracle
#
export COBCPY=$HOME/cpy:$XADMHOME/cpy:$XTPSHOME/cpy:$XCONVHOME/cpy:$XTABHOME/cpy:$XCICSHOME/cobcpy
export XCOB_INT_DEST=$HOME/objs/int
export XCOB_GNT_DEST=$HOME/objs/gnt
export XCOB_TP_COBOPT1="remove=MESSAGE remove=TEXT remove=ROLLBACK remove=CURSOR REMOVE=DEFAULT"
export XCOB_TP_COBOPT2="perform-type=osvs IBMCOMP warning=3 defaultbyte=0 nocheck constant ALPHA=0 REFNO
ALPHASTART=0"
export XCOB_TP_COBOPT3="COMP NOTRUNC SPZERO"
export XCOB_BATCH_COBOPT1="perform-type=osvs ibmcomp warning=3 ALPHASTART=0"
export XCOB_BATCH_COBOPT2="remove=COL remove=DEFAULT remove=CURSOR remove=BROWSING remove=PRINTER "
export XCOB_BATCH_COBOPT3="COMP NOTRUNC SPZERO COPYEXT=,cpy "
export XCOB_USEREXIT=
export XCOB_RDBMS="oracle"
export XCOB_SQLINCLUDE=$HOME/cpy
export XCOB_OPTIONS="MFCOBOL"
Example configuration file 2
#
# xcob configuration file
# compile with ACUCOBOL and IBM DB2 UDB
#
export COBCPY=$HOME/cpy:$XADMHOME/src:$XCICSHOME/cobcpy
export XCOB_INT_DEST=$HOME/objs/int
export XCOB_GNT_DEST=$HOME/objs/gnt
export XCOB_USEREXIT=
export XCOB_RDBMS="db2"
export XCOB_SQLINCLUDE=$HOME/cpy
export XCOB_DBCID="user1/mypass@HTDB2"
export XCOB_CBLFLAGS="-Dz -DCi -Dv=0 -D7 -Rw ERROR -Rw OVERFLOW -Rw POS"
COBOL Compilers options
To get best results while migrating from IBM COBOL, we suggest to use the following options for the COBOL compilers:
Microfocus COBOL
ACUCOBOL
OpenCobol
OpenCOBOL uses a configuration file to affect the compiler results. You can define your onw file, which must include the following directives.
#
# example OpenCOBOL custom configuration
#
include "ibm.conf"
name: "MyConf"
assign-clause: mf
eject-statement: ok
not-reserved: CYCLE
not-reserved: NORMAL
Please refer to the compiler specific docs for further information.
Working with DB
Oracle DB
When precompiling for Oracle is required, xcob invokes procob. With Microfocus compiler procob call may be embedded in the compiling process (default for MF) or called directly. With ACUCOBOL procob is always called directly.
In the first case options are passed through the file "cobsql.dir" that must be placed in the directory or the source being compiled. To get further information on cobsql.dir please refer to Microfocus compilers docs.
Example cobsql.dir
csqlt=ora8
sqldebug
end-c
varchar=yes
declare_section=no
userid=xbm/xbm@htora1
include=/usr2/hite/fabrizio/cpy
ireclen=132
sqlcheck=syntax
maxliteral=160
endp
When procob is invoked directly options are passed through the environment XCOB_SQLOPT and Oracle userid is specified through XCOB_DBCID
I.e.:
export XCOB_RDBMS="oracle"
export XCOB_DBCID=pli2cob/pli2cob@dbh1
export XCOB_SQLOPT="ireclen=132 sqlcheck=syntax"
IBM DB2/UDB
When precompiling for DB2 is required, xcob invokes db2 preparation.
With Microfocus compiler, DB2 precompiler is invoked only through the compiler. With ACUCOBOL DB2 precompiler is invoked directly
For Microfocus compiler, options and userid are passed through the environment XCOB_SQLOPT in the MicroFocus format. To get further information on DB2 precompiling through Microfocus compilers please refer to Microfocus compilers docs.
For ACUCOBOL and OpenCOBOL compilers the options to DB2 precompiler are always passed through the environment XCOB_SQLOPT, but with the format specified on the IBM DB2 documentation. Userid and password must be specified using XCOB_DBCID.
I.e.:
# for Microfocus
export XCOB_RDBMS="db2"
export XCOB_SQLOPT="db==SAMPLE pass==db2inst2.db2inst2 bindfile "
# for ACUCOBOL
export XCOB_RDBMS="db2"
export XCOB_DBCID=user1/mypass@udbdb2
export XCOB_SQLOPT=""
Microsoft SQL Server
When precompiling for MS SQL Server is required, xcob instructs the compiler to process SQL through its MSSQL/ODBC processor. Userid and password may be specified using XCOB_DBCID.
To get further information on MSSQL precompiling please refer to Microfocus compilers E/SQL or ACUCOBOL ACU/SQL docs.
Additional options may be passed through the environment XCOB_SQLOPT.
I.e.:
export XCOB_RDBMS="mssql"
export XCOB_DBCID="usr1/mypass@MSSQLDB1"
export XCOB_SQLOPT=""
ODBC Data Sources
When ODBC precompiling is required, xcob instructs the compiler to process SQL through ODBC. Userid and password may be specified using XCOB_DBCID.
To get further information on ODBC precompiling through cob please refer to Microfocus ServerExpress/NetExpress E/SQL or ACUCOBOL ACU/SQL docs.
Additional options may be passed through the environment XCOB_SQLOPT.
I.e.:
export XCOB_RDBMS="oracle"
export XCOB_DBCID="usr1/mypass@MYODBC"
export XCOB_SQLOPT="init autocommit sql(check)"
Examples
# xcob -s PGMS010
xcob: PGMS010: XPRE precompiler started.
xcob: PGMS010: Precompiled succesfully.
xcob: PGMS010: Oracle E/SQL precompilation started
xcob: PGMS010: Oracle precompilation succesfully
xcob: PGMS010: COBOL compiler started.
xcob: PGMS010: Information issued.
C:\home\fabrizio\src\databases\sqlserver>xcob -sua TESTMSX.pre
xcob: loading configuration from C:/home/fabrizio/src/databases/sqlserver/xcob.conf
xcob: TESTMSX: XPRE precompiler started.
xcob: TESTMSX: precompiled succesfully.
xcob: TESTMSX: ODBC E/SQL embedded precompiler enabled
xcob: TESTMSX: COBOL compiler started.
xcob: TESTMSX: invoking ACU COBOL compiler
xcob: TESTMSX: compiled successfully
|