Compiling and linking the application

The following tables list the general forms of the commands for compiling and linking Embedded SQL/COBOL applications on Sybase-supported platforms running the UNIX operating system.

Table 5-2 shows commands for compiling and linking Embedded SQL/COBOL applications using nondebug libraries.

Table 5-2: Static compile-and-link commands for Embedded SQL/COBOL

Platform

Command

Sun Solaris SPARC 32-bit and 64-bit

cob -x program.cbl -L $SYBASE/$SYBASE_OCS/lib
-lsybcobct -lsybct -lsybcs -lsybtcl -lsybcomn
-lsybintl -lsybunic -lnsl -ldl -lm -lsocket
-o program

Sun Solaris x86-64 32-bit and 64-bit

cob -x program.cbl -L $SYBASE/$SYBASE_OCS/lib
-lsybcobct -lsybct -lsybcs -lsybtcl -lsybcomn
-lsybintl -lsybunic -lnsl -ldl -lm -lsocket
-o program

HP HP-UX PA-RISC 32- bit and 64 bit

cob -x program.cbl -L $SYBASE/$SYBASE_OCS/lib
-lsybcobct -lsybct -lsybcs -lsybtcl -lsybcomn
-lsybintl -lsybunic -lBSD -lcl -lm -o program

HP HP-UX Itanium 32-bit and 64-bit

cob -x program.cbl -L $SYBASE/$SYBASE_OCS/lib
-lsybct -lsybcobct -lsybtcl -lsybcs -lsybcomn
-lsybintl -lsybunic -lcl -lm -ldld -o program

IBM AIX RS/6000 32-bit and 64-bit

cob -x program.cbl -L $SYBASE/$SYBASE_OCS/lib
-lsybcobct -lsybct -lsybcs -lsybtcl -lsybcomn
-lsybintl -lsybunic -lm -o program

Linux x86 32-bit

cob -x program.cbl -L $SYBASE/$SYBASE_OCS/lib
-lsybct -lsybcobct -lsybtcl -lsybcs -lsybcomn
-lsybintl -lsybunic-ldl -lnsl -lm -o program

Table 5-3 shows commands for compiling and linking Embedded SQL/COBOL applications using debug libraries.

Table 5-3: Debug compile-and-link commands for Embedded SQL/COBOL

Platform

Command

Sun Solaris SPARC 32-bit and 64-bit

cob -g -x program.cbl 
-L $SYBASE/$SYBASE_OCS/devlib -lsybcobct 
-lsybct -lsybcs -lsybtcl -lsybcomn -lsybintl 
-lsybunic -lnsl -ldl -lm -lsocket -o program

Sun Solaris x86-64 32-bit and 64-bit

cob -g -x program.cbl 
-L $SYBASE/$SYBASE_OCS/devlib -lsybcobct 
-lsybct -lsybcs -lsybtcl -lsybcomn -lsybintl 
-lsybunic -lnsl -ldl -lm -lsocket -o program

HP HP-UX PA-RISC 32-bit and 64 bit

cob -g -x program.cbl 
-L $SYBASE/$SYBASE_OCS/devlib -lsybcobct 
-lsybct -lsybcs -lsybtcl -lsybcomn -lsybintl 
-lsybunic -lcl -lm -o program

HP HP-UX Itanium 32-bit and 64-bit

cob -g -x program.cbl -L
$SYBASE/$SYBASE_OCS/devlib -lsybct -lsybcobct
-lsybtcl -lsybcs -lsybcomn
-lsybintl -lsybunic -lcl -lm -ldld -o program

IBM AIX RS/6000 32-bit and 64-bit

cob -g -x program.cbl
-L $SYBASE/$SYBASE_OCS/devlib -lsybcobct
-lsybct -lsybcs -lsybtcl -lsybcomn -lsybintl
-lsybunic -lm -o program

Linux x86 32-bit

cob -g -x program.cbl -L
$SYBASE/$SYBASE_OCS/devlib -lsybct -lsybcobct
-lsybtcl -lsybcs -lsybcomn
-lsybintl -lsybunic-ldl -lnsl -lm -o program

To build a 64-bit COBOL application, make sure that the build mode for the COBOL compiler is correctly set. For example, in ESQL/COBOL, the COBMODE environment variable must be set to 32 for a 32-bit build, and to 64 for a 64-bit build. Failure to do this may result in a build error, or produce an executable with an unexpected signature on platforms that support both 32-bit and 64-bit COBOL applications. For more information about building and linking a 64-bit application, see the sybopts.sh script in SYBASE/$SYBASE_OCS/sample/esqlcob.