IORCMSG Function

Returns a formatted error message for _IORC_.

Category: SAS File I/O

Syntax

IORCMSG()

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.

Example

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-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;