You can use the IF clause at the beginning of a command line to determine how processing of the script proceeds based on the current return code value. In the IF clause, you specify a return code symbolic value or severity.
The server initially sets the return code at the beginning of the script to RC_OK. The return code is updated by each processed command. If the current return code from the processed command is equal to any of the return codes or severities in the IF clause, the remainder of the line is processed. If the current return code is not equal to one of the listed values, the line is skipped.
/* Backup storage pools if clients are not accessing the server */
select * from sessions
/* There are no sessions if rc_notfound is received */
if(rc_notfound) backup stg backuppool copypool
The following
script example backs up the BACKUPPOOL storage pool if a return code
with a severity of warning is encountered: /* Backup storage pools if clients are not accessing the server */
select * from sessions
/* There are no sessions if rc_notfound is received */
if(warning) backup stg backuppool copypool