HPlogo EDIT/3000 Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 3 EDIT/3000 COMMANDS

JOIN

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

3-56. JOIN COMMAND

3-57. Purpose.

The JOIN command appends or merges the contents of another MPE/3000 file into the WORK file.

3-58. Form.

The form of the JOIN command is

   J[OIN] [Q]  {filename} [(linenumber[/linenumber])

                           (#recnum/#recnum]

   [{TO

     , } {linenumber}[ {BY

                                                   , } increment] ] [ [,] UNN[UMBERED] ]

The second occurrence of the linenumber is optional. If only one linenumber is specified, the entire file, starting with that linenumber, is joined, If no linenumber or #recnum is mentioned, the range of the JOIN command would include all of the records of the file. If the #recnum form is used and only one record is to be joined, the same #recnum must appear on both sides of the slash mark.

For example,

    JOINQ ADDFILE (2/234) TO 34.001 BY .001

3-59. Description.

The JOIN command is used to copy into the WORK file all or a portion of an MPE/3000 file to which you have access.

If the SET FORMAT = DEFAULT option is in effect, EDIT/3000 assumes that the first or last eight bytes (depending on whether FRONT or REAR is currently set) of each record in the file to be copied contain the sequence number. If the SET FORMAT = COBOL option is in effect, EDIT/3000 disallows the SET REAR option and assumes that the first six bytes of each record in the file contain the sequence numbers. In either case, these bytes are not copied into the WORK file. If these bytes contain text that should be copied in the WORK file (as is usually the case with an unnumbered file), you will want to use the UNN option with the JOIN command to copy the entire record of each line. Alternatively, you may use a SET command with the appropriate SET options for the bytes which are to be copied. See paragraph 3-92 for a discussion of the SET command.

EDIT/3000 assigns new line numbers to all lines copied by a JOIN command. If the TO linenumber (or ,linenumber) parameter is not specified, the new line numbers start with the value currently set for FROM (see paragraph 3-92 for a discussion of the SET command) or with the first available line in the WORK file (the last linenumber in the WORK file incremented by DELTA). If the TO parameter is used, the linenumbers start with the number specified. Succeeding lines are incremented by the SET DELTA = increment option in effect or by the BY increment (or ,increment) parameter specified in the JOIN command.

In an interactive session, each line copied is displayed on the terminal (unless the Q parameter is included with the command). You may terminate the JOIN command by entering CONTROL Y. Any lines copied before CONTROL Y is entered remain in the WORK file.

The contents of the joined file are unaffected.

3-60. Limitations.

Any file to be copied into the WORK file with a JOIN command must

  1. Consist of ASCII-coded records.

  2. Have a filecode of from 0 to 1023, 1040 XLSAV, 1060 RJEPN, or 1052 EDTCT. (See the MPE Commands Reference Manual for a discussion of filecode.)

  3. Be available to you for read access. (See the MPE Commands Reference Manual.)

  4. Exist as a disc-resident temporary or permanent file.

NOTE: If the file to be copied is on a device other than disc (such as a magnetic tape device), use the MPE/3000 File Copier to copy the file to disc.

Records copied from the JOIN file are entered into the WORK file within the limits established by column 1 and the value of the LENGTH para-meter. If the length of records in the JOIN file is greater than the WORK file LENGTH limit in effect, the JOIN file records will be truncated to the WORK file length when they are joined.

If one very large or many smaller files are to be joined, use the SET SIZE command (see paragraph 3-92) to establish a large enough WORK file before using the TEXT command to text in the main file.

If the JOIN command is attempted on a KSAM file (see the KSAM/3000 Reference Manual), the following warning message is produced:

   * * * * * WARNING FILE IS KSAM

KSAM files are joined according to the primary key order. If the (linenumber/linenumber) range is specified and the line numbers are not the primary key, the results will be unpredictable.

3-61. Examples.

Several examples of the JOIN command are presented in the following examples. The location of the pointer is shown at the conclusion of each JOIN command.

  • JOIN filename (linenumber/linenumber)

The following example joins line numbers 2 through 4 from the file ADDFILE to the WORK file starting at line 2.1.

   /TEXT ADDFILE

   /LTST ALL

         1   LINE  1 OF JOIN FILE

         2   LINE  2 OF JOIN FILE

         3   LINE  3 OF JOIN FILE

         4   LINE  4 OF JOIN FILE

         5   LINE  5 OF JOIN FILE

   /TEXT FILE

   /LIST ALL

         1   LINE  1 OF WORK FILE

         2   LINE  2 OF WORK FILE

         3   LINE  3 OF WORK FILE

         4   LINE  4 OF WORK FILE

         5   LINE  5 OF WORK FILE

   /JOIN ADDFILE (2/4) TO 2.1 BY .1

         2.1 LINE  2 OF JOIN FILE

         2.2 LINE  3 OF JOIN FILE

         2.3 LINE  4 OF JOIN FILE

   /FIND*

         2.3 LINE  4 OF WORK FILE

                                       (61 )   ^

   /LIST 2/3

         2   LINE  2 OF WORK FILE

         2.1 LINE  2 OF JOIN FILE

         2.2 LINE  3 OF JOIN FILE

         2.3 LINE  4 OF JOIN FILE

         3   LINE  3 OF WORK FILE
  • JOIN filename (#recnum/#recnum)

To join logical record numbers from a file to the WORK file, the (#recnum/#recnum) rangelist form is used as in the following example.

Note that line numbers 1 through 3 (which are logical record numbers 0 through 2) are added to the WORK file.

   /JOIN ADDFILE (#0/#2) TO 3.1

         3.1 LINE 1 OF JOIN FILE

         3.3 LINE 2 OF JOIN FILE

         3.3 LINE 3 OF JOIN FILE

   /FIND*

         3.3 LINE 3 OF WORK FILE

             ^ (1 )

   /LIST 3/4

         3   LINE 3 OF WORK FILE

         3.1 LINE 1 OF JOIN FILE

         3.2 LINE 2 OF JOIN FILE

         3.3 LINE 3 OF JOIN FILE

         4   LINE 4 OF WORK FILE
  • JOINQ

If the JOIN filename form with no rangelist is used, as in the following example, the entire contents of the JOIN file are added to the end of the WORK file.

In addition, since the TO linenumber was not included, the JOIN file contents are copied to the end of the WORK file.

   /LIST ALL

         1   LINE  1 OF JOIN FILE

         2   LINE  2 OF JOIN FILE

         3   LINE  3 OF JOIN FILE

         4   LINE  4 OF JOIN FILE

         5   LINE  5 OF JOIN FILE

   /JOINQ ADDFILE

   NUMBER OF LINES JOINED = 5

   /FIND*

         10  LINE  5 OF WORK FILE

             ^ (1 )

   /LIST ALL

         1   LINE  1 OF WORK FILE

         2   LINE  2 OF WORK FILE

         3   LINE  3 OF WORK FILE

         4   LINE  4 OF WORK FILE

         5   LINE  5 OF WORK FILE

         6   LINE  1 OF JOIN FILE

         7   LINE  2 OF JOIN FILE

         8   LINE  3 OF JOIN FILE

         9   LINE  4 OF JOIN FILE

        10   LINE  5 OF JOIN FILE
Feedback to webmaster