Home > AS/400 Tips > iSeries administrator tips > Clean up programs and procedures to increase data and application integrity -- part 1
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES ADMINISTRATOR TIPS

Clean up programs and procedures to increase data and application integrity -- part 1


Ron Turull
06.06.2006
Rating: -4.60- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



Ron Turull
How many times have you had an application fail and, as a result, been faced with not only trying to figure out what went wrong with the application, but also trying to piece together data that had been left incomplete by the program crash? If your shop is like most, the answer is probably more times than you care to remember.

RPG with Integrated Language Environment (ILE) provides new ways to trap errors and perform program clean-up during unexpected program endings. These new methods are another example of why it is called the Integrated Language Environment -- they are language independent.

What's wrong with the "old" way?

Most Original program model (OPM) languages do have some sort of mechanism for trapping errors and controlling abnormal program ending. And, commitment control, when properly used, does provide a good degree of data integrity. However, both of these approaches have some serious drawbacks.

First, inherent mechanisms for trapping errors are not very robust and are fairly clumsy. Plus, since the mechanisms are language dependent, you must learn and use a different method for each language. Second, using commitment control is complicated at best for most shops. It also slows the system and can eat disk space if not properly managed.

Benefits of the ILE clean-up method

It should be made clear that you can write the code that performs the actual clean-up in any (ILE) language. It is the mechanism you use to connect your clean-up code to a program that involves the use of language-independent ILE features. Once you make the connection between the application program and the "clean-up" procedure, the system will call the "clean-up" procedure any time the associated program ends for any reason other than a normal return to caller. This includes the following events:

  • The program receives an error and the user chooses "cancel."


  • The program does not handle an ILE condition and ends as a result (condition is a generic ILE term for the AS/400-iSeries term exception.


  • The activation group in which the program is running is ended abnormally or manually in a controlled manner.


  • The job in which the program is running is ended by someone using the ENDJOB command.


  • The job in which the program is running is ended by a system or subsystem shutdown.


  • How to set up a clean-up procedure

    In ILE, clean-up procedures are called termination exit procedures. They may be associated with any call stack entry, which means they are associated with a procedure and not an entire program. You use the CEERTX API (Register Call Stack Entry Termination User Exit Procedure ) to associate a clean-up procedure to a particular call stack entry. The clean-up procedure is associated with the call stack entry (i.e., the procedure) that calls the CEERTX API. The API accepts the following three parameters:

  • Exit procedure (procedure pointer). A pointer to the clean-up procedure. The system calls your clean-up procedure via this pointer.


  • Token (data pointer). A pointer to any data item you want passed to your clean-up procedure when it is called. The clean-up procedure receives this pointer so it can then access the data item, which should be part of the associated application procedure. You can use this data item to transmit any information you want to the clean-up procedure. This is an omissible parameter.


  • Feedback code (character). The standard ILE 12-byte feedback code data structure. This is an omissible parameter; if omitted, the CEERTX API will send exceptions to the caller.


  • In the next installment, you'll see this API in action, and we'll discuss a couple of example cleanup procedures that you will be able to use as templates.

    -----------------------------------
    About the author: Ron Turull is editor of Inside Version 5. He has more than 20 years' experience programming for and managing AS/400-iSeries systems.


    Rate this Tip
    To rate tips, you must be a member of Search400.com.
    Register now to start rating these tips. Log in if you are already a member.


    Submit a Tip




    Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



    RELATED CONTENT
    iSeries administrator tips
    Analyze the health of your IBM i server with iScore
    Researching high availability for your System i shop
    Translating Linux for IBM i admins: Using GUI to make it easy
    Translating Linux for IBM i admins: Working with jobs and networking
    OpenOffice: What to know before making the transition from Microsoft Office
    OpenOffice: An enterprise open source solution
    Database performance comparisons on IBM i
    Translating Linux for IBM i admins: User profile commands
    Modern System i reports using Client Access
    Tips for installing Lotus Domino server on a System i partition

    RELATED RESOURCES
    2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
    Search Bitpipe.com for the latest white papers and business webcasts
    Whatis.com, the online computer dictionary

    DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



    iSeries Security - Security Tools, Physical Security and System Security
    HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
    About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
    SEARCH 
    TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

    TechTarget Corporate Web Site  |  Media Kits  |  Site Map




    All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
      TechTarget - The IT Media ROI Experts