• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Two Handy Programs

    November 16, 2005 Ted Holt

    I get quite a bit of email from readers who say they have found something in Four Hundred Guru to be of help to them. I appreciate their taking time to let me know. Today I present two CL programs that I would be hard-pressed to do without. I hope some of you will find them helpful too.

    Here’s the first one, DUMMY1.

    pgm   
    return
    

    Do you like it? At two lines, it would be hard to make a keying error when typing it in, wouldn’t it? I don’t think it matters what activation group it runs in, but I compile it to run in the caller’s activation group.

    CRTBNDCL PGM(mylib/DUMMY1)        
       SRCFILE(mylib/QCLSRC)
       SRCMBR(DUMMY1) 
       DFTACTGRP(*NO)         
       ACTGRP(*CALLER)
    

    I use DUMMY1 for program testing. Suppose I am modifying a CL program that calls a lot of programs, some of which I do not want to run during testing. Maybe some of the called programs take a long time to run and I only want to test the changed logic in the calling program. Maybe one of the programs does something I don’t want to be done, such as sending a fax. In such cases, I clone DUMMY1 as many times as is necessary, creating the clones in QTEMP or one of my development libraries and giving them the same names as the programs that I do not want to run.

    Suppose the program I am modifying looks like this:

    PGM
    CALL       PGM(SOMEPGM)
    

    But I want it to look like this:

    PGM
    CALL       PGM(SOMEPGM)
    SNDPGMMSG  MSG('Program SOMEPGM completed normally') +
                 MSGTYPE(*COMP)
    

    Program SOMEPGM does not need to run in order for me to verify that the SNDPGMMSG command works properly, so I clone DUMMY1.

    CRTDUPOBJ OBJ(DUMMY1) FROMLIB(MYLIB) OBJTYPE(*PGM) +
              TOLIB(QTEMP) NEWOBJ(SOMEPGM)
    

    When the program I’m testing calls SOMEPGM, it calls the copy in QTEMP, which is always at the top of my library list, rather than the copy in the production library.

    Sometimes I like to know that the dummy program ran, even though it didn’t do anything. In those cases, I prefer to use the second program, which I cleverly call DUMMY2.

    pgm                                                            
                                                                   
    dcl   &MsgKey        *char      4                        
    dcl   &PgmName       *char     10                        
    dcl   &Sender        *char     80                        
                                                                   
    /* Determine the name of this program. */                      
                                                                   
    sndpgmmsg   msg('Dummy message') topgmq(*same) +         
                  msgtype(*info) keyvar(&msgkey)             
    rcvmsg      pgmq(*same) msgtype(*info) msgkey(&MsgKey) + 
                  rmv(*yes) sender(&Sender)                  
    chgvar      var(&PgmName) value(%sst(&Sender 27 10))     
                                                                   
    sndmsg      msg('Program' *bcat &PgmName *bcat +         
                          'is running.') tousr(*requester)         
    endpgm
    

    Like DUMMY1, DUMMY2 does no processing of any kind. However, it does have the courtesy to let me know it’s running. When my clone of DUMMY2 runs, I get a message on my screen: Program SOMEPGM is running.

    Create DUMMY2 according to the compilation instructions for DUMMY1.


    Let me add a couple more comments. First, the programs that these CL programs replace do not have to be CL programs. In the example given above, I did not mention what language SOMEPGM was written in. It didn’t matter.

    Second, testing is an art in itself, and entire books have been written about the subject. Too much software is installed without adequate testing, but fortunately, simple techniques, like the use of do-nothing programs, can make the testing process easier.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    WorksRight Software

    Do you need area code information?
    Do you need ZIP Code information?
    Do you need ZIP+4 information?
    Do you need city name information?
    Do you need county information?
    Do you need a nearest dealer locator system?

    We can HELP! We have affordable AS/400 software and data to do all of the above. Whether you need a simple city name retrieval system or a sophisticated CASS postal coding system, we have it for you!

    The ZIP/CITY system is based on 5-digit ZIP Codes. You can retrieve city names, state names, county names, area codes, time zones, latitude, longitude, and more just by knowing the ZIP Code. We supply information on all the latest area code changes. A nearest dealer locator function is also included. ZIP/CITY includes software, data, monthly updates, and unlimited support. The cost is $495 per year.

    PER/ZIP4 is a sophisticated CASS certified postal coding system for assigning ZIP Codes, ZIP+4, carrier route, and delivery point codes. PER/ZIP4 also provides county names and FIPS codes. PER/ZIP4 can be used interactively, in batch, and with callable programs. PER/ZIP4 includes software, data, monthly updates, and unlimited support. The cost is $3,900 for the first year, and $1,950 for renewal.

    Just call us and we’ll arrange for 30 days FREE use of either ZIP/CITY or PER/ZIP4.

    WorksRight Software, Inc.
    Phone: 601-856-8337
    Fax: 601-856-9432
    Email: software@worksright.com
    Website: www.worksright.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    IBM Unveils New Midrange Storage Systems QlikTech Targets iSeries Base with Business Intelligence App

    Leave a Reply Cancel reply

Volume 5, Number 43 -- November 16, 2005
THIS ISSUE
SPONSORED BY:

T.L. Ashford
Advanced Systems Concepts
WorksRight Software

Table of Contents

  • API Corner: Backup APIs
  • Two Handy Programs
  • Admin Alert: Darn Good FTP Commands You’ve Probably Never Heard Of

Content archive

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

Recent Posts

  • To Comfort The Afflicted And Afflict The Comfortable
  • How FalconStor Is Reinventing Itself, And Why IBM Noticed
  • Guru: When Procedure Driven RPG Really Works
  • Vendors Fill In The Gaps With IBM’s New MFA Solution
  • IBM i PTF Guide, Volume 27, Number 27
  • With Power11, Power Systems “Go To Eleven”
  • With Subscription Price, IBM i P20 And P30 Tiers Get Bigger Bundles
  • Izzi Buys CNX, Eyes Valence Port To System Z
  • IBM i Shops “Attacking” Security Concerns, Study Shows
  • IBM i PTF Guide, Volume 27, Number 26

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