Software AG Products 2.4.1 | Reference Guide | Execution Commands | Detailed Syntax | @READISN
 
@READISN
The @READISN command reads a single record whose ISN is known, or the first record whose ISN is equal or greater than a specified ISN, from a file.
The syntax of the command is as follows:
syntax of read ISN
The record is read into the record buffer characterized by the nnnn suffix, as defined in the corresponding @ADADCL command.
@READISN command used is when reading a desired USERVIEW (set of fields) from a file via sequential commands or a @FIND command, and for some of the records another USERVIEW of the same record has to be read. In this case, the ISN of the current record may be found in the field ISNnnnn (generated by the first @ADADCL). This field may be used as id1 identifier in the ISN clause of the command.
In the following example, we read the fields of the userview file defined as PERS1 in Predict for all employees that were born after the first of January, 1970 . For those who live in NEW-YORK we need to read more fields defined as USERVIEW PERS2 in Predict. Since we do not read fields from PERS2 for every record, this method is more efficient and does not require Adabas to decompress those fields for every record.
@ADADCL1, EMPLOYEES BIRTH GT, USERVIEW=PERS1.
@ADADCL2, EMPLOYEES, USERVIEW=PERS2.
.
.
MOVE 700101 TO V-BIRTH1.
@FIND1.
PERFORM READING UNTIL EOF1.
.
.
READING.
IF CITY1 = ‘NEW YORK’ PERFORM READ2.
.
.
@READNEXT1.
READ2.
@READISN2 ISN=ISN1.
When omitting the ISN=id1 clause, ensure that a current ISN does indeed exist in the ISN field of the CONTROL-BLOCK characterized by the same nnnn suffix of the @READISN command.
The SEQUENCE option provides for reading of a record identified by an ISN, and if the ISN specified does not exist in the file, the record with the next higher ISN is read. When using this option, check if the ISN actually read is logically pertinent, otherwise logical errors might occur. With the SEQUENCE option the EOFnnnn identifier must be checked for an end-of-file situation. This option may be used for reading the file in ISN sequence.
For example:
PERFORM READING VARYING I FROM 1 BY 1 UNTIL E0F5.
.
READING.
@READISN5 ISN=I SEQUENCE.
IF NOT-E0F5
MOVE ISN5 TO I.
The HOLD option is applied when the user intends to update or delete the record and needs to prevent other users from updating it, before it has been released.
When the RETURN option is used together with the HOLD option, it causes the return of response code 145, if the record is already in HOLD state. If the RETURN option is used, it is immediately followed by the program checking for response code 145. Without the RETURN option, the program is placed in WAIT status, until the desired record is released.
The PASSWORD parameter is used for protected files. The user must provide an identifier containing a valid password.
The CIPHER parameter is used for ciphered files. The user must supply an identifier containing a valid cipher code.