DSNUTILS stored procedure (deprecated)

The DSNUTILS stored procedure enables you use the SQL CALL statement to execute DB2® utilities from a DB2 application program that specifies EBCDIC input.

Important: Start of changeThe DSNUTILS stored procedure is deprecated and replaced by DSNUTILU. It is best to convert existing callers of SYSIBM.SYSUTILS to use the SYSIBM.SYSUTILU stored procedure instead.End of change

When called, DSNUTILS performs the following actions:

  • Dynamically allocates the specified data sets
  • Creates the utility input (SYSIN) stream
  • Invokes DB2 utilities (program DSNUTILB)
  • Deletes all the rows that are currently in the created temporary table (SYSIBM.SYSPRINT)
  • Captures the utility output stream (SYSPRINT) into a created temporary table (SYSIBM.SYSPRINT)
  • Declares a cursor to select from SYSPRINT:
    DECLARE SYSPRINT CURSOR WITH RETURN FOR
      SELECT SEQNO, TEXT FROM SYSPRINT
      ORDER BY SEQNO;
  • Opens the SYSPRINT cursor and returns.

The calling program then fetches from the returned result set to obtain the captured utility output.

Environment for DSNUTILS

Start of changeDSNUTILS must run in a WLM environment. The DSNWLM_UTILS environment is created for DB2 utilities stored procedures only. Stored procedures require special data set allocations. End of change

Start of changeThe WLM core environment DSNWLM_UTILS. DSNWLM_UTILS is intended for the following DB2 utilities stored procedures only:End of change

  • DSNUTILU
  • DSNUTILS (deprecated)

Start of changeIf you plan to run other applications in this environment other than DSNUTILS or DSNUTILU, add the procedure and add the DCB information for SYSIN. For example:End of change

Start of change
//SYSIN    DD    UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND),
//         DCB=(RECFM=V,LRECL=32708)
End of change
Start of change
Table 1. DSNWLM_UTILS environment
Property Description
NUMTCB 1
APF authorized Yes
Special DDs

These DDs are required:

  • SYSIN Allocates a work file for temporarily storing utility input statements.
  • SYSPRINT Allocates a work file for temporarily storing utility output messages.
  • RNPRIN01 Allocates a data set for messages from the sort program. Required only if you plan to invoke RUNSTATS and collect distribution statistics.
  • UTPRINT Allocates a data set for messages from the sort program.
  • DSSPRINT Allocates a data set for messages when making concurrent copies.

Example:

//UTPRINT DD SYSOUT=*
//RNPRIN01 DD SYSOUT=*
//DSSPRINT DD SYSOUT=*
//SYSIN DD UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND)
//SYSPRINT DD UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND)
Other considerations The STEPLIB needs to include DSN=prefix.SDSNEXIT or other library where the authorization exit modules (DSN3@ATH and DSN3@SGN) reside.
End of change

Start of changeInstallation job DSNTIJMV creates an address space proc called DSNWLMU for DSNWLM_UTILS. When the installation CLIST is customized, the name and library name of this proc are changed according to the DB2 subsystem name you specified on panel DSNTIPM in the field SUBSYSTEM NAME. For example, if you specified a subsystem name of VA1A then this proc will be named VA1AWLMU.End of change

Authorization required for DSNUTILS

To execute the CALL statement, the owner of the package or plan that contains the CALL statement must have one or more of the following privileges on each package that the stored procedure uses:

  • The EXECUTE privilege on the package for DSNUTILS
  • Ownership of the package
  • PACKADM authority for the package collection
  • SYSADM authority

Then, to execute the utility, you must use a privilege set that includes the authorization to run the specified utility.

Control statement for DSNUTILS

DSNUTILS dynamically allocates the specified data sets. Any utility that requires a sort must include the SORTDEVT keyword in the utility control statement, and optionally, the SORTNUM keyword.

