Is there a simple way to write custom program messages to the job log from RPG?
Announcement
Collapse
No announcement yet.
write custom program messages to the job log
Collapse
X
-
Re: write custom program messages to the job log
Marty look here
All my answers were extracted from the "Big Dummy's Guide to the As400"
and I take no responsibility for any of them.
www.code400.com
-
Re: write custom program messages to the job log
to write simple messages to the job log u can use the following;
Diag800;
PHP Code://-----------------------------------------------------------------------
D Diag PR
D peMsg 1024A Varying Const Options(*VarSize)
D PMessage1 S 1024A Varying
D ThisSize S 4 0
//-----------------------------------------------------------------------
C *Entry PList
C Parm PMessage 1024
C Parm PSize 4
//-----------------------------------------------------------------------
/Free
ThisSize = %UNS(PSize);
PMessage1 = %SUBST(PMessage:01:ThisSize);
CallP Diag(PMessage1);
*InLr = *On;
/End-Free
//-----------------------------------------------------------------------
* Diag(): Place a diagnostic message into the job log
*
* peMsg = (input) Text of message to write to job log
*
* Returns *OFF if it failed, *ON upon success
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P Diag B export
D Diag PI
D peMsg 1024A varying const options(*varsize)
D QMHSNDPM PR ExtPgm('QMHSNDPM')
D MessageID 7A Const
D QualMsgF 20A Const
D MsgData 1024A Const options(*varsize)
D MsgDtaLen 10I 0 Const
D MsgType 10A Const
D CallStkEnt 10A Const
D CallStkCnt 10I 0 Const
D MessageKey 4A
D ErrorCode 32767A options(*varsize)
D dsEC DS
D dsEC1 10I 0 inz(0)
D dsEC2 10I 0 inz(0)
D MsgKey S 4A
c callp QMHSNDPM( 'CPF9897'
c : 'QCPFMSG *LIBL'
c : peMsg
c : %len(peMsg)
c : '*DIAG'
c : '*': 1
c : MsgKey
c : dsEC )
P E
//-----------------------------------------------------------------------
Using this as follows in a cl;
PHP Code:Start:
Dcl &DialogMes *Char (1024 )
Dcl &DialogSiz *Char ( 4 )
/* **************************************************************** +
Send job Steps to Job Log +
**************************************************************** */
ChgVar &DialogMes Value('XXX800Jq: Step 1 of 10: Read XXXXXX 87')
ChgVar &DialogSiz Value('0240')
Call Diag800 Parm(&DialogMes +
&Dialogsiz )
Or in RPG as follows;
PHP Code://----------------------------------------------------
D Dialog PR ExtPgm('DIAG800')
D 1024A
D 4A
//----------------------------------------------------
DialogSize = '0036';
DialogMessage = 'Begin of Results for XXXX XXXX..';
CallP Dialog( DialogMessage:
DialogSize );
Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply
Comment
-
Re: write custom program messages to the job log
This does work
PHP Code:H dftactgrp(*no)
H actgrp(*caller)
D field1 s 5 inz('Mess1')
D field2 s 10 inz('Mess2')
D Qp0zLprintf PR 10I 0 ExtProc('Qp0zLprintf')
D szOutputStg * Value OPTIONS(*STRING)
D * Value OPTIONS(*STRING:*NOPASS)
D * Value OPTIONS(*STRING:*NOPASS)
*=============================================================
* M A I N L I N E
*=============================================================
C callp Qp0zLprintf('Test: %s %s' + X'25' :
C %trim(Field1):%Trimr(field2))
c eval *inlr = *on
PHP Code:H dftactgrp(*no)
H actgrp(*caller)
D field1 s 5 inz('Mess1')
D field2 s 10 inz('Message 2')
D field3 s 20 inz('Message 3')
D Qp0zLprintf PR 10I 0 ExtProc('Qp0zLprintf')
D szOutputStg * Value OPTIONS(*STRING)
D * Value OPTIONS(*STRING:*NOPASS)
D * Value OPTIONS(*STRING:*NOPASS)
D * Value OPTIONS(*STRING:*NOPASS)
*=============================================================
* M A I N L I N E
*=============================================================
C callp Qp0zLprintf('Test: %s %s %s '+ X'25' :
C %trim(Field1):%Trimr(field2) :
C %trim(Field3))
c eval *inlr = *on
All my answers were extracted from the "Big Dummy's Guide to the As400"
and I take no responsibility for any of them.
www.code400.com
Comment
Comment