Problem solve Get help with specific problems with your technologies, process and projects.

PDM defaults

One of the most tedious tasks for a software developer is ensuring the environment is correct depending upon the project or account they are working with. We must make sure the Library lists, Job Descriptions and PDM options file are set up correctly. PDM, while a wonderful tool has a slight limitation when it comes to library lists. Using F18 (while in PDM) allows you to change your defaults. While implying that you can use *LIBL to store your option file--it is really to assist you in obtaining the file without specifying the library--for if you change your library list it will not necessarily find the PDM option file you had previously defined. IBM has also chosen this approach with its' Query product, while allowing you to specify *LIBL it does not actually make proper use of the library list, it again obtains the library based upon the current library list. While this may be fine for shops that have a fairly common library environment, when you are dealing with multiple customers or if it happens to be your turn to be on call for customer support, this proves to be restrictive.

The tool we use (a simplified version will be discussed here) is our SET command. Within this command, we are able to specify the account/customer code as a parameter and then the CL program sets up your library list, job description and PDM option file. In fact you may NEVER need to press F18 again!


We will assume that we have a standard naming convention for our environments. For simplicity, we will use a three-character code to define our accounts and our libraries will be prefixed with "LIB". Additional enhancements might be necessary to this command to include whether you are working in a Production or Development environment. For account ABC the library list defined in its' job description would look like this:

LIBABC - the data library
LIBABCS - the source and program object library

The job descriptions will also be defined with the account abbreviation as JOBDABC. For the purpose of this tip, we will define these job descriptions as residing in library QGPL. PDM options file will also be defined and stored in the source/program object library. Another tool might be useful that would allow you to create and modify these account specific PDM option files - more on that another time. This PDM option file we will call PDMABC.

Lastly and probably the most important part of this tip, is the defaults defined within the PDM options (F18). Since IBM does not allow us to use the *LIBL as it was intended, and since QTEMP is always in our library list - this is where PDM will get its' options file and job description. The SET command simply places the file and job descriptions in QTEMP and the PDM default screen does the rest! Object Library is *SRCLIB - by not specifying a particular library you always know where your compiled object will be placed Job Description - @@MYJOBD in *LIBL - the SET command replaces it in QGPL so the correct library list will be referenced whether you are running an interactive or batch job. The actual job description is @@ plus the first 8 characters of your user profile. Option File-- PDMOPTIONS in library QTEMP (obviously you will need to run the SET command once to initially place an options file in QTEMP before PDM will allow you to specify it as the default file).

PDM Change Defaults

Using F18 while in PDM set the following values: Object library is defined as *SRCLIB, Job Description shows USERID (but it would actually be your own user ID) and finally the PDM Options file and library QTEMP.
Change Defaults

Type choices, press Enter.

Object library . . . . . . . *SRCLIB Name, *CURLIB, *SRCLIB
Replace object . . . . . . . Y Y=Yes, N=No
Compile in batch . . . . . . Y Y=Yes, N=No
Run in batch . . . . . . . . N Y=Yes, N=No
Save session defaults . . . Y Y=Yes, N=No
Save/Restore option . . . . 1 1=Single, 2=All
Job description . . . . . . USERID Name, *USRPRF, F4 for list
Library . . . . . . . . . *LIBL Name, *CURLIB, *LIBL
Change type and text . . . . N Y=Yes, N=No
Option file . . . . . . . . PDMOPTIONS Name
Library . . . . . . . . . QTEMP Name, *CURLIB, *LIBL
Member . . . . . . . . . . . PDMOPTIONS Name
Full screen mode . . . . . . Y Y=Yes, N=No

F3=Exit F4=Prompt F5=Refresh F12=Cancel

SET Command
CMD PROMPT('Set Account Environment')
Parm kwd(ACCOUNT) type(*SNAME) len(3) dft(ABC) spcval((A ABC) (B BDE)(Z ZYX)) prompt('Select Account')

For simplicity, only the Account parameter is used however additional parameters may be used to assist you in defining Production vs Development environments. In this case, short cuts have been defined within the account key word allowing you to pass 'A' to signify account ABC.

SET CL Program
/* SET. . . . . . Set Environment */

/* Change Library List QTEMP, LIBXXX, LIBXXXS, QGPL */
/* Recreate PDM Options File in QTEMP */
/* Recreate JOB Description for User */

Using the account code entered from the command, the first task is to define and change the library list. Next, take the PDM Options file that is now in the library list of the applicable account and copy it into the QTEMP library. Finally, define the job description and duplicate it using the user id. In addition to saving time each instance where you have to change library lists this command will eliminate keying errors and potential problems that might arise by compiling a program from one account into the library of another etc. Hope you like it! NOTE: I have also placed this as an HTML document on my personal web site thinking it would be easier to read. If you like please take the version from there:

Dig Deeper on RPG iSeries programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.