Exception/Error Handling


           Error Handling

           In RPG, there are two types available for error handling technique. If the status code is  
           greater than 00099, than only both DS [file information and program status] will be  
           executed.

File information DS. Here 'Duplicate Record Found' error will be monitored. For this, the INFDS [data structure] and INFSR [subroutine] will be added.
FTEST   O E   DISK INFSR (*pssr)
Here we can pickup the error information [duplicate record found] in the position 379 to 400. For that we have to declare a DS. That DS contains, *FILE, *RECORD, *STATUS, *ROUTINE, *OPCODE
           
           Eg. Undefined record type, Device error.

Program status DS. Here we can trap 'Divide by Zero' error by using the PSDS. This DS
           This DS contain *PARMS, *PROGRAM, *STATUS, *ROUTINE.

           Eg. Divide by zero error, invalid array index, SQRT of negative number.


No comments