Programs are created from source statements. On the AS/400, source statements are entered using PDM, the Program Development manager. Technically, PDM uses the Source Entry Utility (SEU) as the editor. But you don’t have to think of SEU as something different from PDM.
PDM provides a way to enter program source statements and then to compile the statements into executable programs. The source statements are needed only for the compiler. The compiled programs are the objects that are actually run on the AS/400. The source code and the compiled objects are separate things. But it is easy to confuse the two. At times, you may try to open the compiled object with PDM when you really mean to open the source code used to create the compiled object.
Source code is kept in a member of a file. The file is kept in a library. Each file can have many members. Each member is the source code for a program.
PDM may either be started using the command STRPDM (for Start PDM,) which will produce a menu of options for the level on which the user wishes to work (libraries, objects, or members,) or using one of three commands which indicate the level at which the user would like to work:
- WRKLIBPDM — Work with libraries using PDM
- WRKOBJPDM — Work with objects using PDM
- WRKMBRPDM — Work with file members using PDM
Work with Objects
One of the most commonly used commands to start PDM is WRKOBJPDM. This allows the user to work with objects inside a library. Type WRKOBJPDM and press to prompt on it.
The *PRV value on the “Library” field indicates that the default is to work on the library the user last worked with. These may be replaced with the name of a specific library. The “Object” and “Object type” options allow the user to limit which objects will be displayed.
The screen resulting from command WRKOBJPDM, with the library specified as YASIRU, and *ALL on the other options, is shown below.
Options are displayed across the top of the screen (for a list of all the options available in PDM, see Table 1 at the end of this section.) Each option is an action which may be performed on an object by placing its number on the “Opt” line next to the object and pressing the < Enter> key. This method of specifying actions on a form listing the objects available is consistent throughout PDM.
There are two important special features which this method of specifying actions offers: First, the options support the prompting facility, and second, multiple objects may be operated on in succession. To use the prompting facility, simply press while an option number is on one of the “Opt” lines. PDM will present the prompt screen for the command associated with that option number. Multiple objects may be operated on sequentially by placing numbers on more than one Opt line. For example, assume we have two source files in “YASIRU”. You can type “5” (Display) against one and type “7” (Rename) against the other. Pressing causes PDM to process each option in turn.
More on PDM levels
Moving down levels in PDM is accomplished using the “12” (Work With…) option. At the WRKOBJPDM screen, the action of this option depends on the file type. Placing a 12 on the line next to an item on this display will:
- If the item is of type *FILE, go to the WRKMBRPDM display for that file (there are different types of WRKMBRPDM displays for source and data files.)
- If the item is of type *OUTQ, go to the “Work With Output Queue” display, allowing the user to work with spooled files.
- If the item is of type *PGM, present a display allowing the user to call the program, change its attributes, etc. (programs may also be called from the WRKOBJPDM screen by using the 16 option.)
When this method of changing levels is used, pressing <Enter> or <F12> (cancel) with no options on the screen returns to the previous level.
Work with Members
The WRKMBRPDM display is the bottom level of PDM. When working with a source physical file at this level, option 2 runs the STRSEU command to begin editing a member and 14 calls the compiler for a program of that type (if specific compiler options are needed, for instance the *DEBUG option to include debugging information in the program, remember that the prompting facility may be invoked on any PDM option.) When working with a physical data file, the “2=change” option is no longer valid. However, the “18” option may be invoked to modify the file using DFU (Data File Utility).
Type “12” against “SRCFILE” to work with it. The following “Work with Members using PDM” screen appears:
Presently, there are no members in “QCLSRC”. Let’s create a member. To do that, press (Create). This will automatically invoke the SEU editor. Enter the name of the new source member and for its source type, enter “TXT” (i.e. the source member will contain only plain text). Press .
You will now be inside the SEU editor. For now, press to quit and type “Y” in the “Change/Create member” field to save the source member. On return to the WRKMBRPDM screen, you will notice that “SRCMBR” is now in “SRCFILE”.
The “Work with Members using PDM” screen can be accessed directly using the WRKMBRPDM command. Type this command and press to prompt on it. To work with the member that we have just created, enter the names of the library and file as shown below. If you have many members in your file, you can use the “Member” and/or “Member Type” fields to narrow down the number of members to work with.