Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

SELECT-INPUT-RECORDS

&pagelevel(4)&pagelevel

In the case of file copying, this statement serves to select records from an input file on the basis of certain criteria, and transfer them to one or more output files. In the case of tape editing, blocks from the input tape are selected. The positioning specifications then refer to the beginning of the block, and not to the beginning of the record.

Input files which do not match any of the selection criteria can be transferred to special output files. These are referred to as “residual files” in the following description. They are defined by means of the REMAINING-RECORDS keyword of the CONDITION operand.

It is possible to define a separate selection criterion for each output file using the SELECT-INPUT-RECORDS statement.

If several SELECT-INPUT-RECORDS statements in a conversion step refer to the same link name, only the last statement specified is executed for this link name.

SELECT-INPUT-RECORDS

OUTPUT-LINK-NAME = *STD / list-poss(2000): <filename 1..8 without-gen>

,CONDITION = *REMAINING-RECORDS / <text 7..1800 with-low>

OUTPUT-LINK-NAME =
Link names of the output files to which this statement is to refer.

OUTPUT-LINK-NAME = *STD
This statement refers to all output files specified up to now.

OUTPUT-LINK-NAME = list-poss(2000): <filename 1..8 without-gen>
If the statement is to refer only to a few output files, the link names of these files must be specified.

CONDITION =
This operand serves to define the selection criteria (conditions) or the residual files.

CONDITION = *REMAINING-RECORDS
The output files specified in the OUTPUT-LINK-NAME operand are to be used as residual files. All input records that do not match any of the selection criteria are written to these residual files.
It is possible to define more than one residual file in any one conversion step.

Note

The statements SET-RECORD-MAPPING, SET-GROUP-ATTRIBUTES and SET-PAGE-LAYOUT as well as user interfaces can be used for residual files without any restrictions.

If a user interface for input determines that a record is not to be transferred, this decision applies to all output files including the residual files.

If a record matches the selection criteria but is not transferred as a result of a decision made in the user interface for output, it is still considered to be selected and is therefore not written to a residual file.

In the START-TAPE-PROCESSING statement, the OUTPUT-LINK-NAME operand determines the defined output files to which the statement is to refer. This means that different output files can be referred to each time this statement is called. The specification *STD applies to all output files specified before with the exception of the residual files. If any of the link names of output files specified explicitly with this operand refers to a residual file, the statement will be rejected with message PER0062. During processing of the START-TAPE-PROCESSING statement, a block is only written to a residual file if it cannot be transferred to any of the output files specified in the OUTPUT-LINK-NAME operand, i.e. if the block does not match any of the selection criteria for any of these output files.

Defining a residual file is not useful unless a SELECT-INPUT-RECORDS statement that defines a condition takes effect for all “normal” output files. Otherwise there will be no records to be written to a residual file.

An example of how to make use of a residual file is given on "Transferring records to a residual file".

CONDITION = <text 7..1800 with-low>
This operand defines the condition under which an input record is selected for output. The record will be transferred if the condition is satisfied (i.e. when “true” applies). The condition can consist of one or more comparisons linked by logical AND or OR. AND has priority over OR. This priority rule can be changed through the use of parentheses, thus improving readability and shortening the program runtime, since individual comparisons are not processed several times. The condition is processed from left to right.

The runtime can be reduced by deliberately putting the comparisons into a specific sequence (in particular, comparisons which for the most part yield the same result):

e.g.:

a OR b OR c
The comparison satisfied most frequently must be on the left.

a AND b AND c
The comparison satisfied most frequently must be on the right.

Restriction on parenthesis nesting: 1800 bytes for CONDITION.

Several comparisons linked by AND in a relationship result in the value “true” if all comparisons are “true”.

Several relationships linked by OR or comparisons which do not belong to any relationship result in the value “true” if at least one relationship or one comparison is “true”.

In the case of two comparisons the following applies:

1st comparison

Link

2nd comparison

Result

true
true
false
false

AND
AND
AND
AND

true
false
true
false

true
false
false
false

true
true
false
false

OR
OR
OR
OR

true
false
true
false

true
true
true
false

The syntax used to specify the condition in the CONDITION operand is as follows:

condition  : =(comparison [AND/OR comparison] ...)
comparison: =(position[,length]) EQ/NE N[UMERIC]/AL[PHA]
           or  (position[,length]) EQ/NE 
                                   AS[CENDING]/D[ESCENDING]/M[ODULE](modname)
           or  (position[,length[,C]]) op <c-string 1..256>/<x-string 1..512>
           or  (position,length,Z/P) op Z‘digit‘/P‘digit‘
           or  RECCNT(linkname) op Z‘digit‘/P‘digit‘
           or  BYTCNT(linkname) op Z‘digit‘/P‘digit‘
           or  BLKCNT(linkname) op Z‘digit‘/P‘digit‘
           or  RECLEN(linkname) op Z‘digit‘/P‘digit‘
           or  condition
position   : =<integer 1..32768>
length     : =<integer 1..256>
           or  RECLEN (record length), where 1 <= RECLEN <= 256 must apply
           or  1 <= RECLEN-reduction <= 256
              If the condition is not fulfilled, the conversion step is 
              aborted and message PER0042 is output.
