TPIMP (Import template from XML)

Purpose
Import one or more templates from an XML format.
Usage notes
The executed program to import an IMS template, view, or criteria set must be FMNIMS. The executed program to import a Db2® template must be FMNDB2. For Db2® templates you must specify the SSID on the execute PARM, and the Db2® object referred to in the XML <db2object> element must exist in the Db2® subsystem for the import to be successful.
Related functions
TPEXP
Template export
Figure 1. Syntax

1  TPIMP
1! INPUT=DDIN
1 INPUT=ddname
1 DSNIN=dsname
1 ? MEMSTART=startstring? MEMEND=endstring
1 MEMBER=member_in
3? XMEMBERS=(+ ,xmem_filter)
3?  MEMLIST=( + , member_n? (membero_n) )
1! OUTPUT=DDOUT
1 OUTPUT=ddname
1  DSNOUT=dsname? (member_out)
4?  MEMOUT=memmask
1! REPLACE=NO
1 REPLACE=YES
INPUT=ddname
This points to the input DD name which can have one or more associated data sets that must be valid XML template data sets. If you do not specify INPUT or DSN parameters, then the DD DDIN is used as a default DD name for the input data sets. You can specify concatenated data sets.
DSNIN=dsname
Data set name where templates reside.
MEMBER=member_in
The name of a single member in a PDS, or a member name pattern representing one or more members in a PDS to be processed. A member name pattern can consist of any characters that are valid in a member name and two special pattern characters: the asterisk (*) and the percent symbol (%).
*
represents any number of characters. As many asterisks as required can appear anywhere in a member name pattern. For example, if you enter a member name pattern of *d*, all members in the PDS whose name contains "d" are processed.
%
is a place holding character that means a single character. As many percent symbols as necessary can appear anywhere in a member name pattern. For example, if you enter a member name pattern of %%%%, all members in the PDS whose name is four characters in length are processed. member_in is ignored if the data set is not a PDS.
MEMSTART=startstring
Is used to specify the start of a range of member names to be included. If MEMSTART is specified but MEMEND is omitted, all members of the PDS(E) from the startstring value onwards are included. startstring can have the same values, including wild cards, as for the member-in parameter of the MEMBER keyword.
MEMEND=endstring
Is used to specify the end of a range of member names to be included. If MEMEND is specified but MEMSTART is omitted, all members of the PDS(E) up to the endstring value onwards are included. endstring can have the same values, including wild cards, as for the member_in parameter of the MEMBER keyword.
XMEMBERS
Provides a way to exclude from processing library members that would otherwise be selected using the MEMSTART, MEMEND, and MEMBER options.
xmem_filter
A member name filter identifying one or more members that are to be excluded from processing. A filter can be a member name pattern representing multiple members.

To specify a member name filter containing lowercase characters, use a character string in the format c'string'. Filter values can also be specified as hexadecimal strings in the format x'hex-digits'.

FILTER
Allows you to specify a list of member names or patterns used to filter so that only templates referencing those copybooks, or copybooks that match the patterns for base and IMS templates built using copybooks. For IMS views and criteria sets the filter is taken to represent an originating template name. Any other type of template is skipped if a filter is specified.
MEMLIST
Allows you to specify a list of member names with optional associated output template names. If you do not specify the output member name File Manager uses the input name or the name as identified by the MEMOUT mask, memmask.
member_n
The name of the member to be processed. Generic name masks are allowed.
membero_n
Imported member name If unspecified, the imported member is not renamed.
OUTPUT=ddname
Identifies the DD card which points to the import template data set in which the imported template is/are stored or replaced. It must refer to a PDS, PDSE, or sequential data set.
DSNOUT=dsname
Defines the data set name where imported templates are created/updated. It must be a PDS, PDSE, or sequential data set. You can further describe this data set, as follows: (member-out) Where DSNOUT=dsname specifies a PDS and you want to send the output to a specific member within this data set, this defines the output member name.
MEMOUT=memmask
Where a number of input members have been specified, you can specify a member name pattern for the imported templates, allowing you to rename your templates as they are created. The member name pattern can consist of any characters that are valid in a member name and two special pattern characters: the asterisk (*) and percent sign (%).
Asterisk (*)
The asterisk is a place-holding character that means multiple characters with no change. Only one asterisk should appear in the mask. Any subsequent asterisk characters are treated as percent signs. For example, if you enter ABC* the renamed members all begin with ABC followed by the remainder of the old member name.
Percent sign (%)
The percent sign is a place-holding character that means a single character with no change. As many percent symbols as necessary may appear anywhere in a member name. For example, if you enter %%%A* the first three characters of the renamed members remain unchanged, the fourth character is replaced with the letter A and the remainder of the old member name remains unchanged.
REPLACE
Specifies whether or not File Manager replaces like-named templates in an output partitioned data set.
NO
Like-named templates are updated with the XML definitions.
YES
Like-named templates in the output partitioned data set are replaced.

Example 1. Base import of all template with member names beginning with a and renaming the output member names to all begin with Z.

//FMBAT EXEC PGM=FILEMGR
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
$$FILEM TPIMP DSNIN=FMN.XML.EXAMPLE,
$$FILEM MEMBER=A*,
$$FILEM MEMOUT=X*,
$$FILEM DSNOUT=FMN.IMP.EXAMPLE,
$$FILEM REPLACE=YES

It produces this report:

          Template Import Report
Template      New name   Type       Status
------------------------------------------------------------------
ABEND         XBEND      BASE       Import replaced
AODAO140      XODAO140   DYNAMIC    Import replaced
ASMTEST       XSMTEST    BASE       Import replaced
FMNBA635 3 members read 0 Imported 3 Import replaced  0 Errors

Example 2. Import an IMS template, criteria set and a view specifying member names

//FMBAT EXEC PGM=FMNIMS
//SYSPRINT DD SYSOUT=*
//FMNIMSIN DD *
$$FILEM SET HEADERPG=YES,PAGESIZE=60
$$FILEM TPIMP DSNIN=FMN.XML.EXAMPLE,
$$FILEM MEMLIST=(DJ1E,
$$FILEM          DJ1ECR2,
$$FILEM          DJ1EVW),
$$FILEM DSNOUT=FMN.IMP.EXAMPLE,
$$FILEM REPLACE=YES

It produces this report:

          Template Import Report
Template      New name   Type       Status
--------------------------------------------------------------
DJ1E                     IMS        Import replaced
DJ1ECR2                  IMS CRIT   Imported
DJ1EVW                   IMS VIEW   Imported
FMNBA635 3 members read 2 Imported 1 Import replaced  0 Errors
Table 1. Import status and action
Status Explanation Action
Imported Template successfully imported from XML format. None
Import replaced Template successfully imported from XML format and existing member replaced None
Import updated Template successfully imported from XML format and existing member updated. None.
Not found The input member name could not be found on the input template data set. Correct the member name or data set name and rerun the job.
Unexpected error There should be previous error messages describing the error that occurred. These are normally errors in the XML definitions. The error messages should indicate the failing line and reasons. Correct the XML and rerun the job. (See XML definitions for a template.