Using the API in the MVS Environment

Example:

Compiling a C Program

Compiling a Cobol Program

The API uses standard call-by-reference linkage conventions. There are no additional compile-time requirements. However, you must be sure that the API routines are called with these standard conventions.

To create an API application, compile the application in the usual manner. When link-editing the API application, include member EDAUSRO of the qualif.EDALIB.LOAD data set. EDAUSRO contains the entry points for the API subroutines and load information for the module.

The MVS environment uses sample JCL (provided with the product) to compile and link the sample programs below, so there is no matching "gencpgm" script like other platforms. Confirm that the samples properly compile, link, and run to ensure there is a properly working environment.

Working samples are provided in various languages. The first step in writing an API application should be to confirm that the desired sample language properly compiles, links, and runs to ensure there is a properly working environment.

Note: When compiling a Cobol program in the MVS environment, do not include the DYNAM option in the list of compilation parameters. Including DYNAM will cause the Cobol program to abend at the EDAINIT stage and return an abend 806 ("EDAINIT module not found").


Top of page

Example: Compiling a C Program

Compile and link the C program in the usual manner and use the following JCL to post-link and run your application. This sample JCL is located in qual.EDACTL.DATA(LKUSROC) and is for the qual.EDACTL.DATA(EDAAPC) example.

