Category Archives: Introduction
The IBM AS/400 provides an integrated set of Application Development Tools (ADT) to design, develop and maintain applications. One such tool is the Programming Development Manager (PDM) that offers the following:
- Integrated application development environment.
- List-oriented selection of items for development or maintenance.
- Extendable interface to tools through user-defined options.
Another tool is the Source Entry Utility (SEU) that offers a full screen editor providing syntax checking of source statements. PDM is one tool that may be used to access the SEU.
Starting the Editor
Type STRPDM (Start Program Development Manager) on any command line, and press <Enter> . The PDM menu is displayed. Choose option 3 to Work with members. The “Work with members” screen shows up. You can also reach this screen by typing WRKMBRPDM (Work with members using PDM) on any command line and pressing . In either case, supply the necessary source file (SRCFILE) and library (YOURLIB) information and press Enter.
Type 2 and press Enter on the “Opt” line to edit the source member “SRCMBR”. the screen will be like shown.
Type I (for insert) on the first line as shown and press <Enter> .
SEU Line commands
Similarly you can have number of SEU Line commands to perform various operations. Following is a list of valid commands.
- A=After Move or copy records after this record.
- An=After with repeat n times Move or copy records after this record and repeat these records n times.
- B=Before Move or copy records before this record.
- Bn=Before with repeat n times Move or copy records before this record and repeat these records n times.
- C=Copy Line Copy this line to a specified target.
- Cn=Copy n lines Copy this line plus the next n-1 lines to the specified target.
- CC=Block Copy Copy all lines between the boundaries formed by the two CC commands
- CR=Copy records and retain command Copy this record to the specified targets and keep this command on the display.
- CRn=Copy n records and retain command. Copy n records to the specified targets and keep this command on the display.
- CCR=Copy block records and retain command Copy the block of records defined by a pair of CCR commands to the specified targets and keep this command on the display.
- D=Delete Delete the current line.
- Dn=Delete n lines Delete the current line and the next n-1 lines.
- DD=Block Delete Delete all lines between the two DD boundaries.
- F=Display format line
- Display a format line.
- I=Insert a line Insert a blank line after the current record.
- In=Insert n lines Insert n blank lines after this record.
- IP=Insert line and prompt Insert a blank line and display the line in a prompt.
- L=Shift data 1 char left Shift data in this record one character position to the left without losing data.
- Ln=Shift data n chars left Shift data in this record n character positions to the left without losing data.
- LL=Shift block 1 char to the left Shift data defined by the boundary between and including the two LL line commands one character position to the left without losing data.
- LLn=Shift block n chars to the left Shift data defined by the boundary between and including the LLn and LL line commands n character positions to the left.
- M=Move a line Move a line to a specified target.
- Mn=Move n lines Move the current line and the following n-1 lines to a specified target.
- MM=Block Move Move all records between and including the boundaries defined by the MM line commands to a specified target.
- O=Overlay Overlay the current line with the first line defined by the move, copy, or copy repeated line command.
- On=Overlay n lines Overlay this line and the following n-1 lines with the first n lines defined by the move, copy, or copy repeated line command.
- OO=Block overlay Overlay all the records between and including the boundaries defined by two OO line commands with the lines defined by the move, copy, or copy repeated line command.
- P=Display prompt Type P to display this line in a prompt.
- R=Shift data 1 char right Shift data in the current record one character position to the right without losing data.
- Rn=Shift data n chars right Shift data in the current record n character positions to the right without losing data.
- RR=Block shift 1 char to the right Shift data defined by the boundary between and including the two RR line commands one character position to the right without losing data.
- RRn=Block shift n chars to the right Shift data defined by the boundary between and including the RRn and RR line commands n character positions to the right, without losing data.
- RP=Repeat line Repeat the current line once before the following line.
- RPn=Repeat line n times Repeat the current line n times before the following line.
- RPP=Block repeat Repeat all lines defined by the boundary between the two RPP line commands.
- RPPn=Block repeat Repeat all lines defined by the boundary between the two RPP line commands n times.
- SF=Show first record Show the first record of the exclude group.
- SFn=Show first n records Show the first n records of the exclude group.
- SL=Show last record Show the last record of the exclude group
- SLn=Show last n records Show the last n records of the exclude group.
- W=Display member from column 1 Display the member beginning in column 1.
- Wn=Display member from column n Display the member beginning in column n.
- X=Exclude Exclude the current record from the display.
- Xn=Exclude plus Exclude the the current record and the next n-1 records.
- XX=Block Exclude Exclude all lines between the boundaries formed by the two XX line commands.
- + (plus sign)=Roll member forward 1 line Roll the member forward one line.
- +n=Roll member forward n lines Roll the member forward n lines.
- – (minus sign)=Roll member backward 1 line Roll the member backward one line.
- -n=Roll member backward n lines Roll the member backward n lines.
- n=Absolute Positioning Position the line identified by the sequence number(n) as the first record on the display.
SEU commands are entered in the “SEU==>” field at the top of the screen.
Search for an occurrence of a character string. If the string contains embedded blanks, apostrophes, or quotation marks, it should be enclosed in quotation marks. Several direction parameters are available: N (Next), P (Previous), F (First), L (Last), and A (All). The scope of the search can be specified using search parameters: X (excluded records) and NX (non-excluded records). The syntax of FIND is FIND string [N,P,A,F,L] [X,NX] [column parameter]. Examples:
- F XYZ
- F ‘hello there’
- F *ERR A find all syntax errors
- F “‘XYZ'”
Use the F16 “Repeat Find” key to find the next occurrence of a string.
Find all occurrences of a character string and replace it with another string. The syntax is CHANGE fstring cstring [N,P,A,F,L] [X,NX] [column parameter]
Go to the first page of the work screen.
Go to the last page of the work screen.
Save changes and continue editing. SAVE [ [ [ library/ ] file ] member ]
Save changes and exit from edit session. FILE [ [ [ library/ ] file ] member ]
Cancel session and exit session.
See the IBM SEU manual for more information.
- Program Development Manager (PDM) (as400iseries.wordpress.com)
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.
A library list is similar in concept to the “PATH” in Unix and MS-DOS. It specifies which libraries are to be searched and the order in which they are searched when the system looks for an object. A library list is identified by the value *LIBL. A default library list is automatically created by OS/400 for each job started by a user. Your default library, that is the library that has the same name as that as your user profile, is automatically included in your library list. You can display your library list by typing DSPLIBL and press on a command line. The following is the library list for the user “YASIRU”.
Note that you may not have all the libraries in the above list. As you can see, a library list is divided into three parts:
- system portion
- which consists of the libraries that are required to run system functions
- current library
- which by default, is the library that has the same name as your user profile (in this case, the library “YASIRU”). The current library is the first user library that is searched before the rest of the user libraries in the list.
- user portion
- which consists of libraries that holds user objects. Some user libraries, such as QTEMP, QGPL, and QGDDM come with the system while others are locally supplied. In addition, the user can create their own libraries and add them to their library list.
If a user does not specify a library name when requesting an operation on an object, the libraries in the library list are searched for the object (starting with the system libraries, the current library, and the user libraries). For example, assume that the user “YASIRU” has an executable program (*PGM object) called “TESTPROG” in the library “YOURLIB”. User “YASIRU” wants to run the program (using the CALL command) and issues the command CALL TESTPROG. A message will appear stating that the program is not found in the library list. This is because “YOURLIB” is currently not in the library list. If, however, “TESTPROG” is qualified by “YOURLIB” as CALL YOURLIB/TESTPROG then the program can be found and executed.
Add a Library to Library list
To add a library to the library list, type the “Add Library List Entry” (ADDLIBLE) command, followed by the library name (or prompt on the command) ADDLIBLE YOURLIB.
Edit Library List & Change Current Lib
If “YASIRU” now issues the the unqualified CALL command, the program can now be located and executed since the library that contains the program is now in the library list. You can edit your library list using the EDTLIBL command and remove a library list entry using the RMVLIBLE command. “YOURLIB” can be made the current library by typing CHGCURLIB YOURLIB.
Some commands automatically default to the current library (*CURLIB), such as the CRTSRCPF command. Note, however, that both commands (ADDLIBLE and CHGCURLIB) are only effective for a particular session. Next time, when “YASIRU” signs on, “YOURLIB” will no longer be in their library list and hence, no longer the current library.
Although most system functions can be invoked directly by using CL commands, it is generally easier for novice users to take menu paths to describe the task to perform and then let the system choose for appropriate command. For example, let’s use the menu path to create a library. If you entered a 4 (for Files, libraries, and folders) on the command line of the main menu and pressed Enter, you would see the DATA menu shown in below.
(Although the description of this menu is “Files, Libraries, and Folders”, to the operating system its proper object name is “DATA”)
Notice the similarity between the Main menu and the DATA menu. From the DATA menu, you can take choice 2 (Libraries) by typing a 2 on the command line and then pressing the Enter key. Doing so takes you to the LIBRARY menu.
Creating a Library
The description of option 2, “create library”, on the LIBRARY menu suggests that, after three menus, you have just about pinned down what it is you want to do. When you select option 2 from the LIBRARY menu, the system displays the screen shown in below. The system uses this type of screen , generically referred to as an entry screen, to request information from a user.
You can get above prompt screen directly by typing the CRTLIB (“Create Library”) on a command line and pressing . Type in the name of the library and enter a brief description for the library. Leave the library type as *PROD.
Press <Enter>. You should see a message at the bottom of the screen saying “Library … created”. If you see the message “Library … already exists”, it means that some other user already has a library by the same name. Note: All libraries are on the same “level” with only QSYS above them. If you get this message, try another name for the library. Other commands that operate on libraries are:
- DSPLIB (Display Library)
- DLTLIB (Delete Library)
- WRKLIB (Work with Library).
Creating a Source Physical File
Now, let’s create a source physical file in the library that we have just created. To create a source physical file,
- Type CRTSRCPF and press to prompt on it.
- Supply the names for the source file and the library that will hold it.
Below, we show the display for creating a source file called “QCLSRC” in the library “YASIRU”. Press < Enter> and you should see the message “File … created in library …” at the bottom of your screen.
The source code files can have any name but conventionally the names start with Q and end with SRC, for source. Typically:
QCLSRC is the file for the CL program source statements
QDDSSRC is for the DDS program source statements
QRPGSRC is for the old RPG language
QRPGLESRC is for the new RPG/ILE language
QMNUSRC or QMENUSRC is for menus
QCBLSRC or QLBLSRC is for COBOL
QCMDSRC is for commands
You could keep most of the source statements is a single file. That is, one member could have CL source statements and another member could have DDS and another could have RPG source statements. Conventionally though, source code is not mixed up like that.
The first time you log on the AS/400 you will be forced to change your password before continuing.
- Press <Enter>to change your password.
- At the “Current Password” field, type your current password. NOTE: nothing you type on this screen will be displayed to ensure that no one views your password as you type it.
- Press <Tab>or <Field Exit>.
- For the “New Password” field, type the password you would like to use when you sign on to the computer. It must not exceed 10 characters, it must begin with an alphabetic character and the remaining characters may be any combination of alphabetic, numeric characters. Note: Try not to make it too difficult, you will need to know it to sign on the AS/400 again.
- Press <Tab>or <Field Exit>
- At the “New Password (to verify)” field, type in your new password for a second time to make sure you have entered it correctly. If you have entered it incorrectly you will get an error message and your initial password will still be as before.
- Press <Enter>
- Upon completion, the following message will be displayed:
Password changed successfully
- Read the following screens, pressing <Enter>to exit each one, until you reach the AS/400 Main Menu screen.
Later on when you want to change your password, type CHGPWD on the command line and go through the same steps.