If the DSNUTILS stored procedure invokes a new utility, refer to Table 2 for information about the default data dispositions that are specified for dynamically allocated data sets. This table lists the DD name that is used to identify the data set and the default dispositions for the data set by utility.

Table 2. Data dispositions for dynamically allocated data sets
DD name CHECK DATA CHECK INDEX or CHECK LOB COPY COPY- TOCOPY LOAD MERGE- COPY REBUILD INDEX REORG INDEX REORG TABLE-SPACE UNLOAD
SYSREC ignored ignored ignored ignored OLD KEEP KEEP ignored ignored ignored NEW CATLG CATLG NEW CATLG CATLG
SYSDISC ignored ignored ignored ignored NEW CATLG CATLG ignored ignored ignored NEW CATLG CATLG ignored
SYSPUNCH ignored ignored ignored ignored ignored ignored ignored ignored NEW CATLG CATLG NEW CATLG CATLG
SYSCOPY ignored ignored NEW CATLG CATLG ignored NEW CATLG CATLG NEW CATLG CATLG ignored ignored NEW CATLG CATLG ignored
SYSCOPY2 ignored ignored NEW CATLG CATLG NEW CATLG CATLG NEW CATLG CATLG NEW CATLG CATLG ignored ignored NEW CATLG CATLG ignored
SYSRCPY1 ignored ignored NEW CATLG CATLG NEW CATLG CATLG NEW CATLG CATLG NEW CATLG CATLG ignored ignored NEW CATLG CATLG ignored
SYSRCPY2 ignored ignored NEW CATLG CATLG NEW CATLG CATLG NEW CATLG CATLG NEW CATLG CATLG ignored ignored NEW CATLG CATLG ignored
SYSUT1 NEW DELETE CATLG NEW DELETE CATLG ignored ignored NEW DELETE CATLG ignored NEW DELETE CATLG NEW CATLG CATLG NEW DELETE CATLG ignored
SORTOUT NEW DELETE CATLG ignored ignored ignored NEW DELETE CATLG ignored ignored ignored NEW DELETE CATLG ignored
SYSMAP ignored ignored ignored ignored NEW CATLG CATLG ignored ignored ignored ignored ignored
SYSERR NEW CATLG CATLG ignored ignored ignored NEW CATLG CATLG ignored ignored ignored ignored ignored
FILTER ignored ignored NEW DELETE CATLG ignored ignored ignored ignored ignored ignored ignored

If the DSNUTILS stored procedure restarts a current utility, refer to Table 3 for information about the default data dispositions that are specified for dynamically-allocated data sets on RESTART. This table lists the DD name that is used to identify the data set and the default dispositions for the data set by utility.

Table 3. Data dispositions for dynamically allocated data sets on RESTART
DD name CHECK DATA CHECK INDEX or CHECK LOB COPY COPY- TOCOPY LOAD MERGE- COPY REBUILD INDEX REORG INDEX REORG TABLE-SPACE UNLOAD
SYSREC ignored ignored ignored ignored OLD KEEP KEEP ignored ignored ignored MOD CATLG CATLG MOD CATLG CATLG
SYSDISC ignored ignored ignored ignored MOD CATLG CATLG ignored ignored ignored MOD CATLG CATLG ignored
SYSPUNCH ignored ignored ignored ignored ignored ignored ignored ignored MOD CATLG CATLG MOD CATLG CATLG
SYSCOPY ignored ignored MOD CATLG CATLG ignored MOD CATLG CATLG MOD CATLG CATLG ignored ignored MOD CATLG CATLG ignored
SYSCOPY2 ignored ignored MOD CATLG CATLG MOD CATLG CATLG MOD CATLG CATLG MOD CATLG CATLG ignored ignored MOD CATLG CATLG ignored
SYSRCPY1 ignored ignored MOD CATLG CATLG MOD CATLG CATLG MOD CATLG CATLG MOD CATLG CATLG ignored ignored MOD CATLG CATLG ignored
SYSRCPY2 ignored ignored MOD CATLG CATLG MOD CATLG CATLG MOD CATLG CATLG MOD CATLG CATLG ignored ignored MOD CATLG CATLG ignored
SYSUT1 MOD DELETE CATLG MOD DELETE CATLG ignored ignored MOD DELETE CATLG ignored MOD DELETE CATLG MOD CATLG CATLG MOD DELETE CATLG ignored
SORTOUT MOD DELETE CATLG ignored ignored ignored MOD DELETE CATLG ignored ignored ignored MOD DELETE CATLG ignored
SYSMAP ignored ignored ignored ignored MOD CATLG CATLG ignored ignored ignored ignored ignored
SYSERR MOD CATLG CATLG ignored ignored ignored MOD CATLG CATLG ignored ignored ignored ignored ignored
FILTER ignored ignored MOD DELETE CATLG ignored ignored ignored ignored ignored ignored ignored

