DB2 Server for VSE & VM: Application Programming


Link-Editing and Loading the Program

After compilation, programs must be link-edited and loaded before they can be run.

Link-Editing the Program with DB2 Server for VM TEXT Files

To enable your program to communicate with the application server, you must link-edit your program with one or more DB2 Server for VM TEXT files, one of which is the  resource adapter stub. Every DB2 Server for VM application program must be link-edited with this stub; FORTRAN and COBOL programs need to be link-edited with additional TEXT files.

Using the Resource Adapter Stub Routine

The resource adapter stub routine has a file name of ARIRVSTC, but is invoked by its entry point name ARIPRDI. To link-edit this stub routine successfully with the user program, you must INCLUDE ARIRVSTC or place the TEXT files in a CMS TXTLIB. This will make the entry point ARIPRDI known to the link-edit process.

Using Other TEXT Files

Other files that need to be link-edited, depending on the host language, include:

If you receive an unresolved external reference message for a module name that begins with ARI or SQL, check the link process to ensure that all required extra linkage modules are included.

Some of these modules contain entry points with names that are different from the module name. The code generated by the DB2 Server for VM preprocessor can reference one of these entry points, depending on the SQL statements in your application.

Including the TEXT File in the Link-Editing

Using the CMS LOAD Command

One way to link-edit these TEXT files to your program is to INCLUDE them after your program name in the CMS LOAD command. Then, when you load your program, the CMS linkage editor automatically links your program to the TEXT files relocatable modules that you specified, and resolves virtual storage addresses among the TEXT files.

For example, SAMPLE1 is the user's program name and ARIRVSTC is the TEXT file in the CMS LOAD command below:



LOAD SAMPLE1 ARIRVSTC

To see other examples of REXX EXEC's that use the CMS LOAD command, see any of the REXX EXEC's listed in Figure 6.

Note that if the user machine has READ access to the production minidisk, the CMS LOAD command will automatically load the needed TEXT file, searching all accessed CMS minidisks in ascending order (A through Z) for TEXT files that it needs. For additional information about CMS LOAD, see the VM/ESA: CMS Command Reference manual.

Using the CMS TXTLIB Command

Instead of specifying ARIRVSTC in the CMS LOAD command, you can put ARIRVSTC and all your application TEXT files into a TXTLIB. To create a TXTLIB, enter:

TXTLIB GEN my-lib ARIRVSTC program-name  . . .

To add new programs to a TXTLIB, enter the following command:

TXTLIB ADD my-lib program-name2 program-name3  . . .

After a program is in a TXTLIB, enter the following commands to perform the link-edit:

GLOBAL TXTLIB my-lib
LOAD program-name

For more information about TXTLIB, see the VM/ESA: CMS Command Reference manual.

Creating a Load Module Using the CMS GENMOD Command

All of the TEXT files are on the DB2 Server for VM production minidisk (Q-disk). After loading the DB2 Server for VM application, you should create a module by issuing the CMS GENMOD command. This module can be used in multiple user mode, but is not required; it is required, however, to run in single user mode. For example, to create a module for an assembler application program called SAMPLE1 that has been compiled and added to a TXTLIB called LIBRARY1, enter the following commands:

GLOBAL TXTLIB LIBRARY1
LOAD SAMPLE1
GENMOD SAMPLE1

This creates a CMS file with a file name of SAMPLE1 and a file type of MODULE.

To see other examples of REXX EXEC's that use the CMS GENMOD command, see any of the REXX EXEC's listed in Figure 6.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]