TPEXP (Export template to XML)

Purpose
Export one or more templates to an XML format.
Usage Notes
You can filter the templates selected for processing by providing a filter member names or member masks. This ensures for File Manager Base component or IMS templates built using copybooks that only templates that reference matching copybooks are selected for processing. For IMS views and criteria sets the filter is used to match the originating template name. Any other type of template is skipped if you provide a filter.
Related functions
TPIMP
Template import
Figure 1. Syntax

1  TPEXP
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) )
3?  FILTER=( + , member_n )
1! OUTPUT=DDOUT
1 OUTPUT=ddname
1  DSNOUT=dsname? (member_out)
4?  MEMOUT=memmask
1! REPLACE=NO
1 REPLACE=YES
1! COPYCRIT=NO
1 COPYCRIT=YES
1! STATS=NO
1 STATS=YES
INPUT=ddname
This points to the input DD name which can have one or more associated data sets that must be valid 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 XML 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
Exported member name If unspecified, the exported member is not renamed.
OUTPUT=ddname
Identifies the DD card which points to the import template data set in which the exported 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 exported templates are created/replaced. 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 exported 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 XML templates are not replaced.
YES
Like-named XML templates in the output partitioned data set are replaced.
COPYCRIT
Specifies whether or not to limit the output XML to copybook definitions and criteria. This option is ignored when processing dynamic template as <symbol> elements are required to import a dynamic template.
NO
All XML elements describing the template are produced.
YES
XML is limited to the elements required to create the template and criteria.
STATS
Specifies ISPF member statistics are to be either created or updated by the export process.
NO
Do not update or create ISPF statistics for the exported member(s).
YES
ISPF statistics are updated or created for the exported member(s).

Example: Base export of all templates with member names starting with D through to members starting with C. The exported members are renamed to start with X.

//FMBAT EXEC PGM=FILEMGR
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
$$FILEM TPEXP DSNIN=FMN.TEMPLATE.EXAMPLE,
$$FILEM MEMSTART=D*,
$$FILEM MEMEND=C*,
$$FILEM MEMOUT=X*,
$$FILEM DSNOUT=FMN.XML.TEMPLATE,
$$FILEM COPYCRIT=YES,
$$FILEM STATS=YES,
$$FILEM REPLACE=YES

It produces this report:

          Template Export Report
Template      New name   Type       Status
--------------------------------------------------------------
DJ1E          XJ1E       IMS        Exported
DJ1ECR2       XJ1ECR2    IMS CRIT   Exported
DJ1EVW        XJ1EVW     IMS VIEW   Exported
CTEMP1        XTEMP1     BASE       Exported
CTEMPDYN      XTEMPDYN   DYNAMIC    Exported
CTEMP3        XTEMP3     BASE       Exported
FMNBA631 6 members read 6 Exported 0 Export replaced  0 Errors
Table 1. Export status and action
Status Explanation Action
Exported Template successfully exported to XML format. None
Exported replaced Template successfully exported to XML format and existing member replaced None
Not replaced Output member exists and REPLACE=NO is specified. If you want to replace the member specify REPLACE=YES
Corrupt template The input template could not be loaded because it is corrupt. Recreate the input template and rerun the job.
Template allocate error The input template data set could not be allocated, possibly not found. Correct the input data set name and rerun the job.
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. Read and act on the preceding error messages.