One possibility to run an Easytrieve Db2 SQL program and CALL a COBOL Db2 SQL sub program from this Easytrieve program and then return to the Easytrieve application to run more SQL statements, is to bind the COBOL Data Base Request Module (DBRM) and the Easytrieve DBRM into one Db2 PLAN.
Release : 11.6
Component : CA Easytrieve Plus Report Generator
For example, the Db2 DSNHPC precompiler is going to create the COBOL DBRM member you need:
...
//PC EXEC PGM=DSNHPC,REGION=0M,
// PARM='HOST(IBMCOB),QUOTE,APOSTSQL,SOURCE,XREF'
//DBRMLIB DD DISP=SHR,DSN=your.DBRMLIB(cobpgmn)
...
(This step is usually within the COBOL compile job.)
The Easytrieve compile and BIND job is going to create the other DBRM member:
...
//DB2PRE EXEC PGM=DSNHPC,COND=(3,LT,GEN),
// PARM='HOST(ASM),XREF,SOURCE'
//DBRMLIB DD DISP=SHR,DSN=your.DBRMLIB(ezt+pgmn)
...
The required PLAN can be bound within the same job as follows:
...
//AUTH EXEC PGM=IKJEFT01,DYNAMNBR=20
//STEPLIB DD DISP=SHR,DSN=...
//DBRMLIB DD DISP=SHR,DSN=your.DBRMLIB
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//REPORT DD SYSOUT=*
//SYSTSIN DD *
DSN SYSTEM(yourSSID)
BIND PACKAGE(db2pkname) MEMBER(ezt+pgmn) -
ACT(REPLACE) ISOLATION(CS) VALIDATE(BIND)
BIND PACKAGE(db2pkname) MEMBER(cobpgmn) -
ACT(REPLACE) ISOLATION(CS) VALIDATE(BIND)
BIND PLAN(db2plnname) PKLIST(db2pkname.*)
RUN PROGRAM(&DSNTIAP) PLAN(&DSNTIAPL) -
LIB('your.Db2.runlib')
END
/*
//SYSIN DD *
GRANT EXECUTE ON PACKAGE db2pkname.* TO PUBLIC
/*
Now you can run the Easytrieve program as follows:
...
//GO EXEC PGM=IKJEFT01,DYNAMNBR=20,REGION=0M
//STEPLIB DD DISP=SHR,DSN=...
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//PAN$SQL DD *
TSO
/*
//SYSTSIN DD *
DSN SYSTEM(yourSSID)
RUN PROGRAM(ezt+pgmn) PLAN(db2plnname) +
LIB('your.USERLOAD')
END
/*
...