Purpose

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

Syntax

SEL-ONLY(operand)
 

Operation

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

Remarks

SEL-ONLY causes PROIV to read only those records with keys that match the operand exactly.

When SEL-ONLY is used, PROIV processes the primary file as an indexed paging file.  

If the operand is not the first field of the key, all key fields that precede the operand must also be initialized.  

Processing of the primary file starts at the record identified by the operand.  When a record read from the primary file contains different values from the ones contained in operand (and any preceding key fields) the end-of-file status is set and no more records are processed.  

On a single field key primary file where operand represents the entire key only one record is processed because the second file access changes the value of the key and end-of-file status is set.

On a multiple field key primary file, if operand is the lowest order key of the file, only one record is processed.  If the operand is not the lowest order key on the file, multiple records may be processed.

SEL-ONLY 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-ONLY is not valid for sequential files.
 

Example 1

Single Element Key - Key Field is ITEM (length = 10) ITEM = '2K-3487-12'

SEL-ONLY (ITEM)

This Default Logic reads and processes one record with a key of '2K-3487-12', from the primary file.  If a record with this key does not exist, no processing is done.
 

Example 2

Multiple Element Key - Key Fields are CUSTNO (length = 8) and INVNO (length = 5)

CUSTNO = 76543210
SEL-ONLY (CUSTNO)
The above Default Logic reads and processes all records with a CUSTNO of 6543210 from the primary file, regardless of the value of INVNO.  If no records with this CUSTNO exist, no processing is done.

CUSTNO = BCDEFG and INVNO = 123
SEL-ONLY(INVNO)
The above Default Logic reads and processes one record with a key of ABCDEFG 123, from the primary file.  If a record with that key does not exist, no processing is done.

CUSTNO = ABCDEFG and INVNO = 23
SEL-ONLY(CUSTNO)
The above Default Logic reads and processes all records from the primary file with a CUSTNO of ABCDEFG, regardless of the INVNO.  If there are no records with this CUSTNO, no processing is done.
 

Comment on this topic

Topic ID: 520108

Table of Contents

Index

Glossary

-Search-

Back