DSNUTILS stored procedure syntax diagram

The following syntax diagram shows the SQL CALL statement for invoking utilities as a stored procedure. Because the linkage convention for DSNUTILS is GENERAL, you cannot pass null values for input parameters. For character parameters that you are not using, specify an empty string ('').

Read syntax diagram
>>-CALL--DSNUTILS--(--utility-id,restart,utstmt,retcode--,------>

>--utility-name--,recdsn,recdevt,recspace----------------------->

>--,discdsn,discdevt,discspace--,pnchdsn,pnchdevt,pnchspace----->

>--,copydsn1,copydevt1,copyspace1------------------------------->

>--,copydsn2,copydevt2,copyspace2------------------------------->

>--,rcpydsn1,rcpydevt1,rcpyspace1------------------------------->

>--,rcpydsn2,rcpydevt2,rcpyspace2------------------------------->

>--,workdsn1,workdevt1,workspace1------------------------------->

>--,workdsn2,workdevt2,workspace2--,mapdsn,mapdevt,mapspace----->

>--,errdsn,errdevt,errspace--,filtrdsn,filtrdevt,filtrspace----->

>--)-----------------------------------------------------------><

DSNUTILS option descriptions

utility-id
Specifies a unique identifier for this utility within DB2.

This is an input parameter of type VARCHAR(16) in EBCDIC.

restart
Specifies whether DB2 is to restart a current utility, and, if so, at what point the utility is to be restarted.

restart is an input parameter of type VARCHAR(8) in Unicode UTF-8, which must be translatable to allowable EBCDIC characters. Specify one of the following values for this parameter:

NO or null
Indicates that the utility job is new, not a restart. No other utility with the same utility identifier (UID) can exist.

The default is null.

CURRENT
Restarts the utility at the last commit point.
PHASE
Restarts the utility at the beginning of the currently stopped phase. Use the DISPLAY UTILITY to determine the currently stopped phase.
PREVIEW
Executes in PREVIEW mode the utility control statements that follow. While in PREVIEW mode, DB2 parses all utility control statements for syntax errors, but normal utility execution does not take place. If the syntax is valid, DB2 expands all LISTDEF lists and TEMPLATE data set name expressions that appear in SYSIN and prints the results to the SYSPRINT data set. DB2 evaluates and expands all LISTDEF definitions into an actual list of table spaces or index spaces. DB2 also evaluates TEMPLATE data set name expressions into actual data set names through variable substitution. DB2 also expands lists from the SYSLISTD DD and TEMPLATE data set name expressions from the SYSTEMPL DD that is referenced by a utility invocation.

Absence of the PREVIEW keyword turns off preview processing with one exception. The absence of this keyword does not override the PREVIEW JCL parameter which, if specified, remains in effect for the entire job step.

This option is identical to the PREVIEW JCL parameter.

utstmt
Specifies the utility control statements.

This is an input parameter of type VARCHAR(32704) in EBCDIC.

retcode
Specifies the utility highest return code.

This is an output parameter of type INTEGER.

utility-name
Specifies the utility that you want to invoke.

This is an input parameter of type VARCHAR(20) in EBCDIC.

