FNDSTRPDM – how do i find joblog

25 pts.
CL Program
iSeries job logs
RPG Program
I am using FNDSTRPDM command in my CL program for each file/field and running through RPG programs if the string is found. If I specify the wrong file (QRPGLESRC) and the program is found in QRPGSRC, I get the error PDM0055, which i can monitor. However, if the program is found and the string is not, I get message '0 members match the Find string in file QCLSRC.' and message PDM0575. Unfortunately, I cannot monitor this message as it is NOT an error message. could someone tell me how I could monitor this? I am running this for a large number of fields and therefore I need my CL program to flag ones that give me message PDM0575

Answer Wiki

Thanks. We'll let you know when a new response is added.

Thanks for your help. I works great!

Discuss This Question: 3  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Splat
    You can monitor for PDM0575 - it is an error message, albeit having a severity of 00 and not defined in QCPFMSG.
    12,915 pointsBadges:
  • TomLiotta
    You can monitor for PDM0575... Unfortunately, no, you can't 'monitor' for PDM0575 because it's sent as a *DIAG message. You can only monitor for messages sent as *ESCAPE, *STATUS or *NOTIFY messages. (Both *STATUS and *NOTIFY messages may cause surprises if any are sent.) For *DIAG (Diagnostic) messages, you need to 'receive' them instead of monitoring for them. And because there are often multiple *DIAG messages available to receive and they can't be requested by their message identifiers, you usually must receive *DIAG messages in a loop. You often then want to exit the loop after finding the one you're looking for. Here's a sample CLLE that executes a FNDSTRPDM command and sends a 'None found.' message to the user who called the program:
       dcl   &MsgID       *char    7
       dcl   &KeyVar      *char    4
       dcl   &JobUser     *char   10
       rtvjoba     user( &JobUser )
       fndstrpdm   string( 'XyzAbc' ) file( mylib/QRPGLESRC ) mbr( *ALL ) +
                     option( *NONE ) prtmbrlist( *YES) prtrcds( 1 )
       rcvmsg      msgtype( *DIAG ) rmv( *NO ) keyvar( &KeyVar ) msgid( &MsgID )
       dountil ( &MsgID *eq '       ' )
          if ( &MsgID *eq 'PDM0575' )  do
             sndmsg   'None found.' tousr( &JobUser )
             leave    /* Might as well leave since we found it... */
          /* Remove this ELSE after seeing the results once... */
          else  +
             if ( &MsgID *ne '       ' )  +
          rcvmsg   msgtype( *NEXT ) msgkey( &KeyVar ) rmv( *NO ) +
                     keyvar( &KeyVar ) msgid( &MsgID )
    The first RCVMSG will find the first available *DIAG message. It returns the message identifier and the message key associated with that message. The message key is used as a marker in the program message. The loop receives the *NEXT message after that message key and updates the key with the *NEXT key value. And that new key becomes the marker in the next iteration of the loop. I haven't dug deeply enough to find out why the PDM0575 can't simply be received in a loop that receives straight *DIAG messages. I had to switch over to message keys after receiving the first one. It is possibly marked as an "old" message somewhere inside of FNDSTRPDM itself. Regardless, the message key method seems to find it okay. Tom
    125,585 pointsBadges:
  • Splat
    Oops, you're right. I didn't look at the message type. Sorry for any confusion.
    12,915 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: