midrange.com code scratchpad |
Name:
QSH0005
|
Scriptlanguage:
Ruby
|
Tabwidth:
4
|
Date:
02/24/2020 08:25:38 pm
|
IP:
Logged
|
|
Description:
Retrieve status code from msg QSH0005
|
Code:
- Dcl-PR rcvmsg ExtPgm('QMHRCVPM') ;
- *n Char(256) ;
- *n Int(10) Const ;
- *n Char(8) Const ;
- *n Char(10) Const ;
- *n Int(10) Const ;
- *n Char(10) Const ;
- *n Char(4) Const ;
- *n Int(10) Const ;
- *n Char(10) Const ;
- *n Char(256) ;
- End-PR ;
-
- Dcl-DS msgParm Qualified ;
- msg LikeDS(msgDS) ;
- msgLen Int(10) Inz(%Len(msgParm.msg)) ;
- format Char(8) Inz('RCVM0100') ;
- callStkEntry Char(10) Inz('*') ;
- callStkCntr Int(10) Inz(0) ;
- msgType Char(10) Inz('*COMP') ;
- msgKey Char(4) Inz(*Blanks) ;
- waitTime Int(10) Inz(0) ;
- action Char(10) Inz('*REMOVE') ;
- End-DS ;
-
- Dcl-DS msgDS Len(256) ;
- bytesReturned Int(10) ;
- bytesAvailable Int(10) ;
- *n Int(10) ;
- msgID Char(7) ;
- msgData Int(10) Pos(49) ;
- End-DS ;
-
- Dcl-DS errDS ;
- *n Uns(10) Inz(%Len(errDS)) ;
- errAvl Uns(10) ;
- *n Char(7) ;
- *n Char(1) ;
- *n Char(240) ;
- End-DS ;
-
- Dcl-C
-
- Dcl-Proc exec ;// Calls QCMDEXC
- Dcl-PI *n Ind ;//
- status Int(3) Value ;
-
-
- // call to qshell
-
- DoU ( msgParm.msg.msgID =
- Or msgParm.msg.bytesAvailable = 0 ) ;
- rcvMsg( msgParm.msg
- : msgParm.msgLen
- : msgParm.format
- : msgParm.callStkEntry
- : msgParm.callStkCntr
- : msgParm.msgType
- : msgParm.msgKey
- : msgParm.waitTime
- : msgParm.action
- : errDS
- ) ;
- EndDo ;
- If ( msgParm.msg.msgID =
- status = msgParm.msg.msgData;
- Return ( msgParm.msg.msgData <> 0 ) ;// return *On if qshell error
- Else ;
- Return *Off ;// wasn't a shell call
- EndIf ;
|
|
|