//LKUSROC   JOB  ()
//*---------------------------------------------------------------------*
//* LKUSROC ¦ Post-link the sample EDAAPC API C program with *
//* ¦ EDAUSRO and Run it.
//*---------------------------------+-----------------------------------*
//* DATE: 14MAY95 ¦PRODUCT: EDA ¦ CREATOR: YHC *
//*-----------------------+---------+-----------------------------------*
//* Description: *
//* Compile and link the C application as you normally do, then *
//* submit this JCL to Post-link and run the program. *
//*-----------------------+------------------------------+--------------*
//* Tailoring: *
//* To use the job you must: *
//* add a valid job card *
//* replace 'qualif' with the high level qualifier for*
//* your EDA data sets *
//* replace 'yourlib' with your runtime loadlib *
//*'your.config.file(yourfile)' with a valid EDA client *
//* communication config file *
//* replace <query> with a valid SQL query *
//* SQL queries must terminate with ;*
//*---------------------------------------------------------------------*
//LSASLIB EXEC PGM=IEWL,PARM='RENT,LET,LIST,NCAL,SIZE=2048K'
//SYSUT1 DD UNIT=VIO,SPACE=(CYL,(10,1))
//SYSPRINT DD SYSOUT=*
//SYSLMOD DD DSN=yourlib.LOAD,DISP=SHR
//EDALIB DD DSN=qualif.EDALIB.LOAD,DISP=SHR
//SYSLIN DD DSN=&&OBJ,DISP=(OLD,DELETE)
// DD DDNAME=SYSIN
//SYSIN DD *
INCLUDE EDALIB(EDAUSRO)
MODE AMODE(31),RMODE(ANY)
NAME EDAAPC(R)
/*
//******************************************************************
//EDAAPC EXEC PGM=EDAAPC,REGION=4096K
//******************************************************************
//STEPLIB DD DISP=SHR,DSN=yourlib.LOAD
// DD DISP=SHR,DSN=qualif.EDALIB.LOAD
//*** EDASASC is required for TCP/IP only ***
// DD DISP=SHR,DSN=qualif.EDASASC.LINKLIB
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSABOUT DD SYSOUT=*
//SYSTERM DD SYSOUT=*
//STDOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//EDAOUT DD SYSOUT=*
//EDACS3 DD DISP=SHR,DSN=your.config.file(yourfile)
//SYSIN DD *
<server_name>
<query1>;
<query2>;
.
.
<last_query>;
/*

Top of page

Example: Compiling a Cobol Program

The following JCL, located in EDACTL.DATA(LKUSROCB), is a sample compile, link, and run for the sample Cobol application qual.EDACTL.DATA(EDAAPCOB):

//LKUSROCB JOB ()
//*---------------------------------------------------------------------*
//* LKUSROCB ¦ Compile, Link-edit and Run the sample EDAAPCOB AP *
//* ¦ Cobol program. *
//*-------------------------------+-------------------------------------*
//* DATE: 14MAY95 ¦PRODUCT: EDA ¦ CREATOR: YHC *
//*-----------------------+------------------------------+--------------*
//* Tailoring: *
//* To use the job you must: *
//* add a valid job card *
//* replace 'qualif' with the high level qualifier for *
//* your EDA data sets *
//* replace 'yourlib' with your runtime loadlib *
//*'your.config.file(yourfile)' with a valid EDA client ommunication *
//* config file *
//* replace <userid> with a valid EDA SQL userid *
//* replace <password> with a valid password for <userid> *
//* replace <query> with a valid SQL query *
//* SQL queries must terminate with ; *
//* 'Y' and 'N' in the lines after <query> lines are the *
//* answer to 'Another query (Y/N) ?'. Therefore, only after *
//* the last <query> we have N. *
//*------------------------------------------------------------------- *
//COB1 EXEC PGM=IGYCRCTL,
// PARM='LIB,OBJECT,MAP,LIST,RES,RENT,NODYNAM',COND=(4,LT)
//STEPLIB DD DISP=SHR,DSN=SYS1.COB2COMP
// DD DISP=SHR,DSN=SYS1.COB2LIB
//SYSLIB DD DISP=SHR,DSN=qualif.EDACTL.DATA
//SYSIN DD DISP=SHR,DSN=qualif.EDACTL.DATA(EDAAPCOB)
//SYSLIN DD DSN=&&LOADSET,DISP=(MOD,PASS),UNIT=SYSDA,
// SPACE=(800,(500,500))
//SYSPRINT DD SYSOUT= *
//SYSUDUMP DD SYSOUT= *
//SYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(1,1))
//SYSUT2 DD UNIT=SYSDA,SPACE=(CYL,(1,1))
//SYSUT3 DD UNIT=SYSDA,SPACE=(CYL,(1,1))
//SYSUT4 DD UNIT=SYSDA,SPACE=(CYL,(1,1))
//SYSUT5 DD UNIT=SYSDA,SPACE=(CYL,(1,1))
//SYSUT6 DD UNIT=SYSDA,SPACE=(CYL,(1,1))
//SYSUT7 DD UNIT=SYSDA,SPACE=(CYL,(1,1))
//******************************************************************
//LKED EXEC PGM=IEWL,PARM='RENT,LET,LIST,NCAL,SIZE=2048K'
//******************************************************************
//SYSUT1 DD UNIT=VIO,SPACE=(CYL,(10,1))
//SYSPRINT DD SYSOUT=*
//SYSLMOD DD DSN=yourlib.LOAD,DISP=SHR
//EDALIB DD DSN=SYS1.COB2LIB,DISP=SHR
//OBJ DD DSN=&&OBJ,DISP=(OLD,DELETE,DELETE)
//EDALIB DD DSN=qualif.EDALIB.LOAD,DISP=SHR
//SYSLIN DD
INCLUDE OBJ
INCLUDE EDALIB(EDAUSRO)
MODE AMODE(31),RMODE(ANY)
ENTRY EDAAPP
NAME EDAAPCOB(R)
/*
//******************************************************************
//EDAAPCOB EXEC PGM=EDAAPC,REGION=4096K
//******************************************************************
//STEPLIB DD DISP=SHR,DSN=yourlib.LOAD
// DD DISP=SHR,DSN=qualif.EDALIB.LOAD
//*** EDASASC is required for TCP/IP only ***
// DD DISP=SHR,DSN=qualif.EDASASC.LINKLIB
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSABOUT DD SYSOUT=*
//SYSTERM DD SYSOUT=*
//STDOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//EDAOUT DD SYSOUT=*
//EDACS3 DD DISP=SHR,DSN=your.config.file(yourfile)
//SYSIN DD *
<userid>
<password>
<server_name>
<query1>;
Y
<query2>;
Y
.
.
<last_query>;
N
/*

API programs will load API method calls and the communications protocol subsystem modules at run-time.


iWay Software