Purpose

SEL-PARTIAL is used to select a range of records from the primary file (first file defined) for processing.
 

Syntax

SEL-PARTIAL(operand)
 

Operation

operand is part of a key of the primary file.  It must be initialized to a value that specifies the starting point in the primary file.
 

Remarks

SEL-PARTIAL causes PROIV to read all records with keys that are greater than or equal to operand, but match any preceding keys exactly. 

When SEL-PARTIAL is used, PROIV processes the primary file as an indexed paging file. For a multiple field key file, if the operand is not the first key, all key fields that precede the operand must also be initialized.  Processing of the primary file starts at the record identified by the values contained in operand and preceding key fields at the time the SEL-PARTIAL statement is executed.

When a record read from the primary file contains different values than the portion of the key specified in the operand or the full values of the preceding key fields at the time the SEL-PARTIAL statement is executed, end-of-file status is set and no more records are processed.

On a single field key primary file, where operand represents the full key, only one record is processed because the second file access will change the value of the key and end-of-file status will be set.  When the operand contains a partial key, multiple records are processed.

On a multiple field key primary file, one or more multiple records may be processed.  If operand is the lowest order key of the file and represents the full key, then only one record is processed.  If operand is not the lowest order key on the file, or if the operand contains a partial key, multiple records are processed.

SEL-PARTIAL can be used only in logic in the Key Mapping on Sort/Select event process point.  If used in any other logic, the statement is treated as a comment.

SEL-PARTIAL is not valid for sequential files.

If SEL-PARTIAL is used with a key that includes a numeric field, that is, one with data type NK, it will behave just like the SEL-ONLY command.
 

Example 1

Single Element Key - Key Field ITEM, length = 10 ITEM = '2K-34'

SEL-PARTIAL (ITEM)
This default logic reads and processes all records with a key of '2K-34XXXXX', where XXXXX is any value.  If there are no records where the key begins with '2K-34', no processing is done.
 

Example 2

Multiple Field Key - Key Fields CUSTNO (length = 8) and INVNO (length = 5).

CUSTNO = 76543210
SEL-PARTIAL(CUSTNO)
The above logic reads and processes all records from the primary file with a CUSTNO of 76543210, regardless of the value of INVNO in each record.  If no records with a CUSTNO of 76543210 exist, no processing occurs.

CUSTNO = ABCDEFG and INVNO = 123
SEL-PARTIAL(INVNO)
The above logic reads and processes all records from the primary file with a CUSTNO of ABCDEFG and an INVNO of 123XX, where XX can be any value.  If there are no records with keys that begin with ABCDEFG 123, no processing occurs.

CUSTNO = ABCDEFG and INVNO = 123
SEL-PARTIAL(CUSTNO)
The above logic reads and processes all records from the primary file with a CUSTNO of ABCDEFGX, where X can be any value.  If there are no records with a key beginning with ABCDEFG, no processing occurs
 

Comment on this topic

Topic ID: 520109