|
|
EDIT/3000 Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 3 EDIT/3000 COMMANDSKEEP |
|
The form of the KEEP command is
For example,
If the filename parameter of the KEEP command refers to a new file, a file is opened under this name by MPE/3000, and the WORK file contents are stored on disc in this file. When range is specified in a KEEP command, only those lines in the WORK file specified by range are saved. (If a column number is specified in range, the entire line containing that column is saved.) The file specified by filename must be in the log-on account. In an interactive session, if an existing file is named in the KEEP command, EDIT/3000 asks if you wish to purge the old contents of the file. A positive response (YES or Y) causes the contents of the old file to be purged and the contents of the WORK file to be written into the kept file. Any other response terminates the KEEP operation. If the KEEP command is used without any parameters, the filename is implied from the previous KEEP or TEXT command (whichever was performed last). If the UNNUMBERED option was specified in the previous KEEP or TEXT command, then this is also implied for the current KEEP command. EDIT/3000 produces an echo of the filename (and possibly the UNNUMBERED option) and copies the entire WORK file con- tents to that file. The following example shows the KEEP command used without any parameters. In this case, both the filename and the UNNUMBERED option are implied:
Another example follows. This time only the filename is implied:
If the file in question belongs to a group and/or account other than that of the log-on account, the filename, group, and account are echoed. In batch mode the contents of the old file are purged automatically when an existing old file is named in a KEEP command. Records in the WORK file are saved as fixed-length records unless the SET VARIABLE option of the SET command is used, in which case the records are saved as variable-length records. (See paragraph 3-92 for a discussion of the SET command.) An MPE/3000 error message is displayed if access to a file is not possible. See the MPE Commands Reference Manual for a discussion of file access. Unless the UNNUMBERED parameter is specified in the KEEP command, the line numbers in the WORK file are placed in the kept file in ASCII format. The SET FRONT, SET REAR, and SET FORMAT commands determine where the line number information will be kept (front or rear of each record). See paragraph 3-92 for discussions of these commands. Line numbers in the WORK file are not copied to the kept file when the UNNUMBERED parameter of the KEEP command is declared. Note that the default KEEP file is limited to disc files on the local computer. If a device or remote file is being used, an MPE file equation must have been issued and an asterisk ( * ) must be used to back-reference the file. (See the example of keeping to a card punch device in paragraph 3-67.) The KEEPQ filename command saves the WORK file in its "edit" format, instead of in the format in which files normally are stored by the MPE/3000 file system. This is accomplished by appending EDIT/3000 variables to the file and assigning a filecode of 1050 or 1051 to the file. A filecode of 1050 signifies an EDIT/3000 KEEPQ file (non-COBOL) and a filecode of 1051 signifies an EDIT/300OKEEPQ file (COBOL). All such files are intended to be read only by EDIT/3000 although KEEPQ files can also be read by SPL/3000. To add the lockword to the new file would require EDIT/3000 to save it internally and thus cause a possible security violation. The range and UNNUMBERED parameters of the KEEP command may be used only with the KEEP filename (or K filename) variation of the KEEP command. These parameters may not be used with the KEEPQ filename (or KQ filename) variation of the command. Note that the KEEP command does not put a lockword on the file unless you explicitly specify one. For example, suppose you have a file named MYFILE with the lockword LOCKED. Issuing the command KEEP MYFILE/LOCKED will purge the old file and put the lockword LOCKED on the new file. However, if you issue the command KEEP MYFILE or if you issue the command K[EEP] with no parameters, you will be prompted for the lockword and EDIT/3000 will purge the old file (if you have supplied the correct lockword) and create a new file named MYFILE without a lockword. A TEXT command (see paragraph 3-98) to copy the contents of an EDIT/3000 KEEPQ file into the WORK file renames that file with an EDIT/3000 Knnn name. To prevent destruction of such a file, enter the commands TEXT filename and KEEP filename in succession. If SET FIXED is in effect, the KEEP file will have
The blocking factor is calculated to allow the optimal trade-off between disc space used and time required for input-output. If SET VARIABLE is in effect, the KEEP file will have
Using this large record size maximizes the disc space used by allowing many variable-length records to be entered in a single block. Any of these attributes can be overridden by back-referencing a file equation for the KEEP file in the KEEP command.
Trying to KEEP a numbered file which is greater than 256 bytes wide (including 8 bytes for sequence numbers) will result in error #75, RECORDS TOO WIDE - KEEP UNNUMBERED. Several variations of the KEEP command are shown in the following examples.
The first example uses the KEEP EDIT2 command to keep the file EDIT2. Because EDIT2 is an existing file, EDIT/3000 asks if it is OK to purge the old file.
The KEEP range form, as in the following example, keeps only those lines specified in range (lines 8 through 11 in the example).
When the KEEP filename, UNNUMBERED form of the KEEP command is used, as in the following example, the file can be copied back into the work file either with a TEXT filename, UNNUMBERED or a TEXT filename command. Note that EDIT/3000 assigns line numbers to the unnumbered file TEST (as shown by the LIST ALL command).
When the KEEP filename form of the KEEP command is used, EDIT/3000 appends eight bytes to the end of each record for sequencing information. When the TEXT file is copied back into the WORK file with a TEXT filename command, these eight bytes are deleted by EDIT/3000; however, if you do not wish the information contained in the eight bytes to be saved in the TEXT file, use the KEEP filename, UNNUMBERED form of the KEEP command. In the next example, the SET RIGHT and SET LENGTH options are set to 52, then lines 1 through 10 of the WORK file are saved under the filename TEST. Once EDIT/3000 operation is terminated, the MPE/3000 command:LISTF TEST,1 shows that the length has been increased by eight bytes to 60 bytes.
The next example demonstrates the use of the KEEPQ command. In the first part of the example, the TEXT file EDIT2 is copied into the WORK file and listed. The VERIFY FILES command shows a WORK file of K18111336 and the MPE/3000 LISTF command displays the file parameters. In the second part of the example, the same file is copied into the WORK file and listed. Then the KEEPQ command is entered. Note that now when the VERIFY FILES is entered, there is no entry for the WORK file and an attempt to LIST ALL results in the error message
The MPE/3000 LISTF command shows that EDIT2 now has a filecode of 1050 (an EDIT/3000 KEEPQ file). Such a file can be read only by EDIT/3000 and can be used for no other purpose (no other EDIT/3000 commands will execute for such a file. For example, the LIST ALL command would not execute.) The last part of the example shows how to use such a file, by entering the TEXT filename and KEEP filename commands in succession. Now the LIST ALL command executes.
EDIT/3000 monitors whether you make changes to the TEXT file or not. Thus, when using the TEXT or END command, you are not burdened with "OK TO CLEAR?" message unless the file has been altered. The "VERIFY ALL" and "VERIFY FILES" commands indicate if the WORK file has been altered with the following message:
For example,
In the next example, a FORTRAN/3000 source program, which has been copied into the WORK file with a TEXT command, is sent to a card punch device. To prevent the line numbers from being punched on the cards, the KEEP filename, UNNUMBERED form of the KEEP command is used.
If the file is kept with a name that already exists, the old file is purged, but the user labels are not lost. They are passed on to the new file. |
|