Building Micro Focus COBOL routines on Windows

You can use the bldrtn.bat build scripts that are provided with IBM data server client for compiling and linking embedded SQL routines. Build scripts are in the sqllib\samples\cobol_mf directory, along with sample programs that can be built with these build script files.

About this task

The bldrtn.bat batch file compiles the routines into a DLL on the server. The batch file takes two parameters, represented inside the batch file by the variables %1 and %2.

The first parameter, %1, specifies the name of your source file. The batch file uses the source file name, %1, for the DLL name. The second parameter, %2, specifies the name of the database to which you want to connect. Since the stored procedure must be built on the same instance where the database resides, there are no parameters for user ID and password.

Only the first parameter, source file name, is required. Database name is optional. If no database name is supplied, the program uses the default sample database.

To build the sample program outsrv from the source file outsrv.sqb, if connecting to the sample database, enter:
   bldrtn outsrv
If connecting to another database, also enter the database name:
   bldrtn outsrv database
The script file copies the DLL to the server in the path sqllib/function.

Once you build the DLL, outsrv, you can build the client application, outcli, that calls the routine within the DLL (which has the same name as the DLL). You can build outcli using the batch file, bldapp.bat.

To call the outsrv routine, run the sample client application by entering:
   outcli database userid password
where
database
Is the name of the database to which you want to connect. The name could be sample, or its alias, or another name.
userid
Is a valid user ID.
password
Is a valid password for the user ID.

The client application accesses the DLL, outsrv, which executes the routine of the same name on the server database. The output is then returned to the client application.