op         : =EQ/NE/GT/LT/GE/LE

digit      : =same as in “literals”, see "Literals"

The specifications for the comparison operators are equivalents and have the following meanings:

Special characters

Combinations of letters

Meaning

=

EQ

equal to

>

GT

greater than

<

LT

less than

>=

GE

greater than or equal to

<=

LE

less than or equal to

<>

NE

not equal to

Record selection

Records are selected as the result of one of the following operations:

  1. Checking whether the character format of a file is numeric or alphabetic

    The specified field is checked to ensure that it has the required character format.

    NUMERICPERCON checks whether the specified field contains digits only.

    ALPHA

    PERCON checks whether the specified field contains only uppercase letters, lowercase letters, German umlauts and blanks.

    Examples

    COND=((5,3) EQ NUMERIC)

    COND=((20,4) EQ NUMERIC AND (25,5) EQ ALPHA)

  2. Checking whether the fields are sorted in ascending or descending order

    PERCON checks whether the specified field has been sorted in ascending or descending order, i.e. whether it has a higher or lower value than the field of the previous record. If the SELECT-INPUT-RECORDS condition prevents a record from being transferred to the output file, the field in this record cannot be used as the comparison field for comparison with the field in the next record.

    ASCENDINGPERCON checks for sorting in ascending order

    DESCENDING

    PERCON checks for sorting in descending order

  3. Checking the validity of the characters in a field by reference to a user table

    MODULE

    PERCON checks whether the specified field contains only characters authorized by the user.

    modname

    “modname” specifies the name of a user module (1st CSECT name) or of an area (ENTRY name) in a user module comprising 256 characters X’00’ or X’FF’.
    PERCON adds the value of each character from the field to the start address of the user module or user area. If the resulting position contains X’00’, the character is permitted; if it contains X’FF’, the character is not permitted. If one byte in the field fails to satisfy the condition, the comparison is not satisfied.

  4. Comparing a field with a literal (constant)

    The field is compared with the specified literal. Special rules apply in the event of differing formats and lengths (see the table below).

  5. Comparing a keyword with a literal (constant)

    The current value of “keyword” (see "Keywords ") is compared with the specified literal(see the table below).

    Example

    Two input files (IN1 and IN2) are to be converted to one output file. All records of the first input file, and all records of the second input file, from the fifth one onwards, are to be transferred. The condition for this is as follows:

    COND=(RECCNT(IN1) GT Z'0' AND RECCNT(IN2) EQ Z'0' OR RECCNT(IN2) GE Z'5')

Examples of parenthesis nesting:

The first example presents a comparison of two fields.

If the first field contains an unpacked number > 100 or < 50 and the second field contains the character string ’1.1’ or ’2.2’ at the same time, the record is transferred.

//SELECT-INPUT-RECORDS OUTPUT-LINK-NAME=02,-
//                     CONDITION=(-  
//     (   (10,5,Z) GT Z'100' - 
//     OR  (10,5,Z) LT Z'50' - 
//     ) - 
// AND (   (20,3,C) EQ C'1.1' - 
//     OR  (20,3,C) EQ C'2.2' - 
// )                             ) 

The second example illustrates the possibilities of parenthesis nesting. The comparisons are numbered from V1 to V12.

A record is output only if:

  1. V1, V2 and V3 are true and
    at least one of the comparisons V4, V5 or V6 is true and V7 is true.

  2. V1, V2 and V3 are true and
    at least one of the comparisons V4, V5 or V6 is true and V8 and V9 are true and at least one of the comparisons V10, V11 or V12 is true.

//SELECT-INPUT-RECORDS OUTPUT-LINK-NAME=03,- 
//                     CONDITION=(- 
//               RECCNT(IN1) LE Z'5000' -                             V1
// AND           RECCNT(03) LT Z'300' -                               V2
// AND           (28,5) EQ ASCENDING -                                V3
// AND (         (6,1,C) EQ 'P' -                                     V4
//       OR      (6,2,C) EQ 'ST' -                                    V5
//       OR      (6,3,C) EQ 'MOD' -                                   V6
//       ) - 
// AND (         (20,5) EQ NUMERIC -                                  V7
//     OR        RECLEN(IN1) GT Z'120' -                              V8
//        AND    (35,2) EQ MODULE(ABISK) -                            V9
//        AND (  (37,3,P) LT Z'230' -                                 V10
//            OR (37,3,P) EQ Z'241' -                                 V11
//            OR (37,3,P) GT Z'260' -                                 V12
//            ) - 
//     )                        ) 

Conversion rules in the event of differing character formats and unequal field length

The CONDITION operand specifies operands which are to be compared with one another. If two operands specified for comparison have different character formats or are of different lengths, the following conditions apply:

literal

C,X

P,Z

Comments

field

Keyword

C


+

-

If “field” and “literal” are of different lengths, the shorter of the two is filled to the right with blanks for the comparison.
If part or all of “field” lies outside a variable-length input record, the condition is considered fulfilled for “<>”, but not fulfilled for all other comparison operators.
The comparison is based on the EBCDIC code.

P,Z

RECCNT,
BYTCNT,
BLKCNT,
RECLEN

-

+

same as in “literals”, see "Literals "

+ valid comparison

  • invalid comparison