Because DSNUTILS allows only a single utility here, dynamic support of data set allocation is limited. Specify only a single utility that requires data set allocation in the utstmt parameter.

Select the utility name from the following list:

  • ANY1
  • CHECK DATA
  • CHECK INDEX
  • CHECK LOB
  • COPY
  • COPYTOCOPY
  • DIAGNOSE
  • LOAD
  • MERGECOPY
  • MODIFY RECOVERY
  • MODIFY STATISTICS
  • QUIESCE
  • REBUILD INDEX
  • RECOVER
  • REORG INDEX
  • REORG LOB
  • REORG TABLESPACE
  • REPAIR
  • REPORT RECOVERY
  • REPORT TABLESPACESET
  • RUNSTATS INDEX
  • RUNSTATS TABLESPACE
  • STOSPACE
  • UNLOAD
  1. Use ANY to indicate that TEMPLATE dynamic allocation is to be used. This value suppresses the dynamic allocation that is normally performed by DSNUTILS.
Recommendation: Invoke DSNUTILS with a utility-name of ANY and omit all of the xxxdsn, xxxdevt, and xxxspace parameters. Use TEMPLATE statements to allocate the data sets.
When you use TEMPLATE, utilities attempt to close and deallocate data sets when the utilities complete. However, under some circumstances, utilities cannot deallocate data sets. Under those circumstances, take one of the following sets of actions:
  • If you want to terminate a utility after a failure:
    1. Use the TERM UTIL command to terminate the failing utility.
    2. Refresh the WLM environment in one of the following ways:
      • Submit the VARY command:
        VARY WLM,APPLENV=xxx,REFRESH
      • Call the WLM_REFRESH stored procedure.

    When you terminate the utility, DB2 deletes the data sets that are needed by the utility.

  • If you want to restart a utility after a failure:
    1. Specify DISP (NEW,CATLG,CATLG) in your template for data sets that are needed by the utility.
    2. When the utility fails, refresh the WLM environment, but do not terminate the utility.

    You need to delete the allocated data sets manually after the utility completes.

recdsn
Specifies the cataloged data set name that is required by LOAD for input, or by REORG TABLESPACE as the unload data set. recdsn is required for LOAD. It is also required for REORG TABLESPACE unless you also specified NOSYSREC or SHRLEVEL CHANGE. If you specify recdsn, the data set is allocated to the SYSREC DD name.

This is an input parameter of type VARCHAR(54) in EBCDIC.

If you specified the INDDN parameter for LOAD, the specified ddname value must be SYSREC.

If you specify the UNLDDN parameter for REORG TABLESPACE, the specified ddname value must be SYSREC.

recdevt
Specifies a unit address, a generic device type, or a user-assigned group name for a device on which the recdsn data set resides.

This is an input parameter of type CHAR(8) in EBCDIC.

recspace
Specifies the number of cylinders to use as the primary space allocation for the recdsn data set. The secondary space allocation is 10% of the primary space allocation.

This is an input parameter of type SMALLINT.

discdsn
Specifies the cataloged data set name that is used by LOAD as a discard data set to hold records not loaded, and by REORG TABLESPACE as a discard data set to hold records that are not reloaded. If you specify discdsn, the data set is allocated to the SYSDISC DD name.

This is an input parameter of type VARCHAR(54) in EBCDIC.

If you specify the DISCARDDN parameter for LOAD or REORG TABLESPACE, the specified ddname value must be SYSDISC.

discdevt
Specifies a unit address, a generic device type, or a user-assigned group name for a device on which the discdsn data set resides.

This is an input parameter of type CHAR(8) in EBCDIC.

discspace
Specifies the number of cylinders to use as the primary space allocation for the discdsn data set. The secondary space allocation is 10% of the primary space allocation.

This is an input parameter of type SMALLINT.

