
Return to the API Tips
Clearing and Sending Error Messages with QMHRMVPM and QMHSNDPM
// Remove Program Messages
// -----------------------
D RemoveMessage pr ExtPgm('QMHRMVPM')
D Rmv_PgmQue 10a
D Rmv_StkCnt 8b 0
D Rmv_MsgKey 4a
D Rmv_Remove 10a
D Error_Code 116a
* Send Program Messages
* ---------------------
D SendMessage PR ExtPgm('QMHSNDPM')
D Snd_MsgId 7A
D Snd_MsgFil 20A
D Snd_Data 80A
D Snd_DtaLen 8B 0
D Snd_Type 10A
D Snd_PgmQue 10A
D Snd_StkCnt 8B 0
D Snd_MsgKey 4A
D Error_Code 116a
// Remove Program Messages Parameters
// ----------------------------------
D Rmv_PgmQue s 10A Inz('*')
D Rmv_StkCnt s 8B 0 Inz(0)
D Rmv_MsgKey s 4A Inz(*Blank)
D Rmv_Remove s 10A Inz('*ALL')
// Send Program Messages Parameters
// --------------------------------
D Snd_MsgId s 7A Inz(*Blank)
D Snd_MsgFil s 20A Inz('QUSRMSG *LIBL ')
D Snd_Data s 80A Inz(*Blank)
D Snd_DtaLen s 8B 0 Inz(0)
D Snd_Type s 10A Inz('*DIAG')
D Snd_PgmQue s 10A Inz('*') // or program name
D Snd_StkCnt s 8B 0 Inz(0)
D Snd_MsgKey s 4A Inz(*Blank)
// Error Code Parameter
// --------------------
D Error_Code ds Inz
D ErByteProv 9B 0
D ErByteAval 9B 0
D ErExceptId 7A
D ErReserved 1A
D ErExcptDta 100A
** Non-Free Code example
C Callp RemoveMessage(Rmv_PgmQue: Rmv_StkCnt:
C Rmv_MsgKey: Rmv_Remove:
C Error_Code)
C Eval Snd_Data =
C 'Credit/Debit Memo Number not found'
C Eval Snd_DtaLen = %Len(%trim(Snd_Data))
C Eval Snd_StkCnt = 0
C Callp SendMessage(Snd_MsgId : Snd_MsgFil :
C Snd_Data : Snd_DtaLen :
C Snd_Type : Snd_PgmQue :
C Snd_StkCnt : Snd_MsgKey :
C Error_Code)
// Free Code Example
/Free
RemoveMessage(
Rmv_PgmQue:
Rmv_StkCnt:
Rmv_MsgKey:
Rmv_Remove:
Error_Code);
//Send a message to the error message subfile
Snd_Data = 'Error message goes here';
Snd_DtaLen = %Len(%trim(Snd_Data));
Snd_StkCnt = 0;
SendMessage(Snd_MsgId :
Snd_MsgFil :
Snd_Data :
Snd_DtaLen :
Snd_Type :
Snd_PgmQue :
Snd_StkCnt :
Snd_MsgKey :
Error_Code);
/End-Free
[report a broken link by clicking here]






