Using Z Data Tools functions in REXX procedures or TSO clists

To call a Z Data Tools function from a REXX procedure, use the following syntax:
HFMMAIN "$function-name-parameters"
To call a Z Data Tools function from a CLIST, use the following syntax:
HFMMAIN $function-name-parameters
Join the parameter names and values with an equal sign or a blank. Separate these pairs with a comma or blank. For example:
HFMMAIN "$DSP DSNIN='HFMUSER.TEST.KSDS1',FORMAT=HEX,KEY=000100,NLRECS=20"

Within a REXX procedure, all profile settings are taken from the installation defaults. For details on changing Z Data Tools default profile settings, see Z Data Tools Customization Guide.

When invoking the Z Data Tools functions in a REXX exec, HFMPRINT (or SYSPRINT) must be allocated.

Example

The following example shows a REXX procedure that uses Z Data Tools functions.
Figure 1. Example REXX procedure using Z Data Tools functions
/* REXX */
/* ***************************************************/
/* Example: Execute Z Data Tools functions from REXX */
/* ***************************************************/
parse upper source environment.
address tso
"alloc f(HFMPRINT) DUMMY REUSE"
/* Set the output to a REXX stem variable FILEM.                   */  
HFMMAIN "$SET PRINTOUT=REXX"
filem.0=0                       /* discard any previous output     */
/* invoke SCS to list data sets                                    */
HFMMAIN "$SCS FUNCTION=PRINT," ,
      "DSNAME='hlq.**'"
say "SCS return code:" RC
/* Display the FILEM.n variable contents                           */
SAY ">>> SCS output:"
DO i=1 to filem.0               /* process all printed lines       */
  SAY filem.i                   /* display the printline           */
  end