pnchdsn
Specifies the cataloged data set name that REORG TABLESPACE UNLOAD EXTERNAL or REORG TABLESPACE DISCARD uses to hold the generated LOAD utility control statements. If you specify a value for pnchdsn, the data set is allocated to the SYSPUNCH DD name.

This is an input parameter of type VARCHAR(54) in EBCDIC.

If you specify the PUNCHDDN parameter for REORG TABLESPACE, the specified ddname value must be SYSPUNCH.

pnchdevt
Specifies a unit address, a generic device type, or a user-assigned group name for a device on which the pnchdsn data set resides.

This is an input parameter of type CHAR(8) in EBCDIC.

pnchspace
Specifies the number of cylinders to use as the primary space allocation for the pnchdsn data set. The secondary space allocation is 10% of the primary space allocation.

This is an input parameter of type SMALLINT.

copydsn1
Specifies the name of the required target (output) data set, which is needed when you specify the COPY, COPYTOCOPY, or MERGECOPY utilities. It is optional for LOAD and REORG TABLESPACE. If you specify copydsn1, the data set is allocated to the SYSCOPY DD name.

This is an input parameter of type VARCHAR(54) in EBCDIC.

If you specify the COPYDDN parameter for COPY, COPYTOCOPY, MERGECOPY, LOAD, or REORG TABLESPACE, the specified ddname1 value must be SYSCOPY.

copydevt1
Specifies a unit address, a generic device type, or a user-assigned group name for a device on which the copydsn1 data set resides.

This is an input parameter of type CHAR(8) in EBCDIC.

copyspace1
Specifies the number of cylinders to use as the primary space allocation for the copydsn1 data set. The secondary space allocation is 10% of the primary space allocation.

This is an input parameter of type SMALLINT.

copydsn2
Specifies the name of the cataloged data set that is used as a target (output) data set for the backup copy. It is optional for COPY, COPYTOCOPY, MERGECOPY, LOAD, and REORG TABLESPACE. If you specify copydsn2, the data set is allocated to the SYSCOPY2 DD name.

This is an input parameter of type VARCHAR(54) in EBCDIC.

If you specify the COPYDDN parameter for COPY, COPYTOCOPY, MERGECOPY, LOAD, or REORG TABLESPACE, the specified ddname2 value must be SYSCOPY2.

copydevt2
Specifies a unit address, a generic device type, or a user-assigned group name for a device on which the copydsn2 data set resides.

This is an input parameter of type CHAR(8) in EBCDIC.

copyspace2
Specifies the number of cylinders to use as the primary space allocation for the copydsn2 data set. The secondary space allocation is 10% of the primary space allocation.

This is an input parameter of type SMALLINT.

rcpydsn1
Specifies the name of the cataloged data set that is required as a target (output) data set for the remote site primary copy. It is optional for COPY, COPYTOCOPY, LOAD, and REORG TABLESPACE. If you specifyrcpydsn1, the data set is allocated to the SYSRCPY1 DD name.

This is an input parameter of type VARCHAR(54) in EBCDIC.

If you specified the RECOVERYDDN parameter for COPY, COPYTOCOPY, MERGECOPY, LOAD, or REORG TABLESPACE, the specified ddname1 value must be SYSRCPY1.

rcpydevt1
Specifies a unit address, a generic device type, or a user-assigned group name for a device on which the rcpydsn1 data set resides.

This is an input parameter of type CHAR(8) in EBCDIC.

rcpyspace1
Specifies the number of cylinders to use as the primary space allocation for the rcpydsn1 data set. The secondary space allocation is 10% of the primary space allocation.

This is an input parameter of type SMALLINT.

rcpydsn2
Specifies the name of the cataloged data set that is required as a target (output) data set for the remote site backup copy. It is optional for COPY, COPYTOCOPY, LOAD, and REORG TABLESPACE. If you specify rcpydsn2, the data set is allocated to the SYSRCPY2 DD name.

This is an input parameter of type VARCHAR(54) in EBCDIC.

