IORCMSG Function


Returns a formatted error message for _IORC_

Category: SAS File I/O

Syntax

character-variable = IORCMSG ()

Arguments

character-variable

  • specifies a character variable.

  • Tip: If the length has been previously defined, then the result will be truncated or padded as needed.

  • Default: The default length is 200 characters .

Details

If the IORCMSG function returns a value to a variable that has not yet been assigned a length, then by default the variable is assigned a length of 200.

The IORCMSG function returns the formatted error message that is associated with the current value of the automatic variable _IORC_. The _IORC_ variable is created when you use the MODIFY statement, or when you use the SET statement with the KEY= option. The value of the _IORC_ variable is internal and is meant to be read in conjunction with the SYSRC autocall macro. If you try to set _IORC_ to a specific value, you might get unexpected results.

Examples

In the following program, observations are either rewritten or added to the updated master file that contains bank accounts and current bank balance. The program queries the _IORC_ variable and returns a formatted error message if the _IORC_ value is unexpected.

 libname bank '  SAS-data-library  ';  data bank.master(index=(AccountNum));     infile   'external-file-1'   ;     format balance dollar8.;     input @ 1 AccountNum $ 1--3 @ 5 balance 5--9;  run;  data bank.trans(index=(AccountNum));     infile   'external-file-2'   ;     format deposit dollar8.;     input @ 1 AccountNum $ 1--3 @ 5 deposit 5--9;  run;  data bank.master;     set bank.trans;     modify bank.master key=AccountNum;     if (_IORC_ EQ %sysrc(_SOK)) then        do;           balance=balance+deposit;           replace;        end;  else     if (_IORC_ = %sysrc(_DSENOM)) then        do;           balance=deposit;           output;           _error_=0;        end;  else     do;        errmsg=IORCMSG();        put 'Unknown error condition:'        errmsg;     end;  run; 



SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net