Replacing a member or data set using data from an edit session

The REPLACE primary command (or its abbreviation, REPL) creates, if it does not already exist, a new member of a partitioned data set (PDS or PDSE) or a new sequential, VSAM, or z/FS data set from one or more lines of the data in the current editor session. If the specified member or data set already exists, it is overwritten. (To display a warning panel that prompts you when you attempt to replace an existing member or data set, use the CREATE primary command. See Creating a new member or data set using data from an edit session.)

To specify the lines to be put into the new member or data set, use one of these:
  • C or CC prefix commands (to copy lines)
  • M or MM prefix commands (to copy lines, then delete them)
  • A label range. (You must specify the "from" and "to" labels on the REPLACE command.)
Note that the lines that are copied or moved to the specified data set or member are only those lines which are not grouped. This means that lines in any of these groups are not copied (or moved):
  • Excluded groups.
  • Suppressed groups (groups of other record types when using a template).
  • Not-selected groups (groups of not-selected records when using a template).
This allows for a wide variety of control over what you create in the target member or data set, matching the current SHOW settings in the editor session.

If you specify the member name or data set name as part of the REPLACE primary command, and the move or copy line commands (or range operand) are entered, the new member or data set is created immediately from the data in the current editor session. The allocation attributes for a data set created in this way are taken from the data set in the current editor session.

When the current editor session is using a PDS, you can enter the member name with or without parentheses which is taken to mean a member within the same PDS.

You can specify a partially-qualified or fully-qualified data set name as part of the command.

Examples:
REPLACE MEMNAM
Replaces or creates the new member MEMNAM.
REPLACE (MEMNAM)
Replaces or creates the new member, MEMNAM.
REPLACE datasetname(MEMB1)
Replaces or creates member, MEMB1.
REPLACE 'userid.datasetname(MEMB2)'
Replaces or creates member, MEMB2.
REPLACE 'userid.datasetname'
Replaces or creates data set userid.datasetname, based on the current data set attributes.

If you enter the REPLACE command without a member name or data set name, or you enter the extended version of this command, REPLACEX (or its abbreviation, REPLX), File Manager displays an extended replace panel allowing you to enter the name of a target data set and, optionally, member. This panel also allows you to decide what data set to use as a model, or, if you want, to manually enter allocation attributes for the target data set. Otherwise, the default data set attributes are taken from the data set on which the editor session is currently operating.

Examples:
REPL .STRT .END
Displays an extended replace panel where you can enter the data set name and, optionally, the member name.
REPLX 'userid.dataset'
Displays an extended replace panel where you can enter the data set name and, optionally, the member name.

The Pack option on the extended replace panel allows you to choose whether the data being created is stored in ISPF packed or standard format. The displayed default reflects the current pack mode of the data being edited or viewed.

After the replace processing is completed, File Manager returns you to the existing editor session.

Note:
  1. In a CICS® environment, CICS® resources are not available as a target for this command. Also, MQ resources are not available as a target for this command.
  2. If the target file for a replace is a KSDS VSAM, the occurrence of duplicate keys causes an informational message to be displayed, but processing of the command continues.

Related topics