Terminating Called Programs

General
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

It is extremely important to terminate called programs properly. Failure to

terminate a called program properly can cause damage to production data if you

think you're using test data to test program modifications.

Suppose your production library list consists of production data files (PRODF)

and production programs (PRODP). Now, suppose your test library list consists

of test data files (TESTF), programs in testing (TESTP), and production

programs (PRODP).

PRODP contains only executable programs, print files, and display files. This

way, duplicates of these objects do not need to be kept in the test libraries.

TESTP contains only programs that are actually in testing. Many shops use

similar library list structures.

Here's how damage can occur.

1. You execute PRODP/PGMA. This program calls PRODP/PGMB, which opens

PRODF/FILE1. Then, PGMB terminates with a RETRN statement. Control is returned

to PGMA, but PGMB remains resident and PRODF/FILE1 remains open.

2. You terminate PRODP/PGMA and set up your test library list to test

modifications to PGMA. PGMB has not been modified.

3. You call TESTP/PGMA, which calls PGMB. Since PGMB is not in testing,

PRODP/PGMB is called. But PRODP/PGMB is already resident, and its files are

open. Therefore, your test affects PRODF/FILE1. You've compromised your

production data, thinking you were in your test environment.

To prevent this problem, make PGMA pass a parameter telling PGMB to set on its

LR indicator. This method may not be practical if this error is widespread

throughout your software (as is the case with some commercially available

software packages.)

Another solution is to execute the Reclaim Resource (RCLRSC) command in the CL

program that calls PGMA. This technique disposes of stray resident programs and

closes the files associated with them.

If you use CL programs to set up your library list, a simple solution is to put

the RCLRSC command at the beginning of those programs. Any stray programs left

over from production processing will be cleaned up before you start testing and

vice versa.

--Sam Stafford

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: