Code:
- /*=============================================================================================
- /* Notes
- /*=============================================================================================
-
- /* Compile with ACTGRP('SVS9999')
-
- /*=============================================================================================
- /* Control Specifications
- /*=============================================================================================
-
- H NoMain
- H BndDir('MCSERV')
- H Option(*NODEBUGIO)
- H ExtBinInt
-
- /*=============================================================================================
- /* File Specifications
- /*=============================================================================================
-
-
- /*=============================================================================================
- /* Prototype Specifications
- /*=============================================================================================
-
- /Include QRpgCbSrc,SVS9999
- /Include QRpgCbSrc,SETJMP.H
-
- /*=============================================================================================
- /* Data Specifications
- /*=============================================================================================
-
- /*---------------------------------------------------------------------------------------------
- /* Data Structure Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*---------------------------------------------------------------------------------------------
- /* Array Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*---------------------------------------------------------------------------------------------
- /* Indicator Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*---------------------------------------------------------------------------------------------
- /* Standalone Data Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*---------------------------------------------------------------------------------------------
- /* Constant Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*#############################################################################################
- /* userConditionHandler001 - User Condition Handler
- /*#############################################################################################
-
- P userConditionHandler001...
- P B Export
-
- /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- /* Procedure Interface
- /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
- D userConditionHandler001...
- D PI
- D condition 12A Error Condition
- D userChBase * User Data
- D result 10I 0 Result
- D newCondition 12A New Condition
-
- /*=============================================================================================
- /* Procedure Prototype Specifications
- /*=============================================================================================
-
- D userConditionHandlerExit...
- D PR ExtProc(userCH.exitProc)
- D * Value User Data
-
- /*=============================================================================================
- /* Procedure Data Specifications
- /*=============================================================================================
-
- /Include QRpgCbSrc,DQUSec
-
- /Define RCVPM2
- /Include QRpgCbSrc,DQMhRcvPm
-
- /Include QRpgCbSrc,SetJmp.H
-
-
- /*---------------------------------------------------------------------------------------------
- /* Procedure Data Structure Specifications
- /*---------------------------------------------------------------------------------------------
-
- D userCH DS Based(userCHBase)
- D Qualified
- D errorBase *
- D exitProc * ProcPtr
- D exitData *
- D jumpPointBase *
-
- D jumpPoint DS LikeDs(jmpBufferTemplate)
- D Based(userCH.jumpPointBase)
-
- /*---------------------------------------------------------------------------------------------
- /* Procedure Array Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*---------------------------------------------------------------------------------------------
- /* Procedure Indicator Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*---------------------------------------------------------------------------------------------
- /* Procedure Standalone Data Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*---------------------------------------------------------------------------------------------
- /* Procedure Constant Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- /* Procedure Code
- /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
- /Free
-
- usec_Base = userCH.ErrorBase;
- result = 20; // percolate condition
-
- If usec_Base <> *NULL; // check for structure
- If usec_Provided >= usec_Avail_Static; // check struct size
- result = 10; // handle condition
-
- If usec_Provided > usec_Avail_Static; // find size of error
- usec_Data_Length = usec_Provided - usec_Avail_Static; // message data
-
- Else; // struct too small for
- usec_Data_Length = 0; // available data
- usec_Avail_Static = usec_Provided;
- EndIf;
- EndIf;
- EndIf;
-
- If result = 20; // percolate condition
- Return;
- EndIf;
-
- usec_Data_Base = usec_Base + usec_Avail_Static;
- RcvPM2_Data_Length = usec_Data_Length;
-
- /Include QRpgCbSrc,ZQMhRcvPm
-
- RcvPM_Msg_Type = '*EXCP'; // Get Exception Mesg
- RcvPM_Msg_Action = '*SAME';
- usec_Msg_Id = *BLANKS;
-
- For RcvPm_C_Stack_Counter = 1 to 10;
- /Include QRPGCBSRC,CQMHRCVPM
-
- If usec_Msg_Id = *BLANKS;
- If RcvPM2_Avail > 0;
- Leave;
- EndIf;
-
- Else;
- Leave;
- EndIf;
- EndFor;
-
- If RcvPM2_Return > 8 or RcvPM2_Avail > 0; // Message found
- usec_Msg_Id = RcvPM2_Msg_Id;
- usec_Available = RcvPM2_Data_Avail;
-
- If RcvPM2_Data_Length > 0 and rcvPM2_Data_Avail > 0;
- %SubSt(usec_Data : 1 : usec_Data_Length) =
- %SubSt(RcvPM2_Data : 1 : RcvPM2_Data_Length);
- EndIf;
-
- If userCH.ExitProc <> *NULL; // Exit Procedure Exists
- userConditionHandlerExit(userCH.ExitData); // Run Exit Procedure
- EndIf;
-
- If userCH.JumpPointBase <> *NULL; // Jump Point Exists
- RcvPM_Msg_Action = '*OLD'; // Handle Exception
- rcvPM_Msg_Key = rcvPM2_Msg_Key;
- /Include QRPGCBSRC,CQMHRCVPM
-
- /Include QRpgCbSrc,LQMhRcvPm
-
- longJmp(jumpPoint : 1); // Return to setjmp (GOTO)
- EndIf;
-
- Else; // No messages found
- result = 20; // percolate condition
- EndIf;
-
- /Include QRpgCbSrc,LQMhRcvPm
-
- Return;
-
- /End-Free
-
- P userConditionHandler001...
- P E
-
- //===========================================================================================
-
- SETJMP.H Copybook
-
- /If Defined(SETJMP_H)
- /Eof
- /EndIf
-
- /Define SETJMP_H
-
- /*=============================================================================================
- /* Notes
- /*=============================================================================================
-
- /* Signal related functions, structures and constants were left out of this copybook.
-
- /*=============================================================================================
- /* Prototype Specifications
- /*=============================================================================================
-
- D longjmp PR ExtProc('longjmp')
- D placeHolder LikeDs(jmpBufferTemplate) Program Stack
- D 10I 0 Value User Data
-
- D setJmp PR 10I 0 ExtProc('__setjmp')
- D placeHolder LikeDS(jmpBufferTemplate) Program Stack
-
- /*=============================================================================================
- /* Data Specifications
- /*=============================================================================================
-
-
- /*---------------------------------------------------------------------------------------------
- /* Data Structure Specifications
- /*---------------------------------------------------------------------------------------------
-
- D jmpBufferTemplate...
- D DS Template
- D * Invocation Pointer
- D * Libl Pointer
- D 10I 0
-
- /*---------------------------------------------------------------------------------------------
- /* Array Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*---------------------------------------------------------------------------------------------
- /* Indicator Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*---------------------------------------------------------------------------------------------
- /* Standalone Data Specifications
- /*---------------------------------------------------------------------------------------------
-
-
- /*---------------------------------------------------------------------------------------------
- /* Constant Specifications
- /*---------------------------------------------------------------------------------------------
-
-
-
|
|