If you specify the RECOVERYDDN parameter for COPY, COPYTOCOPY, MERGECOPY, LOAD, or REORG TABLESPACE, the specified ddname2 value must be SYSRCPY2.

rcpydevt2
Specifies a unit address, a generic device type, or a user-assigned group name for a device on which the rcpydsn2 data set resides.

This is an input parameter of type CHAR(8) in EBCDIC.

rcpyspace2
Specifies the number of cylinders to use as the primary space allocation for the rcpydsn2 data set. The secondary space allocation is 10% of the primary space allocation

This is an input parameter of type SMALLINT.

workdsn1
Specifies the name of the cataloged data set that is required as a work data set for sort input and output. It is required for CHECK DATA, CHECK INDEX and REORG INDEX. It is also required for LOAD and REORG TABLESPACE unless you also specify the SORTKEYS keyword. It is optional for REBUILD INDEX. If you specify workdsn1, the data set is allocated to the SYSUT1 DD name.

This is an input parameter of type VARCHAR(54) in EBCDIC.

If you specify the WORKDDN parameter for CHECK DATA, CHECK INDEX, LOAD, REORG INDEX, REORG TABLESPACE, or REBUILD INDEX, the specified ddname value must be SYSUT1.

workdevt1
Specifies a unit address, a generic device type, or a user-assigned group name for a device on which the workdsn1 data set resides.

This is an input parameter of type CHAR(8) in EBCDIC.

workspace1
Specifies the number of cylinders to use as the primary space allocation for the workdsn1 data set. The secondary space allocation is 10% of the primary space allocation.

This is an input parameter of type SMALLINT.

workdsn2
Specifies the name of the cataloged data set that is required as a work data set for sort input and output. It is required for CHECK DATA. It is also required if you use REORG INDEX to reorganize non-unique type 1 indexes. It is required for LOAD or REORG TABLESPACE unless you also specify the SORTKEYS keyword. If you specify workdsn2, the data set is allocated to the SORTOUT DD name.

This is an input parameter of type VARCHAR(54) in EBCDIC.

If you specify the WORKDDN parameter for CHECK DATA, LOAD, REORG INDEX, or REORG TABLESPACE, the specified ddname value must be SORTOUT.

workdevt2
Specifies a unit address, a generic device type, or a user-assigned group name for a device on which the workdsn2 data set resides.

This is an input parameter of type CHAR(8) in EBCDIC.

workspace2
Specifies the number of cylinders to use as the primary space allocation for the workdsn2 data set. The secondary space allocation is 10% of the primary space allocation.

This is an input parameter of type SMALLINT.

mapdsn
Specifies the name of the cataloged data set that is required as a work data set for error processing during LOAD with ENFORCE CONSTRAINTS. It is optional for LOAD. If you specify mapdsn, the data set is allocated to the SYSMAP DD name.

This is an input parameter of type VARCHAR(54) in EBCDIC.

If you specify the MAPDDN parameter for LOAD, the specified ddname value must be SYSMAP.

mapdevt
Specifies a unit address, a generic device type, or a user-assigned group name for a device on which the mapdsn data set resides.

This is an input parameter of type CHAR(8).

mapspace
Specifies the number of cylinders to use as the primary space allocation for the mapdsn data set. The secondary space allocation is 10% of the primary space allocation.

This is an input parameter of type SMALLINT.

errdsn
Specifies the name of the cataloged data set that is required as a work data set for error processing. It is required for CHECK DATA, and it is optional for LOAD. If you specify errdsn, the data set is allocated to the SYSERR DD name.

This is an input parameter of type VARCHAR(54) in EBCDIC.

If you specify the ERRDDN parameter for CHECK DATA or LOAD, the specified ddname value must be SYSERR.

errdevt
Specifies a unit address, a generic device type, or a user-assigned group name for a device on which the errdsn data set resides.

This is an input parameter of type CHAR(8) in EBCDIC.

errspace
Specifies the number of cylinders to use as the primary space allocation for the errdsn data set. The secondary space allocation is 10% of the primary space allocation.

