HP 3000 Manuals

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


HP RPG/XL Utilities-Part 2 RISE

KEEP 

KEEP saves the contents of the work file in a permanent file.

Form 

     K[EEP] [filename] [N[OW]] [U[NN]]

Parameter Explanation 

filename         Name of the permanent file where you wish to copy the
                 work file.

N[OW]            Execute the command immediately, disabling safety
                 prompts and overwriting an old permanent file with the
                 same name if it exists.  (Note:  "filename" cannot be
                 "N", "NO", "NOW", "U", "UN", or "UNN".  These letters
                 are reserved for literal parameters in the command.)

U[NN]            KEEP the file unnumbered (without the appended sequence
                 numbers).  If you omit "UNN", the sequence numbers will
                 be stored in columns 81-88 of the permanent file.

Purpose 

The KEEP command saves the contents of the work file in a permanent file
designated "filename".  If "filename" is omitted, the file will be kept
under the current work file name which was designated previously with the
TEXT command.  If "filename" does not exist, RISE will create that file.

If "filename" exists, RISE will not immediately overwrite the existing
file unless you use the NOW parameter.  Instead, it will return a message
informing you that "filename" already exists, and asking if you wish to
overwrite the existing permanent file.  You respond with "Y" to replace
"N[O]" to cancel the KEEP command.

The "NOW" option ensures that the overwriting will take place
immediately.  It also disables the safety prompts.  It saves time but it
should only be used when you are certain that the work file should
replace the permanent file.  There is no provision for reconsidering
changes once NOW is used.  When you omit NOW, and respond to the message
informing you that the "filename" exists and asking if you wish to
overwrite the existing copy, you do have an opportunity to reconsider the
replacement.  However, there is a slight delay involved.

Related Commands 

A file which you KEEP may be copied back to the work file using the TEXT
command so that you can edit or add to it.  To TEXT and KEEP a large RPG
source file each time you have changes to make can entail long delays.
You will save time by editing a long file directly using the FILE/EXIT
commands.  See the discussion of FILE for advantages and disadvantages of
using the FILE/EXIT commands.

Execution mode:  Line or Block

Examples 

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

K FILE1 N        Copy the file named FILE1 into a permanent file.  If
                 FILE1 exists, overwrite the old copy with the contents
                 of the current work file without displaying safety
                 prompts.

K NEWFILE        Copy the file named NEWFILE into a permanent file.

K N U            Copy the current work file into a permanent file
                 immediately without appended sequence numbers.

In the first example, SIMCAL is copied into the work file with the TEXT
command.  It is then copied to a permanent file called BACKUP using the
KEEP command, and the execution messages are displayed (1).  When lines 1
through 5 of the work file are deleted, and an attempt to KEEP BACKUP
UNNumbered is entered, safety prompts appear (2), giving the user a
chance to reconsider the effects of overwriting the original copy of
BACKUP with the edited copy now in the work file.  When the prompt is
answered in the affirmative, the KEEP command is executed (3).

Line 38 is then modified, and KEEP BACKUP is entered with the NOW and UNN
parameters (4).  NOW disables the safety prompts, and the command is
executed immediately (5).

          >T SIMCAL
           Text  completed.
          >KEEP BACKUP
           Keep  completed.
     (1)   File name is BACKUP
          >
          >DELETE1/5
              1       00011 H
              SIMCAL
              2       00012FINPUT    IP  F       72               DISK
              3       00013FOUTPUT   O   F       72               DISK
              4       00014IINPUT    AA  01   1  CA
              5       00015I        OR   02   1  CS
           Delete  completed.

     (2)  >KEEP BACKUP UNN
           File  exist already, purge old BACKUP?YES
           Keep  completed.

     (3)   File  name is BACKUP
          >
          >MODIFY LAST
             38     00048O*END OF PROGRAM
                   :                      RNAMED SIMCAL
             38     00048O*END OF PROGRAM NAMED SIMCAL
                   :

     (4)  >KEEP BACKUP NOW UNN
           Keep completed.

     (5)  >File name is BACKUP
          >

In the second example, a file named TESTFILE is copied into the work
file, TESTFILE was previously stored as a permanent file with the
UNNumbered parameter.  Because sequence numbers are essential as
references in editing, they are appended automatically for the user's
convenience (1).  The CHANGE command is used on TESTFILE, and an
execution message informs the user that all the changes have been made
(2).

Entering EXIT causes safety prompts to appear because, if the EXIT is
executed without a preceding KEEP command, the changes made to the work
file would not be saved.  When the prompts are answered negatively, the
command is cancelled (3).  KEEP is then tried, and the safety prompts
displayed (4).  This time the user indicates that the permanent copy of
TESTFILE should be overwritten by the edited work file.  The user enters
the EXIT command, and this time it is safe to exit since the changes were
kept in a permanent file first (5).

          >
          >TEXT TESTFILE
     (1)   File is unnumbered, appending sequence numbers.
           Text completed.
          >CHANGE ;RESULT; TO ;OUTPUT; IN ALL
              6     00021O   01      OPRND1    ADD  OPRND2    OUTPUT 104
              7     00022O   02      OPRND1    SUB  OPRND2    OUTPUT
              8     00023O   03      OPRND1    MULT OPRND2    OUTPUT
              9     00024O   04N99   OPRND1    DIV  OPRND2    OUTPUT   H
             10     00025O   04 99             Z-ADD0         OUTPUT
             23     00038O                           OUTPUT    60 "    .0 .        -"

     (2)   Changes completed.
          >EXIT
           KEEP not done. CLEAR current work file?NO

     (3)   Exit cancelled.
          >KEEP
           File exist already, purge old TESTFILE?YES

     (4)   Keep completed.
           File name is TESTFILE

     (5)  >EXIT



MPE/iX 5.0 Documentation