Keep Command [K]

Creates a standard disc file and writes the workfile into it, including any user labels copied by the Text command. Can also update or create a “member” in a COBOL Copylib. Keep is the reverse of Text, which copies a standard disc file into a workfile that you can edit. Use Text when you need to duplicate a file. You should not need Keep very often – especially if you retain your files in Qedit format. In that case you would use New or Open to start editing the Qedit workfile, and Shut to stop editing.

KEEP [filename][,options] [ rangelist ]

(Q=no linenums)

(Defaults: rangelist=ALL, filename=last)

Keep Options

Qedit allows several options on the Keep command. Note that the comma preceding the option name is mandatory, and that spaces are not allowed before the comma or the option name.

Keep filename,TEMP temporary instead of permanent file
Keep filename,UNN unnumbered (same as KQ)
Keep filename,YES go ahead and purge old file
Keep filename,NO never purge an old file
Keep filename,XEQ assign xeq access
Keep filename,NOLABELS discard user labels
Keep filename,RELEASED :Release security
Keep filename,IFDIRTY only if changes made

Keep creates a new disc file named filename. You can combine several options on the same Keep command. The default filename is the name and domain (temporary vs. permanent) of the last Text or full Keep (i.e., it does not count if you use a rangelist or have reduced the margins with Set Left or Set Right). If filename already exists, Qedit will ask you to verify that it is okay to purge it unless you specify the ,YES or ,NO option.

Usually the file will have sequence numbers in each line (this is called numbered), but you can omit the sequence numbers with KQ, or by specifying the ,UNN option.

Keep transfers rangelist lines from the workfile to filename. The default rangelist is ALL. Warning: Qedit writes only the data within the current left and right margins, so reset the margins first if you want the entire line (e.g., Set Left; Set Right).

To save the current workfile lines as a COBOL Copylib member, put the member name in parentheses, optionally followed by the file name (default is “copylib” for which you usually have a :File command). If the member already exists, you will be asked if you want to purge the old copy. If the member does not exist, it will be created.

Examples

  /text menu.schema     {make a copy of existing schema file}  QEDITSCR  /find "FUNCTION-CODE"     14           FUNCTION-CODE,     X8;  /change "X8"X10"     14           FUNCTION-CODE,     X10;  /keep menu.new        {create a new schema file}      ...               {do some more changes}  /keep                 {save again with same name...}  MENU.NEW.DEV,OLD 80B FA # of records = 127  Purge existing file [No]? yes   {you must authorize purge!}  /s left 1;s right 50  {define margins as first 50 columns}  /kq nov99.datafile    {unnumbered with 50-byte records}  /k notes,UNN,TEMP,YES {unnumbered, temporary, purge old file}  /keep ,yes            {keep to last text, purging old}  /file copylib=copylib.pub.develop  /text (custrec)  /visual  /keep                {updates member}  /keep (custrec2)     {creates new member}  /keepq (custrec) copylib2.test.develop  

Absolute File Name

If you are on a version of MPE/iX 5.0 which supports the Chdir command and the creation of new files in the POSIX namespace, you may find yourself doing the following: Text file xxx, Chdir to another directory to add from some other files, then Keep to update your original file. Keep defaults to the “absolute” name (e.g., xxx.src.util or /user/dev/lib/src/xxx). This means you can change to other directories after a Text, but still easily Keep the file back under its original name. In the past, Keep would default to the “relative” name of the Text file (e.g., xxx), saving the file in your current working directory.

Keep Only When Changes Were Made

Keep,Ifdirty only does the Keep operation if the workfile has been modified since the last Text or Keep. This can be useful in job streams that do Changes: by not Keeping files where no string changes occurred, you reduce the number of files that appear on the partial backup. To see whether your workfile is clean or dirty, do Verify Open.

Resetting File Commands

The Keep command pays attention to any :File commands that you have active. If you specify a file-close disposition like Temp or Save, and then try to text and keep the file with Qedit, the purge of the existing file cannot be carried out and Qedit will print an error message (Fclose Err: Duplicate). Qedit observes the :File equation even if you do not specify an asterisk before the file name. To avoid this confusion, :Reset the :File equation before texting or keeping the file.

  /purge sj  /file sj;rec=-80,16,f,ascii;disc=200;nocctl;save  /showjob *sj  /t sj  Qeditscr  27 lines in file  /k  SJ.JIM.TECHSUP,OLD 80B FA # of records=27  Purge existing file [no]? y  Existing file apparently purged,  but still cannot save new file.  Fclose Err: Duplicate  SJ.JIM.TECHSUP,NEW 80B FA # of records=27  DUPLICATE PERMANENT FILE NAME  (FSERR 100)  /reset sj  /k  SJ.JIM.TECHSUP,OLD 80B FA # of records=27  Purge existing file [no]? y  27 lines saved  

File Modification Timestamp

When you use the Text command on a file, Qedit stores the file’s modification timestamp in the workfile. If you try to Keep the file, Qedit compares the stored timestamp with the file’s current timestamp. If they are different, it means the original file has changed since you first opened it. Qedit will alert you to the difference by displaying a message similar to the following:

  Warning: Original file has been modified since the initial  Text or last Keep  

The file timestamp can change for a number of reasons. Here are few examples:

  • Someone else might have been working on that same file with Qedit and saved their changes before you did.
  • The file could have been restored.
  • Maybe you used the file to test a program which modified the file in some way.

Because the timestamp message is just a warning, Qedit continues its processing. It then asks for Keep confirmation. If you answer “Yes”, the file will be purged and you might lose someone else’s changes. Qedit will also store the new modification timestamp.

If you answer “No”, you should compare the contents of the file with your workfile and decide if it is safe to Keep your changes. This is one way to compare the files:

  • Keep the workfile under a different name
  • Use our Compare bonus program to display the differences between the original file and the new version you just created
  • Look at the report and separate the lines that you changed from the ones you did not touch
  • If needed, apply changes to your copy so you are not missing anything important

By default, timestamp checking on Keep
is enabled. If you want to change this setting, use the Set Keep Checktimestamp command.

If you want to erase the saved timestamp, you can use the Set Keep Name command.

Notes

You do not need to Keep your Qedit workfile before compiling. Only use Keep when you need a file as input to software that does not read Qedit files. For example, you would Keep an IMAGE schema before compiling it (although you can convert DBSCHEMA to read Qedit files; see the chapter on installation at the end of this manual).

When you Text a file and Keep it again, Qedit attempts to duplicate the original file. The form of the Keep file depends upon the current language and Set options, especially Set Keep and Set Extentsize. To see what the Keep file will look like, use Verify Keep.

Keep will retain the security of your existing file (including the :Release state and the ACDs) if you answer Yes to the “Purge old?” question. ACDs (Access Control Definitions) are a form of security that allows you to say exactly which users can do what to a file. Keep does not retain the ACDs on MPE V or when purging a remote file.

Keep Command [K]