HPlogo SORT-MERGE/XL General User's Guide > Chapter 6 SORT-MERGE/XL Commands

INPUT (SORT/XL)

MPE documents

Complete PDF
Table of Contents
Index
Glossary

Within the SORT/XL subsystem, the >INPUT command specifies the input file(s) to be sorted. Refer to the MERGE/XL >INPUT command for information on how to use the command within that subsystem.

SYNTAX



           {$STDIN [ X ]              }
  >I[NPUT] {*                         }[,#records][,recsize]
           {fname                     }
           {(fname1, fname2,...fnameN)}

PARAMETERS


$STDIN [ X ]

Specifies that the input records are to be read from $STDIN[ X ]. In interactive mode a question mark (?) prompt is displayed.

*

Entering an asterisk (*) in an interactive session specifies that the input records are read from the text file TEXT. In this case, the input records are to follow the >END command, and the list of records is to be terminated with :EOD.

Recall that TEXT is the formal file designator of the file containing the SORT/XL commands and that it defaults to $STDIN. Therefore, if no file equation has been entered against the file TEXT, the input records are entered from the terminal in interactive mode and are included in the stream file in batch mode. (The prompt "?" is displayed for each record in interactive mode.) If a file equation has been issued, then the records should be part of the file equated to TEXT (again following the >END command).

fname

Specifies the actual file designator. $NULL is not a valid input file.

#records

The #records parameter should be specified only if one or more of the input files is not on disc. It is a positive integer specifying the upper limit of the number of records sorted. If multiple input files are specified, it is the total number of records from all input files. When all input files are on disc, the current end-of-file (EOF) values are used and #records is ignored. If all input files are not on disc and #records is not specified, a default value of 10,000 is assumed by SORT/XL. This parameter cannot be used to extract a subset of the input file.

recsize

A positive integer specifying the maximum allowable number of bytes in a record. This parameter may be used to set the record size of the output file, but is used mainly for files containing variable-length records. When sorting such files, this parameter should be set to the size of the largest record present in the input. If rec size is not specified when sorting variable-length record files, SORT/XL will use the block size as the maximum record size. This could result in more space than necessary being used for the scratch file, as well as causing some degradation of performance.

MPE XL SORT has two sets of scratch files. If the sort takes place in compatibility mode, there is one scratch file for which the size is computed as in MPE V/E SORT. If the sort takes place in native mode, there are two (mapped) scratch files. Both computations are described below.

Compatibility Mode Scratch File Size


If you want to extimate the scratch file record size (SFRS) and the scratch file size (SFS), use the following equations:

  SFRS + ((recsize + 7)/2) + 4

where rec size is the input record size in bytes. (You must add the length of the keys to the rec size if the keys are of the type, BYTE, and ALTSEQ is used.) SFRS is in words.

  SFRS + ((SFRS*#records )/128) + 1

SFS is in sectors.

Compatibility Mode Scratch Filename


You can issue a file equation for the scratch file only to specify a particular logical device which must be a disc. For example:

  FILE SORTSCR; DEV=2

Native Mode Scratch File Size


Native mode scratch files contain two types of records: Work Records and End-of-Subfile Records. The following algorithm calculates the size of one native mode scratch file.

  Work Record Length (#Work Records + #End-of-Subfile Records)
                    = #Bytes in 1 scratch file
  Where:
                   #Work Records = #Input Records

               #End-of-Subfile Records = #Input Records / 50

   and Work Record Length = Input Record Length + Expansion Bytes

The value of Expansion Bytes depends on the number and type of keys that the user specifies. Expansion Bytes is expressed as:

  #key 5's + #Key 9's +
    2(#key 4's + #key 6's + 3key 7's +#key 8's +#key 12's) +
    3(#key 13's) +3

The space used for a sort occuring in native mode will be two times the value returned by this formula.


NOTE: This formula illustrates a worst case situation.

Native Mode Scratch Filenames


You cab issue file equations for the native mode scratch files only to specify a particular device which must be a disc. For example:

  FILE HPSORTS1; DEV=2
  
  FILE HPSORTS2; DEV=2

DISCUSSION


When specifying more than one input file to SORT/XL, the list of files must be enclosed in parentheses. This differs from the use of the >INPUT command for MERGE/XL, where parentheses cannot be used. If more than one >INPUT command is entered, only the last command is effective. Thus, all the files to be sorted must be specified in a single >INPUT command. This command can be entered any time before the >END command. In the absence of the >INPUT command, any disc file with the formal designator >INPUT is considered the input file. Also, file equations may be issued before entering or during either subsystem. Thus, if the >INPUT command refers to the same file as specified in a file equation, the file's characteristics are determined by the file equation. The user issues the >RESET command before entering SORT/XL or MERGE/XL if the default values for the parameters of the file are desired. The same holds for the >OUTPUT command for SORT/XL and the >INPUT and >OUTPUT command for MERGE/XL.

EXAMPLE


In the following example, the file EMPLOYEE is to be sorted with a maximum of 30 characters from each record:

  :SORT
  
  HP32214A.01.00  SORT/3000 THU, JUN  4, 1987,  9:50 AM
  (C) HEWLETT-PACKARD CO. 1986
  
  >INPUT EMPLOYEE, 30

ADDITIONAL DISCUSSION


See the >INPUT command for MERGE/XL in this chapter.




INPUT (MERGE/XL)


KEY