space
Previous Page | Next Page

Examples of SAS/ACCESS DATA Step Programs

Statements Common to All SAS/ACCESS DATA Step Examples

All of the examples in this section contain or generate the following statements:

OPTIONS

The $IDMDBUG system option tells SAS to write information to the SAS log regarding call parameter values and the formatted calls submitted to CA-IDMS. You can use this information to debug your application and to inspect or verify the DML calls generated by the DATA step interface. Each of the examples in this section begin with an OPTIONS statement that specifies the $IDMDBUG option, but these OPTIONS statements are commented out with an asterisk. To execute the OPTIONS statement (and activate the $IDMDBUG system option), remove the asterisk.

INFILE

The INFILE statements used in these examples specify a subschema and the IDMS keyword, which indicates that the task will be accessing CA-IDMS records. The parameters on the INFILE statements create SAS variables whose values are used to format DML calls and check error status codes after those calls have been issued. None of the parameters have default values and, therefore, each variable must be assigned a valid value or blank before each call. None of the defined variables are included in the output data set. For specific information about each INFILE parameter, see Using the CA-IDMS INFILE Statement.

BIND RECORD

A BIND function call must be issued for each record whose data will be retrieved during execution of the DATA step. The BIND RECORD statement establishes addressability for a named record. In each of these examples, a null INPUT statement issues a BIND RECORD statement for each record (see The Null INPUT Statement). After the call is issued, the programs check the status code returned by CA-IDMS to be sure the call was successful. If the call is successful, the DATA step continues. If the call is unsuccessful, execution branches to the STATERR label, error information is written to the SAS log, and the DATA step terminates.

STATERR statements

For each call to CA-IDMS, the examples in this section check the status code that is returned by CA-IDMS. When CA-IDMS returns an unexpected status code, these examples execute the statements associated with the STATERR label. These statements

  • issue an ERROR message to the SAS log describing the unexpected condition

  • reset _ERROR_ to 0 to prevent the contents of the PDV (program data vector) from being written to the SAS log

  • issue a STOP statement to immediately terminate the DATA step.

For more information about dealing with status codes, see Checking Call Status Codes.

space
Previous Page | Next Page | Top of Page