Substring notation support in TEMPLATE is introduced with APAR PQ54608
The TEMPLATE utility control statement lets you allocate data sets, without using JCL DD cards, during the processing of LISTDEF list. The TEMPLATE control statement defines the data set naming convention and it can optionally contain allocation parameters that define data set size, location, and attributes. Variables are supported that allow data sets to be built dynamically. DB2 does not check to ensure that they are unique until execution of the utility. Therefore, care must be exercised when constructing data set names to ensure uniqueness. Normal OS/390 data set naming conventions apply. More specifically, all qualifiers must begin with an alphabetical character and the length cannot exceed 44 characters. The use of Templates allows for the standardization of data set names across the DB2 subsystem, and allows easy identification of the data set type created, if the relevant variables are used in construction of the name, for example, &IC. for image copy.
By using the full variables it is quite common to incur in the 44 characters data set name MVS limitation.
In order to help the users with their own naming standards and the length limitation, PTF UQ62776 for APAR PQ54608 was introduced for DB2 for z/OS and OS/390 Version 7. This PTF implements the use of substring notation for the data set name. If you use this notation, the entire DSN operand must be enclosed in single quotes.
To specify a substring, use the form &variable(start). or &variable(start,length), where:
Specifies the substring’s starting byte location within the current variable base value at the time of execution. start must be an integer from 1 to 128.
Specifies the length of the substring.
If you specify start, but do not specify length, length defaults to the number of characters from the character specified by start to the last character of the variable value at the time of execution. length must be an integer that does not cause the substring to extend beyond the end of the base value.
&SSID(2,3). would return the variable &SSID. value starting with character 2 for a length of 3 characters.
&PART(2). would return the variable &PART. value starting with character 2 for the remainder of the variable value.
A most common use of substring is for &PART. since five digits are seldom necessary. Also notice that it is not possible to substring a member name because variables inside the parentheses, substringed or not, are not supported.
The DB2 UDB for z/OS and OS/390 Version 7 Utility Guide and Reference, SC26-9945-03 provides guidance on the use of TEMPLATE, but it does not yet reflect the substring enhancement. Refer to the APAR text for details.
A simple example of an Image Copy job using substring notation is:
//J0000004 JOB (UTILITY,'DATGIO I.B.M.*'),'IMAGE COPY DB497_06 ',
//* IMAGE COPY UTILITY
//ICOPY EXEC DB2UTIL,SYSTEM=DB22,UID=J0000004
//DSNUPROC.SYSIN DD *
TEMPLATE COPYDDN1 UNIT(RCART) STACK(YES)
TEMPLATE COPYDDN2 UNIT(RCARTDM) STACK(YES)
INCLUDE TABLESPACE DB497406.TSBRIM
INCLUDE TABLESPACE DB497506.TSBRIM
INCLUDE TABLESPACE DB497606.TSBRIM
INCLUDE TABLESPACE DB497706.TSBRIM
INCLUDE TABLESPACE DB497806.TSBRIM
COPY LIST J0000004 COPYDDN(COPYDDN1,COPYDDN2)
This material has not been submitted to any formal IBM test and is published AS IS. It has not been the subject of rigorous review. IBM assumes no responsibility for its accuracy or completeness. The use of this information or the implementation of any of these techniques is a client responsibility and depends upon the client's ability to evaluate and integrate them into the client's operational environment.