HP 3000 Manuals

Linking [ Micro Focus COBOL for UNIX COBOL User Guide ] MPE/iX 5.0 Documentation


Micro Focus COBOL for UNIX COBOL User Guide

Linking 

The link examples show how to create and executable file sqlprog.exe from
a single object file sqlprog.exe.  Where two examples are shown, the
first creates a coblib-linked file, the second creates an lcobol-linked
file.  When linking on OS/2 you can link with the file doscalls.lib (as
shown) or with os2.lib.  It is not necessary to link in sqlinit or
sqlinim if the program was not compiled with either the SQLINIT or
SQLPROT directives set.

IBM Database Manager 

Windows          On Windows, only Database 2 OS/2 and Windows Requester
                 are supported.  The link step is:

     link sqlprog+sqlinit,,,coblibw+coblib+
                            cobw+pcdrdll,sqlprog.def/nod/noe/a:16;

where sqlprog.def contains for example:

     exetype windows 3.1
     protmode
     code  preload fixed
     data  preload fixed multiple
     stacksize 16384
     heapsize  1024

AIX                   On AIX, using Database 2 AIX/6000, you can create
                      an executable module directly from the command
                      line:

     cob -x sqlprog.cbl $COBDIR/src/sql/sqlinit.o

OS/2                  On OS/2 the link step is dependent on whether the
                      version of Database Manager is 16- or 32-bit.

The following are 16-bit:

   *   IBM OS/2 Extended Edition Database Manager

   *   IBM Extended Services for OS/2 Database Manager

The following is 32-bit:

   *   IBM Database 2 OS/2 (DB2/2) Version 1

Linking with 16-bit Database Manager on OS/2 

For 16-bit Database Manager:

     link sqlprog+sqlinit,,,coblib+doscalls+sql_dyn;

     link sqlprog+sqlinit/st:16384,,,lcobol+doscalls+sql_dyn;

Linking with 32-bit Database Manager on OS/2 

For 32-bit Database Manager:

     link sqlprog+sqlinit,,,coblib+doscalls+sqldyn16;

     link sqlprog+sqlinit/st:16384,,,lcobol+doscalls+sqldyn16;

You can use either the shared run-time system (coblib) or the static
linked run-time system (lcobol) for linking SQL programs, and you can
create .exe or .dll files.

The default stack size of the application or of the RTS might be
insufficient although the exact size required depends on the application.
If your system traps with error SYS3175 when running a program, you
should increase the stack size as follows:

   *   If the program is lcobol-linked, you need to increase the size of
       the stack in your executable file.

       Specify the /ST linker option.  For example, to increase the
       program's stack size to 16,384, set the /ST linker option as
       follows:

            /ST:16384

       For details of this option, see the chapter Linking and Library 
       Management in your COBOL System Reference.

   *   If the program is coblib-linked and the trap occurs prior to the
       execution of the first COBOL statement in the program or after the
       last, you need to increase the stack size of your executable
       program.  You can do this in one of the following ways:

          *   Use the SQLPRE Compiler directive, which causes a call to
              be generated in the application program to ensure a stack
              size of 8192.  By default, the SQLPRE directive is set for
              SQL programs.  If this does not prevent the error, then use
              the method described above for lcobol to increase the stack
              size of the main executable file still further.

          *   If you have the add-on product Toolset, you can build your
              application, which automatically increases the program's
              stack size.  See the chapter Build in your Toolset 
              Reference for details.

   *   If the program is coblib-linked and the trap occurs during the
       execution of the COBOL application, then you need to increase the
       size of the RTS stack.  You do this by setting the /S run-time
       switch on COBSW. For example:

     set COBSW=/S30000

There is no absolute value to use to resolve this problem.  To determine
the best value for your circumstances, we recommend you try a value of
30,000 first and adjust this up or down as required.  For details on the
/S run-time switch, see the appendix Descriptions of Run-time Switches in
your COBOL System Reference.

We advise you to specify the NOSQLPRE Compiler Directive (so that the
default stack size is not increased) when creating a coblib-linked dll
file.  When creating any lcobol-linked executable file, the SQLPRE
Compiler directive has no useful function so you can safely set it to
NOSQLPRE.

Microsoft SQL Server 

On OS/2: 

     link sqlprog+sqlinim,,,coblib+doscalls+sqlak

     link sqlprog+sqlinim/st:16384,,,lcobol+doscalls+sqlak;

On Windows, linking SQL Server with Windows: 

     link sqlprog+sqlinim+cblwina,,,
             coblibw+coblib+cobw+sqlakw,sqlprog.def

     link sqlprog+sqlinim+cblwina,,,
             lcobolw+lcobol+cobw+sqlakw,sqlprog.def

     link sqlprog+sqlinim+cblwina,,,
             lcoboldw+   lcobol+cobw+sqlakw,sqlprog.def

The first example is coblib-linked, the second and third examples are
both lcobol-linked.  The second is for Windows programs which do not
require default window support (ie.  do not use ACCEPT or DISPLAY
statments) and the third is for Windows programs that do require default
window support.



MPE/iX 5.0 Documentation