READ

Description

Read data from an input file.

The file is available across all nested procedure files. You can, for example, issue the READ command from more than one procedure file.

Syntax

READ filenumber parametervariable ...

filenumber is a number between 1 and 4.

parametervariable represents one or up to 9 of the following variables:

+PARM1 through +PARM9 (global)
#PARM1 through #PARM9 (local)

The result of a READ operation is stored in these variables.

If you specify only one parametervariable, the entire record is stored in that variable.

If you specify more than one parametervariable, the record is first split into fields that are separated by blanks. The first field in then placed in the first variable, and so on.

If you specify more variables than fields, the unused variables are reset to null. If there are more fields than variables, the last variable contains the rest of the record.

The maximum ASCII record length supported by the READ command is 255 bytes. Therefore, the maximum amount of data that can be stored in one parametervariable is also 255 bytes.

Examples

  • Read input file 1 and store the entire record in a variable:

    READ 1 #PARM1
  • Read input file 2 and store the record in four variables:

    READ 2 #PARM1 #PARM2 #PARM3 #PARM4

Procedure File Example

Copyscr.ncp

Variables Returned

#RC (SUCCESS if a record was read successfully. EOF if the end-of-file marker is reached. FAILURE if READ was not successful.)

Related Commands

OPEN-I, CLOSE

Usage

Procedure File: Yes
Command Line: No
Key: No
API: No