HP 3000 Manuals

CHANGE [ HP RPG/XL Utilities-Part 2 RISE ] MPE/iX 5.0 Documentation


HP RPG/XL Utilities-Part 2 RISE

CHANGE 

CHANGE changes an "oldstring" to a "newstring".

Form 

     CH[ANGE] "oldstring" TO "newstring" [IN lb [/le]]

Parameter Explanation 

"oldstring"      The old string you are replacing.

"newstring"      The new string that is replacing the old.

IN               Indicates that a range of lines to be changed follows.

lb               First, or only, line number where change will be made.

le               Line where the change ends.

Purpose 

The CHANGE command replaces "oldstring" with "newstring".  If no line
range is specified, the changes will be made from the current position of
the record pointer to the end of file.

Special Considerations 

The number of characters in "oldstring" must be the same as that of
"newstring".  If there is any difference, the column position of
characters would be changed, possibly making the RPG source line
syntactically incorrect.

Delimiters 

You may use any special characters as delimiters except the slash (/).

Execution mode:  Line or Block.

Record pointer:  At last line changed.

Examples 

The following are legal abbreviations which may be used with the CHANGE
command and its parameters:

CH;OLD;TO $NEW$  Change oldstring TO newstring from first line to current
IN F/*           position of record pointer.

CHAN;OLD; TO;    Change oldstring to newstring in lines 1 through 10.
NEW;IN1/10

In the examples of the CHANGE command, a mistake is made in the spelling
of the command, and an error message is returned (1).

Next, there is an attempt to replace a three character string, ";PUT;"
with a four character string ";FILE;", and another error message is
generated (2).

When an additional space is added between the delimiters containing the
oldstring ";PUT ;" so that both strings are equal in length, the CHANGE
is executed (3).

         >LIST ALL
             1          H
             SIMCAL
             2          FINPUT   IP  F      72            DISK
             3          FOUTPUT  O   F      72            DISK
             4
             5          IINPUT   AA  01   1 CA
             6          I       OR   02   1 CS
             7          I       OR   03   1 CM
             8          I       OR   04   1 CD
             9          I       OR   05
            10          I                             8   72OPRND1
            11          I                             9  132OPRND2         99

            12
     (1) >CHANGE ;PUT; TO ;FILE; IN ALL
               ^
          Error 9: Syntax error on CHANGE command.

     (2) >CHANGG ;PUT; TO ;FILE; IN ALL
          Error 109: Oldstring length must equal newstring length.

     (3) >CHANGE ;PUT ; TO ;FILE; IN ALL
             2          FINFILE      IP  F      72            DISK
             3          FOUTFILE     O   F      72            DISK
             4          IINFILE      AA  01   1 CA



MPE/iX 5.0 Documentation