Calling a CA IDMS COBOL program from a REXX exec
search cancel

Calling a CA IDMS COBOL program from a REXX exec


Article ID: 28487


Updated On:





This contains a sample REXX program that will call a COBOL program. The COBOL program will run as an ERU in the IDMS CV.


A REXX program can execute a task code that is defined to an IDMS system by invoking RHDCUCFB, the UCF Batch front-end program, and passing to it the name of the task code which it wishes to execute. As stated in the CA IDMS System Operations manual, when it is executed, "the batch front-end reads input from SYSIPT. Each statement is interpreted as terminal input and is passed to the DC/UCF system. The physical terminal name is used as the terminal identifier. Output from the DC/UCF task is returned to the front-end, which writes the output to SYSLST. The terminal disconnect occurs when the BYE task is invoked." The IDMS task that is invoked by RHDCUCFB will be executed as an ERU (External Run-Unit) under whichever IDMS CV is identified in the REXX program.

In order to accomplish this, a few steps are required:

  1. The REXX program must be written to invoke RHDCUCFB.
  2. The CA IDMS program to be executed must be defined in the IDMS Sysgen.
  3. A task code to invoke the desired program must also be defined in the IDMS Sysgen.
  4. The IDMS.PROD.LOADLIB must contain the members distributed at install time in the CUSTOM.LOADLIB as well as module RHDCUXIT otherwise a 4008 or 4002 error will occur.

With the above conditions in place, below is a sample REXX program which calls RHDCUCFB. RHDCUCFB will then execute any valid IDMS task code that is defined to the sysgen; that task will invoke the desired program. The code includes several values which must be replaced by your shop-specific values if this is to run successfully; these are identified below the sample program.

 /* REXX */
 x = msg('off')
 "free fi(sysctl,syslst,sysipt,SYSTSPRT)"
 "delete xxx"
 "delete yyy"
 x = msg('on')
 "alloc fi(sysipt) ds(xxx) new lrecl(80)" 
 "alloc fi(syslst) ds(yyy) new"
 "alloc fi(sysctl) ds('IDMSCV.sysctl')  shr reu"
 "alloc fi(SYSTSPRT) ds(zzz) new"
 QUEUE 'DCMT D AC TA;'  /* any valid IDMS task code */
 queue '/*'
 "execio "n" diskw sysipt (finis"
 ucfrc = rc

For this to run, you will need to make the following substitutions:

  1. In the statement "alloc fi(sysipt) ds(xxx)...", xxx represents the input dsname for RHDCUCFB. The input commands can be specified in this dataset, if it is pre-allocated; or they can be specified in-stream via QUEUE statements(see note #6 below). In this syntax, xxx can be replaced with any valid data set name.
  2. In the statement "alloc fi(syslst) ds(yyy)...", yyy represents the output listing dsname for RHDCUCFB; yyy can be replaced with any valid data set name.
  3. In the statement "alloc fi(SYSTSPRT) ds(zzz)...", zzz represents the output dsname of the background job that RHDCUCFB will be submitting; zzz can be replaced with any valid data set name.
  4. In this example xxx, yyy, zzz as discussed above will all be prefixed with the userid that is submitting the REXX program. For example, once RHDCUCFB ends you can browse USERID.YYY and view the output of the tasks that RHDCUCFB executed.
  5. The xxx, yyy, & zzz datasets in this example do not have to be pre-allocated before the REXX program is executed. They can be pre-allocated if you would rather that, or if that's what your site standards require. If you wish to specify the RHDCUCFB input commands independently of the REXX program, then the xxx dataset must be pre-allocated and the desired commands stored there before the REXX program is executed.
  6. If you want to use in-stream commands to specify the tasks that RHDCUCFB is to execute, then substitute the task code you wish to execute in place of the 'DCMT D AC TA' in the first QUEUE statement shown. Or, if you wish more flexibility, you can eliminate the QUEUE statements from the above example and code the RHDCUCFB input statements in an external dataset instead, for more flexibility (see note #1, above).
  7. Substitute your IDMS production loadlib for 'IDMS.PROD.LOADLIB' in the CALL statement. Make sure that after the correct loadlib, (RHDCUCFB) is still specified. As noted above, ensure that this loadlib contains all of the load modules originally installed into the CUSTOM.LOADLIB, as well as module RHDCUXIT.
  8. In the statement "alloc fi(sysctl) ds('IDMSCV.sysctl') shr reu", in place of IDMSCV, specify the DSN of any valid SYSCTL dataset. The RHDCUCFB job will execute as an external run unit (ERU) under the CV indicated by the SYSCTL dataset that?s specified.


Release: IDADSO00100-18.5-ADS-for CA-IDMS