REPLACE—Replace Data

The REPLACE primary command replaces a sequential data set, member of a partitioned data set, or z/OS® UNIX file with data you are editing. If a member or z/OS UNIX file you want to replace does not exist, the editor creates it. If a member you want to replace exists and the member is in a PDSE version 2 data set that is configured for member generations, the editor creates a new generation of the member. This new generation becomes the current generation (also known as generation zero). The editor cannot create a new sequential data set.

If no options are specified with the REPLACE command, the Edit/View Replace panel is displayed.

Syntax

Read syntax diagramSkip visual syntax diagramREPLACEREPLREPreplace_options
replace_options
Read syntax diagramSkip visual syntax diagrammember( member)dsname( member)dsnamepathnamelabelalabelb1ASCIIEBCDICUTF8
Notes:
  • 1 If you don't specify the group of lines using labels, you must specify the group by using C or M line commands.
member
The name of the member to be replaced in the partitioned data set currently being edited. If a name of eight characters or fewer is specified and it could be a member name or a data set name, REPLACE searches for a member name first. If no member is found, then the name is used as a data set name. If the member does not exist, the editor creates it. If you are using a concatenated sequence of libraries, the editor writes the member to the first library in the sequence. This operand is optional.

To replace a sequential data set or a member of a different partitioned data set, enter REPLACE without a member operand. The editor displays the Edit Replace panel, from which you can enter the data set name.

dsname
A partially qualified or fully qualified sequential data set you want to replace.
pathname
The pathname for a z/OS UNIX regular file to be replaced. If the file does not exist, it is created. (Also, see Specifying z/OS UNIX pathnames with edit primary and macro commands.)
dsname(member)
A partially qualified or fully qualified partitioned data set and member you want to replace.
labela, labelb
Labels identifying the start and end of the group of lines to replace the member or data set.

For more information about using labels to identify a group of lines, see Labels and line ranges.

ASCII, EBCDIC, UTF8
When one of these keywords is supplied, if the data is using a different character set to that designated by the keyword, the data being replaced in the external file is converted to the character set designated by the keyword.

Description

To replace a member of a partitioned data set, a sequential data set, or a z/OS UNIX file:

  1. On the command line, type one of these commands:
    REPLACE member labela labelb
    REPLACE (member) labela labelb
    REPLACE dsname labela labelb
    REPLACE dsname(member) labela labelb
    REPLACE pathname labela labelb

    The member operand is optional unless you specify the name of a partitioned data set. It represents the name of the member that you want to replace. If you specify a data set name only, it must be a sequential data set.

    The labela and labelb operands are optional, also. They represent a pair of labels that show the first and last lines in a group of lines used to replace the member.

    If you omit the labela and labelb operands, you must specify the lines by using either the C (copy) or M (move) line command. See the descriptions of these commands if you need more information about them.

    If you omit the labela and labelb operands, and do not enter one of the preceding line commands, a REPLACE Pending message is displayed in the upper-right corner of the panel.

  2. Press Enter. If you did not specify the name of a member, data set, or z/OS UNIX file, the Edit/View Replace panel is displayed. Enter the name of the member, data set, or z/OS UNIX file to be replaced on this panel and press Enter again. If you used either a pair of labels or a C line command, the data is copied from the member, data set, or z/OS UNIX file that you are editing into the member, data set, or z/OS UNIX file that you are replacing. If you used the M line command, however, the data is removed from the member, data set, or z/OS UNIX file that you are editing and placed in the member, data set, or z/OS UNIX file that you are replacing.

    If the data set specified does not exist, ISPF prompts you to see if the data set should be created. You can create the data set using the characteristics of the cataloged source data set as a model, or specify the characteristics for the new data set. You can suppress this function through the ISPF configuration table, causing any CREATE request for a nonexistent data set to fail.

See Creating and replacing data for more information about the REPLACE command.

Examples

