SCHANGE (Macro)

Read syntax diagramSkip visual syntax diagram SCHANGE 6keynumber

Purpose

Use the SCHANGE (selective change) macro to locate every occurrence of a string and to change that string only when you choose.

The SCHANGE macro can be used when it has been assigned to a PF key (with the SET PFn subcommand). You can also type a CLOCATE or CHANGE subcommand on the command line before pressing the PF key assigned to the macro SCHANGE. By default, the SCHANGE macro automatically repeats the CLOCATE or CHANGE subcommand saved in the LASTLORC buffer (see SET CURLINE).

If used with CLOCATE, only one PF key is needed. If used with CHANGE, two PF keys are required: one to locate the string; the other to perform the change.

Each time you press the PF key assigned to SCHANGE (with the SET PFn subcommand), the cursor is placed under the next occurrence of the string specified in the CHANGE or CLOCATE subcommand. The search for the string starts with the current column in the current line and continues throughout the file.

If you have typed a CHANGE /string1/string2/ subcommand in the command line, pressing the second PF key changes string1 to string2. (This second PF key has no effect when the CLOCATE subcommand is used.)

For an example of how to use the SCHANGE macro when it has been assigned to a PF key, see z/VM: XEDIT User's Guide.

Operands

keynumber
is the PF key number that causes the CHANGE to be executed, after the string has been located by pressing the PF key assigned to SCHANGE. SET PF5 SCHANGE 6 is the default the editor assigns, but any number can be used.

Usage Notes

  1. Pressing the PF key assigned to SCHANGE causes the cursor to move but does not cause the line pointer to move (unless the screen is scrolled forward). The column pointer moves to the column where the specified string begins.
  2. The screen scrolls forward automatically after all occurrences of the string have been located on the current screen.

    The screen does not scroll forward if the string does not appear in the rest of the file.

  3. Pressing the PF key assigned to SCHANGE places the cursor under the first character of the string.

    Pressing the second PF key replaces string1 with string2.

  4. The advantage of using SCHANGE with CLOCATE (rather than CLOCATE and =) is the cursor is placed under the matching string.
  5. SCHANGE does not change a string located to the left or right of the screen. In order for SCHANGE to locate all string targets, you must change SET VERIFY to 1 and *.
  6. SCHANGE can be assigned to a PA key instead of a PF key; however, the key number specified on the SCHANGE subcommand must be that of a PF key.
  7. When AUTOSAVE is set ON, the file is not autosaved until SCHANGE completes execution. Entering a subcommand other than the two PF keys assigned to SCHANGE and CHANGE completes execution of the SCHANGE macro.
  8. When using SCHANGE with the CHANGE subcommand, the delimiters *, -, +, :, ¬, and the digits 0 through 9 are not valid. Use another character as the delimiter for the CHANGE subcommand.

Examples

For more information, see z/VM: XEDIT User's Guide.

Responses

Each time a string is located, the cursor is placed under the first character of the string, and the line containing the string is highlighted.

If a CLOCATE subcommand is typed in the command line or saved in the LASTLORC buffer and you press the first PF key, the following message is displayed when a string is located:
Target string1 found
If a CHANGE subcommand is typed in the command line or saved in the LASTLORC buffer and you press the first PF key, the following message is displayed when a string is located:
String string1 found; --- PFnn set for selective CHANGE
When you press the second PF key, the following message is displayed:
String string1 changed to string2
If you press the PF key assigned to SCHANGE without first typing a CHANGE or CLOCATE in the command line, and the LASTLORC buffer does not contain a CHANGE or CLOCATE subcommand, the following message is displayed:
No CHANGE or CLOCATE subcommand specified

Messages and Return Codes

520E
Invalid operand: operand [RC=5]
525E
Invalid {PFkey|PFkey/PAkey} number [RC=5]
529E
Subcommand is only valid in {display|editing} mode [RC=3]
545E
Missing operand(s) [RC=5]
561E
Cursor is not on a valid data field [RC=1 or 3]
569E
No CHANGE or CLOCATE subcommand specified [RC=5]
574E
CHANGE not valid {with CLOCATE|after cursor movement}
586E
Not found [RC=2]

where return codes are:

0
Normal
2
Not found
3
Invalid placement of cursor, or subcommand is valid only for display terminal
5
Invalid or missing operand(s)
6
Subcommand rejected in the profile due to LOAD error, or QUIT subcommand has been issued in a macro caller from the last file in the ring