If you are unfamiliar with the INPUT statement, see
SAS Statements: Reference for more information.
An INPUT statement reads
from the file specified by the most recently executed INFILE statement.
If the INFILE statement is a CA-IDMS INFILE statement, the INPUT statement
issues a CA-IDMS function call as formatted by variables specified
in the INFILE statement.
There are no special
options for the CA-IDMS INPUT statement as there are for the CA-IDMS
INFILE statement. The form of the CA-IDMS INPUT statement is the same
as that of the standard INPUT statement:
INPUT <specification-1 > <…specification-n > <@
| @@ >;
For example, suppose
you issue an OBTAIN function call for the EMPLOYEE record. The CA-IDMS
INPUT statement might be coded as follows:
input
@1 employee_id 4.0
@5 firstname $char10.
@15 lastname $char15.
@30 street $char20.
@50 city $char15.
@65 state $char2.
@67 zip $char9.
@76 phone 10.0
@86 status $char2.
@88 ssnumber $char9.
@97 startdate 8.0
@105 termdate 8.0
@113 birthdate 8.0;
When this CA-IDMS INPUT
statement executes, the DATA step interface generates and submits
a function call from the options that you entered in the CA-IDMS INFILE
statement. If the FUNC= variable specified in the INFILE statement
is assigned a value of GET or OBTAIN, an EMPLOYEE record is retrieved
and placed in the input buffer. Data for the variables specified
in the CA-IDMS INPUT statement are then moved from the input buffer
to SAS variables in the program data vector.
Depending on which options
you specify in the CA-IDMS INFILE statement and which form of the
CA-IDMS INPUT statement you use, the INPUT statement does one of the
following:
-
retrieve a record from the database,
place it into the input buffer without moving any variables into the
program data vector, and possibly hold the record for the next INPUT
statement. If the FUNC= variable specifies GET or OBTAIN, but the
INPUT statement does not list any variables, then data is placed into
the input buffer without being moved into the program data vector.
If the INPUT statement specifies a trailing @ or @@, the record is
held for processing by the next INPUT statement. See
The Null INPUT Statement and
Holding Records in the Input Buffer for more information.
-
retrieve a record from the database,
place it into the input buffer, move data from the input buffer into
variables in the program data vector, and possibly hold the record
for the next INPUT statement. If the FUNC= variable specifies GET
or OBTAIN, and the INPUT statement specifies one or more variables,
then data is placed into the input buffer and mapped into variables
in the program data vector. If the INPUT statement specifies a trailing
@ or @@, the record is held for processing by the next INPUT statement.
See
Holding Records in the Input Buffer for more information.
-
submit a DBMS request without retrieving
a record. If the FUNC= variable specifies BIND, FIND, ACCEPT, or
RETURN, then no record data is retrieved from the database. These
functions are described in
Specifying DML Function Calls. See
The Null INPUT Statement for more information.
-
release a previously held record
from the input buffer. If the previous INPUT statement specified
a trailing @ or @@, and the current INPUT statement is a null INPUT
statement (
input;), then the previously held
record is released. See
Holding Records in the Input Buffer for more information.
Note: Every time SAS encounters
a CA-IDMS INPUT statement, it increments by one an internal counter
that keeps track of how many function calls are issued from the input
data set. The count is printed to the SAS log as a NOTE. Because
you can code several CA-IDMS INPUT statements that do not retrieve
data, this count might not accurately reflect the actual number of
records retrieved from the database.
Although the syntax
of the CA-IDMS INPUT statement and the standard INPUT statement are
the same, your use of the CA-IDMS INPUT statement is often different.
Suggested uses of the CA-IDMS INPUT statement are described in the
following sections.