Figure 7: Error handling routines

     D save_Errno      s             10I 0 inz(0)

     D save_ErrMsg     s             80A   varying

     D                                     inz(ÔNo ErrorÕ)

        .

        .

        

     P SetError        B

     D SetError        PI

     D   ErrNo                       10I 0 value

     D   Msg                         80A   varying const

      /free

         save_Errno = Errno;

         save_ErrMsg = Msg;

      /end-free

     P                 E

		
A
     

        .

        .

        

     P cust_Error      B                   Export

     D cust_Error      PI            80A   varying

     D   ErrNo                       10I 0 options(*nopass:*omit)

      /free

         Cust_Init();



         if %parms>=1 and %addr(Errno)<>*NULL;

            ErrNo = save_Errno;

         endif;

         return save_ErrMsg;

      /end-free

     P                 E

		
B