How to get status of an AS/400 batch job

2900 pts.
AS/400 batch job
Hi all,
I have read couple of threads regarding batch job status, but no one has the exact answer of how I can get the status of a batch job either it was successfully or abnormally ended. I used WRKACTJOB and generate an output spool file then copy that spool file into a flat file and from there I retrieved statuses of jobs but these statuses are just RUN MSGW etc... I want message like if job is in DEQW status then either it was successfully completed or not.

Answer Wiki

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

If you know the job name, try doing a DSPLOG of QHST to a spool then copy to a flat file and scan for the messages.

You should see something like this
Job 044126/SYSTEM1/ARR_LABOR submitted for job schedule entry ARR_LABOR 
Job 044126/SYSTEM1/ARR_LABOR started on 09/01/14 at 23:15:00 in subsyste
Job 044126/SYSTEM1/ARR_LABOR ended on 09/01/14 at 23:15:00; .027 seconds

Discuss This Question: 6  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.
  • hunshabbir7
    Thanks for reply. Then after copying this log to spool file then from spool to flat file how I will be deleting spool file. To delete a spool file it requires some parameters from where I will provide them.
    2,900 pointsBadges:
  • hunshabbir7
    secondly how I will be scanning the flat file. Actually the workaround I did with the flat file generated from WRKACTJOB command it gave me a tabular form of entries and extracting values from that were quite easy by a Data Structure but here when I gone through all entries I couldn't understand how to get a complete record. I think you understand what I mean. 
    2,900 pointsBadges:
  • ToddN2000
    For purposes like this I set up a flat file in my work library called PRINT132.  You would have to rename the field to use in an RPG as the default fieldname matches the file name.
    Then some thing like this.

    /*  Create QQHST log print file
                 DSPLOG OUTPUT(*PRINT) 

    /* do what you need to here

    /*in your program yo could pass the job number or job name 
    /* you are looking for as a parm. Then in the RPG use the bif %SCAN
    /* returns full print record

                 EVAL      FULLRECORD = %SCAN(Parm : FileFieldname : 1)

    /* clean up
                 DLTSPLF    QPDSPLOG                    
                 CLRPFM     PRINT132  
    136,410 pointsBadges:
  • pdraebel
    A job on iSeries Exists as long as it is On JobQ, Running or has output (spoolfiles). To check the status of jobs that have completed one would need to do a DSPLOG MSGID(CPF1124 CPF1164) to *PRINT and than process that spoolfile. Message CPF1124 is for start massages, CPF1164 for completion messages.

    7,545 pointsBadges:
  • pdraebel
    Mind you, a job can complete Normally if the Procedures ran by it have their own error handling. A batch job that gets cancelled or that terminates by means of an Escape Message will have an Abnormal Termination.
    7,545 pointsBadges:
  • WoodEngineer
    Do you want to check for a specific job or are you looking for a general solution which can be used for many jobs?
    8,235 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: