• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • CL Error-Handling With APIs

    May 2, 2012 Ted Holt

    Note: The code accompanying this article is available for download here.

    I had the great pleasure of meeting Brian Rusch in Milwaukee last month, when I spoke to the Wisconsin Midrange Computer Professionals Association (WMCPA). Brian told me about the method his shop uses to handle CL program exceptions. I’d like to share it with you.

    IBM has established an architecture for exception handling. When a program exception occurs, the system may send one or more diagnostic messages that give information about the error. The system does send an escape message, which summarizes the problem and cancels the program.

    Brian’s method takes advantage of this architecture. Brian has written command interfaces to two IBM-supplied APIs: Move Program Messages (QMHMOVPM); and Resend Escape Message (QMHRSNEM). His command MOVPGMMSG runs QMHMOVPM in order to forward the diagnostic messages to the caller. Brian’s RSNESCMSG command uses API QMHRSNEM to resend the escape message to the caller and cancel the failing program. His exception handling is easily handled with the following code:

    MONMSG CPF0000 EXEC(GOTO ABEND)
    . . . more code . . .
       RETURN
    ABEND:
       MOVPGMMSG  MSGTYPE(*DIAG)
       RSNESCMSG
    

    In 2004, I published a template with roots in the System/38. If you compare this code to the code I published eight years ago, you’ll see that Brian’s code is much shorter and simpler than mine. There are no loops, and five of the variables in my code are not needed in his.

    My hat is off to Brian Rusch for making simple interfaces for two messy APIs. The downloadable source code files contain not only Brian’s command source, but two example programs you can play with. One uses his commands. The other uses a slightly modified version of the template I use in my shop.

    RELATED STORY

    Proper CL Error-Handling



                         Post this story to del.icio.us
                   Post this story to Digg
        Post this story to Slashdot

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    ARCAD Software

    [Webinar Series] Demystifying DevOps on the IBM i

    Join us for this 3-Part Roundtable Webinar Series, where ARCAD experts will demystify the move to Git and an automated process with options that work for everyone!

    This Series will be an engaging discussion on key DevOps topics as Git, Builds, Automation and much more.

    Part 2: Branching & Building (Thursday, February 9th, at 12:00PM ET / 9:00AM PT)

    During this 2nd session, we will discuss Feature/Release and Branch Management and building the branches with tools like Bob and ARCAD.

    Part 3: DevOps – Automated Workflow (Thursday, February 23rd, at 12:00PM ET / 9:00AM PT)

    During this 3rd session, we will discuss what can be automated in the IBM i DevOps process starting from the build to other steps in your workflow.  We’ll discuss pipeline tools like Jenkins and the new automation features of Git packages.

    Register NOW

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    Tembo Application Generation:  Reclaim your heritage with ADSERO OPTIMA!
    Tributary Systems:  Storage Director, a disk-to-disk-to-tape solution. Download the case study.
    COMMON:  Join us at the 2012 Conference & Expo, May 6 - 9 in Anaheim, CA

    IT Jungle Store Top Book Picks

    BACK IN STOCK: Easy Steps to Internet Programming for System i: List Price, $49.95

    The iSeries Express Web Implementer's Guide: List Price, $49.95
    The iSeries Pocket Database Guide: List Price, $59
    The iSeries Pocket SQL Guide: List Price, $59
    The iSeries Pocket WebFacing Primer: List Price, $39
    Migrating to WebSphere Express for iSeries: List Price, $49
    Getting Started with WebSphere Express for iSeries: List Price, $49
    The All-Everything Operating System: List Price, $35
    The Best Joomla! Tutorial Ever!: List Price, $19.95

    Island Pacific Completes ERP Upgrade for Clothing Retailer Apps And IBM i Evangelism

    Leave a Reply Cancel reply

Volume 12, Number 12 -- May 2, 2012
THIS ISSUE SPONSORED BY:

Infor
WorksRight Software
American Top Tools

Table of Contents

  • CL Error-Handling With APIs
  • How Do I Format Date Literals? Let Me Count The Ways
  • Admin Alert: Secrets Of The IBM i IPL Parameters

Content archive

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

Recent Posts

  • Power Systems Did Indeed Grow Revenues Last Year
  • The IBM Power Trap: Three Mistakes That Leave You Stuck
  • Big Blue Decrees Its 2023 IBM Champions
  • As I See It: The Good, the Bad, And The Mistaken
  • IBM i PTF Guide, Volume 25, Number 5
  • N2i Gains Traction Among IBM i Newbies
  • Realizing The Promise Of Cross Platform Development With VS Code
  • 2023 IBM i Predictions, Part 3
  • Four Hundred Monitor, January 25
  • Join The 2023 IBM i Marketplace Survey Webinar Tomorrow

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 © 2022 IT Jungle

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.