Working Smarter

Tips for Working Smarter and More Efficient

1 - Check for an empty file

To check whether a file is empty you always have to open the file physically and attempt to read data. Even for members of a partitioned data set you cannot rely on the ISPF statistics as they may be manipulated by special ISPF services or have been corrupted by a batch job updating the file.

Here are some solutions using different approaches, namely IDCAMS, SORT, ICETOOL, SYNCTOOL, FILEAID, IEBPTPCH, SUPERC, EASYTRIEVE, REXX, and FILEMANAGER:

2 - Homemade Encryption

Here are two simple methods to do encryption by yourself.

The first example is a REXX algorithm for simple (but relatively robust) encryption. The second example explain the encryption capability of IDCAMS:

3 - Generic Delete of Data Sets

Two batch methods to delete a bunch of data sets with a specific high level qualifier pattern.

The first job uses a sequence of utility steps (IDCAMS, SORT). The second sample invokes the ADRSSU utility:

4 - Wait For A Specific Time Period in COBOL

Although I can't think of any good reason to wait for a specific time period in batch jobs, I came across this requirement a couple of times. Nevertheless I still think it indicates a poor design.

But here are two solutions (batch COBOL) for this without consuming any CPU:

5 - Dynamic File Allocation in COBOL

With BPXWDYN you can allocate and free datasets dynamically. It's interface is easy to use and very similar to plain JCL DD-statement parameters. The documentation includes samples for invoking BPXWDYN from a C program and a REXX program.

Here is an implementation in COBOL for allocating a dataset, writing some data, and freeing the dataset:

6 - ForeGround REXX Compile

When developing REXX programs most people don't use the corresponding compiler. In fact there are only a few reasons to use this tool. And most developers prefer the interpreter to speed up their development cycle.

But to ensure some kind of "static quality" for your program source you can invoke the REXX compiler only to let him scan the code and throw some messages.

Extra tip: Look at File # 695 Useful REXX execs from J.D. Acevedo on the CBTTAPE.ORG site to get the program on which my solution is based. This archive also contains a few other useful utilities.

My solution is implemented as an ISPF Edit macro for ease-of-use.

7 - Create multiple ISPF screens with predefined screen names and start-up apps

Since z/OS 01.10 the SWAPBAR command allows to have a list of point-and-shoot fields at the bottom of the screen. These fields, intended to jump directly to another screen, are labelled with the screen name. The screen name on the other hand can be set by the invoking program (see syntax of ISPEXEC SELECT) or by use of the SCRNAME command. Both methods do not allow an individual and easy-to-use definition of screen names and hence impede the use of the SWAPBAR feature.

I have developed a small REXX program which allows you to define your initial applications together with a meaningful screen name. It splits the screen as often as necessary, invokes the desired application, sets the screen name, swaps back to your initial screen and activates the SWAPBAR. So this tool is designed for being used as an initial script which you normally invoke once a day.

8 - Automatically purging of job output in case of successful job termination

Sometimes you don't want to flood the JES output queue with thousands of output lines which are of no interest to anybody because the job ran fine and there is no need to check the output. But in case the job crashes you definitely would need the output.

How to solve this issue?

Simply insert this line after the JOB statement and before any EXEC statement:

//HOLD OUTPUT JESDS=ALL,DEFAULT=Y,OUTDISP=(PURGE,HOLD)

This causes JES to delete the job output when the job finished successfully. In case of an ABEND the job output is retained.

If you need this functionality controlled by a step return code, add a step which calls ILBOABN0 if a specific predecessor step issues this RC.