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 non-debug libraries.

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

Platform

Command

Sun Solaris 2.x

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

Sun Solaris 10 x64 (Opteron) 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 9000 (8xx)

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

HP Itanium

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

IBM RS/6000

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 2.x

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 10 x64 (Opteron) 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 9000 (8xx)

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

HP Itanium

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

IBM RS/6000

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 can result in a build error or can 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 available in the SYBASE/$SYBASE_OCS/sample/esqlcob directory.