This is an input parameter of type SMALLINT.

filtrdsn
Specifies the name of the cataloged data set that is required as a work data set for error processing. It is optional for COPY CONCURRENT. If you specify filtrdsn, the data set is allocated to the FILTER DD name.

This is an input parameter of type VARCHAR(54) in EBCDIC.

If you specify the FILTERDDN parameter for COPY, the specified ddname value must be FILTER.

filtrdevt
Specifies a unit address, a generic device type, or a user-assigned group name for a device on which the filtrdsn data set resides.

This is an input parameter of type CHAR(8) in EBCDIC.

filtrspace
Specifies the number of cylinders to use as the primary space allocation for the filtrdsn data set. The secondary space allocation is 10% of the primary space allocation.

This is an input parameter of type SMALLINT.

Modifying the WLM-established address space for DSNUTILS

Add DSSPRINT, SYSIN, and SYSPRINT to the JCL procedure for starting the WLM-established address space in which DSNUTILS runs.

Requirement: You must allocate SYSIN and SYSPRINT in the procedure to temporarily store utility input statements and utility output messages. If you plan to invoke RUNSTATS and collect distribution statistics, you also need to allocate RNPRIN01.

Use JCL similar to the following sample PROC:

//*************************************************************
//*    JCL FOR RUNNING THE WLM-ESTABLISHED STORED PROCEDURES
//*    ADDRESS SPACE
//*       RGN     -- THE MVS REGION SIZE FOR THE ADDRESS SPACE.
//*       DB2SSN  -- THE DB2 SUBSYSTEM NAME.
//*       APPLENV -- THE MVS WLM APPLICATION ENVIRONMENT
//*                  SUPPORTED BY THIS JCL PROCEDURE.
//*
//*    IMPORTANT: You must use the value 1 in this EXEC card:
//*       IEFPROC EXEC PGM=DSNX9WLM,REGION=&RGN,TIME=NOLIMIT,
//*       PARM='&DB2SSN,1,&APPLENV'
//*
//*************************************************************
//DSNWLM   PROC RGN=0K,APPLENV=WLMENV1,DB2SSN=DSN
//IEFPROC EXEC PGM=DSNX9WLM,REGION=&RGN,TIME=NOLIMIT,
//        PARM='&DB2SSN,1,&APPLENV'
//STEPLIB  DD  DISP=SHR,DSN=CEE.V!R!M!.SCEERUN
//         DD  DISP=SHR,DSN=DSN!!0.SDSNLOAD
//UTPRINT  DD  SYSOUT=*
//RNPRIN01 DD SYSOUT=*
//DSSPRINT DD  SYSOUT=*
//SYSIN    DD  UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND)
//SYSPRINT DD  UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND)

Sample program for calling DSNUTILS

Three example programs calling DSNUTILS are shipped in SDSNSAMP.

  • DSNTEJ6U: A DSNUTILS caller that uses PL/I. Job DSNTEJ6U compiles, link-edits, binds, and runs sample PL/I program DSN8EPU, which invokes the DSNUTILS stored procedure to execute an utility.
  • DSNTEJ6V: A DSNUTILS caller that uses C++. Job DSNTEJ6V compiles, link-edits, binds, and runs sample C++ program DSN8EE1, which invokes the DSNUTILS stored procedure to execute an utility.
  • DSNTEJ80: A DSNUTILS caller that uses C and ODBC. You can use this sample to compile, pre-link, link-edit, and execute the sample application DSN8OIVP, which you can use to verify that your DB2 ODBC installation is correct.

DSNUTILS output

DB2 creates the result set according to the DECLARE statement that is shown under Example of declaring a cursor to select from SYSPRINT.

Output from a successful execution of the DSNTEJ6U sample job or an equivalent job lists the specified parameters followed by the messages that are generated by the DB2 DIAGNOSE DISPLAY MEPL utility.

If DSNUTILB abends, the abend codes are returned as DSNUTILS return codes.