• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Remove Misleading Messages from Job Logs

    February 16, 2005 Hey Ted

    Job logs get too large in our shop, and it’s hard to find the information that helps us determine why a program went wrong. How can we reduce the size of our job logs? Specifically, how can we keep from writing messages that are not really errors? An example would be a CL command that we’ve monitored for that may or may not fail.

    –Mitch

    I understand your concern. I can think of a lot of more useful things to do with my time than wading through a job log of hundreds of pages. I am familiar with one application that fills the job with so many messages that the job log wraps twice before the job ends.

    The first thing I’d do is to make sure that CL program commands are not being logged. Logging commands may be helpful during development, but I can’t think of a single time when logging CL commands helped me during a production run.

    You’ve hit on something with your second question. It’s not uncommon in good CL programming to execute a command that may fail and, if it fails, to either ignore the error or pursue some other course of action. In the following code example, a work file may or may not already exist in QTEMP. If it exists, the file should be cleared. If it does not exist, the file should be created.

    CLRPFM     FILE(QTEMP/CUSTWORK)                             
    MONMSG     MSGID(CPF3142) EXEC(DO)                          
       CRTDUPOBJ  OBJ(CUSTOMER) FROMLIB(*LIBL) OBJTYPE(*FILE) + 
                    TOLIB(QTEMP) NEWOBJ(CUSTWORK)               
    ENDDO
    

    If the Clear Physical File Member (CLRPFM) command succeeds, the job log contains completion message CPC3101 (Member CUSTREC file CUSTWORK in QTEMP cleared).

    But if the command fails, the job log contains escape message CPF3142 (File CUSTWORK in library QTEMP not found). As you’re reading the job log, you have to pause and decide whether that message indicates an error. A job log full of such “non-error” messages can slow down your progress in tracking the cause of an abnormal job end.

    You can’t keep from writing such messages, but you can easily remove them from the job log. Use the Receive Message (RCVMSG) command, as the following example illustrates.

    CLRPFM     FILE(QTEMP/CUSTWORK)                             
    MONMSG     MSGID(CPF3142) EXEC(DO)                          
       RCVMSG     MSGTYPE(*EXCP) RMV(*YES)                      
       CRTDUPOBJ  OBJ(CUSTOMER) FROMLIB(*LIBL) OBJTYPE(*FILE) + 
                    TOLIB(QTEMP) NEWOBJ(CUSTWORK)               
    ENDDO
    

    You may want to do the same sort of thing in programs written in other languages. Here is an example from RPG.

    /free                                                          
         monitor;                                                   
            three = one / two;                                      
         on-error;                                                  
            three = *zero;                                           
         endmon;
    

    The programmer has decided not to halt the program if something goes wrong with the division operation, but to set variable THREE to zero and keep going. If TWO has a value of zero, escape message MCH1211 (Attempt made to divide by zero for fixed point operation) gets written to the job log.

    Use the Receive Program Message (QMHRCVPM) API to remove the unneeded escape message from the job log.

    D/copy prototypes,QMHRCVPM                                      
                                                                    
    D MsgInfo         s              8a                             
    D ErrorCode       s              8a   inz(x'0000000000001000')  
                                                                    
     /free                                                          
         monitor;                                                   
            three = one / two;                                      
         on-error;                                                  
            three = *zero;                                          
            QMHRCVPM (MsgInfo: %size(MsgInfo): 'RCVM0100':          
                     '*': *zero: '*EXCP': *blanks: *zero:           
                     '*REMOVE': ErrorCode);                         
         endmon;
    


    Here’s the prototype referred to in the /COPY directive.

    D QMHRCVPM        pr                  extpgm('QMHRCVPM') 
    D  MsgInfo                       8a                      
    D  MsgInfoLen                   10i 0 const              
    D  FormatName                    8a   const              
    D  CallStackEntr                10a   const              
    D  CallStackCtr                 10i 0 const              
    D  MsgType                      10a   const              
    D  MsgKey                        4a   const              
    D  WaitTime                     10i 0 const              
    D  MsgAction                    10a   const              
    D  ErrorStruct                        like(ErrorCode)
    

    –Ted

    Click here to contact Ted Holt by e-mail.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    DRV Tech

    Get More Out of Your IBM i

    With soaring costs, operational data is more critical than ever. IBM shops need faster, easier ways to distribute IBM applications-based data to users more efficiently, no matter where they are.

    The Problem:

    For Users, IBM Data Can Be Difficult to Get To

    IBM Applications generate reports as spooled files, originally designed to be printed. Often those reports are packed together with so much data it makes them difficult to read. Add to that hardcopy is a pain to distribute. User-friendly formats like Excel and PDF are better, offering sorting, searching, and easy portability but getting IBM reports into these formats can be tricky without the right tools.

    The Solution:

    IBM i Reports can easily be converted to easy to read and share formats like Excel and PDF and Delivered by Email

    Converting IBM i, iSeries, and AS400 reports into Excel and PDF is now a lot easier with SpoolFlex software by DRV Tech.  If you or your users are still doing this manually, think how much time is wasted dragging and reformatting to make a report readable. How much time would be saved if they were automatically formatted correctly and delivered to one or multiple recipients.

    SpoolFlex converts spooled files to Excel and PDF, automatically emailing them, and saving copies to network shared folders. SpoolFlex converts complex reports to Excel, removing unwanted headers, splitting large reports out for individual recipients, and delivering to users whether they are at the office or working from home.

    Watch our 2-minute video and see DRV’s powerful SpoolFlex software can solve your file conversion challenges.

    Watch Video

    DRV Tech

    www.drvtech.com

    866.378.3366

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Cybele Software Updates Legacy Modernization Tools Mirifex Delivers a BlackBerry Interface for Legacy Apps

    One thought on “Remove Misleading Messages from Job Logs”

    • John Everett says:
      November 30, 2018 at 12:34 pm

      This has probably come up since this was originally posted, but you can control this also by setting the Message logging Level and Severity:
      CHGJOB LOG(4 01 *SECLVL)

      Some combination of the method described in the article above and the LOG() parameters for the job should keep your job logs succinct and useful.

      Reply

    Leave a Reply Cancel reply

Volume 5, Number 7 -- February 16, 2005
THIS ISSUE
SPONSORED BY:

ProData Computer Svcs
iTera
Patrick Townsend & Associates

Table of Contents

  • OPNQRYF and ILE
  • Remove Misleading Messages from Job Logs
  • Admin Alert: Making a Remote Output Queue Look Like a Printer Device

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • The Power11 Transistor Count Discrepancies Explained – Sort Of
  • Is Your IBM i HA/DR Actually Tested – Or Just Installed?
  • Big Blue Delivers IBM i Customer Requests In ACS Update
  • New DbToo SDK Hooks RPG And Db2 For i To External Services
  • IBM i PTF Guide, Volume 27, Number 33
  • Tool Aims To Streamline Git Integration For Old School IBM i Devs
  • IBM To Add Full System Replication And FlashCopy To PowerHA
  • Guru: Decoding Base64 ASCII
  • The Price Tweaking Continues For Power Systems
  • IBM i PTF Guide, Volume 27, Numbers 31 And 32

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle