Tuesday, January 13, 2009

Error and Condition Trapping (Call ON versus Signal ON)

Call ON and OFF is used to handle condition trap by procedure name.
SynTax:
call ON conditionName [ NAME trapLabel ] 
call OFF condition-Name

signal ON conditionName [ NAME trapLabel ] 
signal OFF condition-Name

Overview when Exception occurs Control is transferred to routine to address the errors. After the error routine handles the condition, execution of primary script can resume.

The difference between call and signal:
1. signal applies to all seven error conditions. call didn't apply to SYNTAX,NOVALUE,and LOSTDIGITS errors.
    note: other error conditions: HALT,ERROR,FAILURE,NOTREADY
2. signal forces abnormal changes in the flow of control, and unconditionally transfer the control to the trapLabel, after processed, [and then transferred the control to a specified Label manually].
   call provides a "normal" way to trap routines, control is automatically transferred from the error routine back to main program, and the result special variable is not setting when returned from a condition trap, any value coded on the return will be ignored.



No comments:

Post a Comment