These steps show how you can replace a member when you omit the member name. These same steps apply when you create data.

  1. Type REPLACE and specify which lines you want to copy or move into the data set or member. The example in Figure 1 uses the MM (block move) line command to move a block of lines from the data.
    Figure 1. Member before other member is replaced
       File  Edit  Edit_Settings  Menu  Utilities  Compilers  Test  Help
     ───────────────────────────────────────────────────────────────────────────────
     EDIT       USERSID.TEST(FROMDATA) - 01.02                  Columns 00001 00072
     Command ===> replace                                          Scroll ===> PAGE
     ****** ***************************** Top of Data ******************************
     ==MSG> -Warning- The UNDO command is not available until you change
     ==MSG>           your edit profile using the command RECOVERY ON.
     000100 This line will be left in this member
     000200 This line will be left in this member
     MM0300 +----------------+
     000400 | This is the    |
     000500 | material to    |
     000600 | be created in  |
     000700 | another member |
     MM0800 +----------------+
     000900 This line will be left in this member
     001000 This line will be left in this member
     ****** **************************** Bottom of Data ****************************
    
    
    
    
      F1=Help      F2=Split     F3=Exit      F5=Rfind     F6=Rchange   F7=Up
      F8=Down      F9=Swap     F10=Left     F11=Right    F12=Cancel
  2. When you press Enter, the Edit/View Replace panel (Figure 2) appears. Type the name of the member to be replaced and press Enter. A member is created when you type the name of a member that does not already exist. The name of the member replaced in this example is DELDATA.
    Figure 2. Edit/View Replace panel (ISRERPL1)
       Menu  RefList  Utilities  Help
     ──────────────────────────────────────────────────────────────────────────────
                                   Edit/View Replace
     Command ===>                                                                  
    
     "Current" Data Set: USERSID.TEST(FROMDATA)
    
     To ISPF Library:
        Project . . . PDFTDEV 
        Group . . . . USERSID  . . .          . . .          . . .         
        Type  . . . . MSGGEN  
        Member  . . .         
    
     To Other Sequential Data Set, Partitioned Data Set Member, or z/OS UNIX file:
        Name . . . . . TEST(DELDATA)                                              +
        Volume Serial . .           (If not cataloged)
    
     Data Set Password  . .           (If password protected)
    
     Enter "/" to select option              Data Conversion option                 
       Pack "Replace" Data Set                 1. EBCDIC                           
                                               2. ASCII                            
                                               3. UTF-8
    
     Press ENTER key to replace. Enter END command to cancel replace.
      F1=Help      F2=Split     F3=Exit      F7=Backward  F8=Forward   F9=Swap
     F10=Actions  F12=Cancel
  3. Figure 3 shows the lines remaining in the data being edited after the specified lines were moved.
    Figure 3. Member after the other member has been replaced
       File  Edit  Edit_Settings  Menu  Utilities  Compilers  Test  Help
     ───────────────────────────────────────────────────────────────────────────────
     EDIT       USERSID.TEST(FROMDATA) - 01.03               Member DELDATA created
     Command ===>                                                  Scroll ===> PAGE
     ****** ***************************** Top of Data ******************************
     ==MSG> -Warning- The UNDO command is not available until you change
     ==MSG>           your edit profile using the command RECOVERY ON.
     000100 This line will be left in this member
     000200 This line will be left in this member
     000900 This line will be left in this member
     001000 This line will be left in this member
     ****** **************************** Bottom of Data ****************************
    
    
    
    
    
    
    
    
    
    
      F1=Help      F2=Split     F3=Exit      F5=Rfind     F6=Rchange   F7=Up
      F8=Down      F9=Swap     F10=Left     F11=Right    F12=Cancel
  4. Figure 4 shows the contents of the replaced member.
    Figure 4. Other member replaced
       File  Edit  Edit_Settings  Menu  Utilities  Compilers  Test  Help
     ───────────────────────────────────────────────────────────────────────────────
     EDIT       USERSID.TEST(DELDATA) - 01.02                   Columns 00001 00072
     Command ===>                                                  Scroll ===> PAGE
     ****** ***************************** Top of Data ******************************
     ==MSG> -Warning- The UNDO command is not available until you change
     ==MSG>           your edit profile using the command RECOVERY ON.
     000300 +----------------+
     000400 | This is the    |
     000500 | material to    |
     000600 | be created in  |
     000700 | another member |
     000800 +----------------+
     ****** **************************** Bottom of Data ****************************
    
    
    
    
    
    
    
    
      F1=Help      F2=Split     F3=Exit      F5=Rfind     F6=Rchange   F7=Up
      F8=Down      F9=Swap     F10=Left     F11=Right    F12=Cancel