Tuesday, 28 August 2012

Work with Libraries

Briefly, the WRKLIBPDM command lets you work with a library or libraries. You will probably use this command least among the three PDM commands. You can work with the contents of a library by typing 12 against it. This will bring up the "Work with Objects using PDM" screen for that library.

Table 1: Options in PDM (Some options may not be valid at some levels.)

 2: Change              Modify an object or edit a source member
 3: Copy                Duplicate an object
 4: Delete              Remove an object from storage
 5: Display             Display the contents of an object
 6: Print               Copy a source member to an output queue
 7: Rename              Change an object's name
 8: Display Descrip.    Show summary information about an object
 9: Save                Save an object to offline storage
10: Restore             Retrieve an object from offline storage
11: Move                Move an object to another library
12: Work With           Perform operations on the contents of an object
13: Change Text         Change the text description line for an object
14: Compile             Compile a source physical file member
15: Copy File           Copy a *FILE object (has special options)
16: Run                 Run an object of type *PGM
17: Change Using SDA    Change a screen design (in a PF-SRC) using SDA
18: Change Using DFU    Use DFU to change a PF-DTA member
25: Find String         Find a string of characters in an object

Table 2: Function Keys in PDM

 F1: Help                Obtain help on an area of PDM
 F3: Exit                Exit PDM or current operation
 F4: Prompt              Display prompt screen for options on screen
 F5: Refresh             Redraw the screen with updated information
 F6: Create              Create a library, file, or member
 F9: Retrieve            Recall a previous command to the command line
F10: Command Entry       Display an OS/400 command entry screen
F11: Display Toggle      Switch to/from brief display mode
F12: Cancel              Cancel an operation
F13: Repeat              Copy an option number to all lines
F14: Source Type Toggle  Switch between date and type display in PF-SRC
F15: Sort                Change member list sort criteria
F16: User Options        Specify user-defined commands to PDM
F17: Subset              Limit the list on the screen to certain types
F18: Change Defaults     Change PDM user settings
F21: Print List          Print the object list on the screen
F23: More Options        Display more PDM option numbers, if available
F24: More Keys           Display more function keys, if available

Control Language Command Syntax

The purpose of this section is to provide a more formal presentation of CL commands. As you would probably know by now, a CL command is a way of of invoking functions and calling system services. A CL command is made up of two parts: (1) a command name and (2) parameters.

Command Structure

First, let's consider the command name. A command is made made up of two components:
  1. a VERB and
  2. a SUBJECT. The verb consists of three characters and is the "action" component of the command. Some common verbs and their meanings are shown below:
    • ADD - Add Item
    • CHG - Change
    • CPY - Copy
    • CRT - Create
    • DLT - Delete
    • DSP - Display item
    • END - Stop a program which was started with a STR
    • GRT - Grant
    • MOV - Move
    • RMV - Remove item
    • RST - Restore
    • RTV - Retrieve
    • RVK - Revoke
    • SET - Set
    • SND - Send
    • STR - Start (a program or utility)
    • WRK - Work with
The subject component of the command specifies the item that the verb acts on. Some examples of verb/subject combinations are:
  • CRTSRCPF - Create Source Physical File
  • WRKOBJPDM - Work with Objects Using PDM
  • STRPDM - Start PDM
  • ADDLIBLE - Add Library List Entry
CL commands can be found in several ways. The command GO CMDxxx can be used to get a menu of commands related to xxx (where xxx can be a verb or subject). Another way of finding commands is to press <F4> on any command line. This will bring up the "Command Grouping Menu" where each option represents a group of related commands. The first option SLTCMD ("Select Command by Name") can be used to obtain a list of commands using a wildcard character (e.g. SLTCMD CR* will list all commands starting with CR).

Parameters

A CL command can have zero, one, or more parameters. A command may have some parameters that are required and some that are optional. A system-defined default value (prefixed by "*") is usually assigned to an optional parameter if the user does not specify a value for it.
So far in this manual, we have been using the <F4> prompt facility for specifying parameters. Another way of specifying parameters is the free format or command line method. You may want to use this method if you remember exactly what parameter information is needed for a command. Using this method, parameters can be specified in:
  1. keyword form,
  2. positional form, or
  3. a combination of both.
A parameter that is specified in keyword form will have a keyword followed immediately by a value (or list of values). For example, WRKOBJPDM LIB(YOURLIB) OBJ(SRCFILE) There must not be any blanks between the keyword and the left parenthesis. Parameters in keyword form can be specified in any order.
In the positional form, parameters are specified without keywords. The parameter values must be positionally matched with the keywords in the parameter set for that command. The above example can be specified in positional form as follows WRKOBJPDM YOURLIB SRCFILE.
Positional parameters are often limited to the first three or four parameters. If you do not want to specify a value for one of the parameters, the system-defined value, *N, can be entered in the position of that parameter. For example, the following command will display all objects of type *FILE in the library YOURLIB. WRKOBJPDM YOURLIB *N *FILE *N will map to the default value for that parameter, which in this case is *ALL. Note that when using the WRKMBRPDM command, the file name and library name fields are actually one parameter (a file name plus a library qualifier). If the reference is to a file in a specific library, the file name must be qualified with a slash, "/", character in both keyword and positional forms WRKMBRPDM YOURLIB/SRCFILE SRCMBR WRKMBRPDM FILE(YOURLIB/SRCFILE) MBR(SRCMBR)
If only the file name is specified, as in the following statement WRKMBRPDM SRCFILE the library qualifier will default to the library list (*LIBL).
A CL command can use a combination of both positional and keyword parameters, for example WRKMBRPDM YOURLIB/SRCFILE MBRTYPE(TXT). Note that the "Member" parameter, which is in between the second and third parameters in the parameter set, is omitted. One restriction of this mixed form of specifying parameters is that positional parameters cannot follow keyword parameters. For example, the following is invalid WRKOBJPDM LIB(YOURLIB) SRCFILE.

Using the SEU Editor

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.
In this SEU tutorial, we will use the source member we created in the previous section.

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 <F4> . In either case, supply the necessary source file (SRCFILE) and library (YOURLIB) information and press Enter.
Type 2 on the "Opt" line to edit the source member "SRCMBR".
Press <Enter> . You are now in the full-screen EDIT mode.
 Columns . . . .:   1  80                                          Edit
 SEU==>_______________________________________________________     SRCMBR

 FMT **  ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5...+... 6 ...+.

        *************** Beginning of data ********************************
'''''''
'''''''
'''''''
'''''''
'''''''
'''''''
'''''''
        ****************** End of data ***********************************

 F3=Exit                   F4=Prompt                 F5=Refresh
 F10=Top                   F11=Bottom                F24=More keys

If you press <Enter> without typing anything, the screen readjusts as shown:

 Columns . . . .:   1  80                                          Edit
 SEU==> _______________________________________________________    SRCMBR

 FMT **  ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5...+... 6 ...+.

        *************** Beginning of data *********************************
        ****************** End of data ************************************



 F3=Exit                   F4=Prompt                 F5=Refresh
 F10=Top                   F11=Bottom                F24=More keys

Type I (for insert) on the first line as shown and press <Enter> .

 Columns . . . .:   1  80                                          Edit

 SEU==> _______________________________________________________    SRCMBR

 FMT **  ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5...+... 6 ...+. I
        *************** Beginning of data *********************************
        ****************** End of data ************************************



Now, you may start typing in the desired text. Below, we show a sample TEXT document that will be used in the next section for illustrating the use of various SEU line commands.

 Columns . . . .:   1  80                                            Edit

 SEU==> _________________________________________________________    SRCMBR

 FMT **  ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5...+... 6 ...+.
        *************** Beginning of data *********************************
0001.00          THIS  IS  A  TEXT  DOCUMENT.
0002.00
0003.00          Begin  First Block.
0004.00            Text for the first block ...
0005.00          End  First Block.
0006.00
0007.00          Begin  Second Block.
0008.00                 Text  for  second  block ...
0009.00          End  Second Block.
0010.00
       ****************** End of data ************************************


Notice the sequence numbers of records at the extreme left. The sequence number field of a record is used to specify the line commands. For more information on line commands see 'Using SEU line commands'.
To save the current member and exit SEU follow the following procedure 'Exiting the Editor.'

Exiting the Editor

To exit SEU press <F3>. The exit display shows up:

                                    Exit

 Type choices, press Enter.

   Change/create member  . . . . . . .   Y            Y=Yes, N=No
     Member  . . . . . . . . . . . . .   SRCMBR____   Name
     File  . . . . . . . . . . . . . .   SRCFILE___   Name
       Library . . . . . . . . . . . .   YOURLIB___   Name
     Text  . . . . . . . . . . . . . .   Description_for_the_member._____
     Resequence member . . . . . . . .   Y            Y=Yes, N=No
       Start . . . . . . . . . . . . .   0001.00___   0000.01 - 9999.99
       Increment . . . . . . . . . . .   01.00____    00.01 - 99.99
   Print member  . . . . . . . . . . .   N            Y=Yes, N=No
   Return to editing . . . . . . . . .   N            Y=Yes, N=No
   Go to member list . . . . . . . . .   N            Y=Yes, N=No

 F3=Exit       F5=Refresh       F12=Cancel

If you wish to save the changes you have made, you may simply press < Enter> .
The default values supplied for most of the options above are self-explanatory. However, note the following:
  • If you have decided not to quit the editor, press <F12> to cancel the exit display. This returns you back to the editing mode.
  • The default value for 'Change/create member' is Y, if the member is modified, otherwise N. Type N in this field only if you do not want to save changes made to your member.
  • The default value for 'Return to editing' option is N, if your member did not have any syntax errors. However, if syntax errors do persist, the system supplies Y in this field and returns back to the editing mode ( unless you explicitly type N and force it to exit ).

Using Line Commands

SEU supports various line commands that guide us in editing an existing member. For example, command C is used to copy lines, command M for moving lines and so on. The SEU line commands are entered over the digits that make up the sequence number of a record. In the following discussion, a sample TEXT document is used to illustrate the use of the various commands. Note: If you type a line command, and then you decide to cancel it, use <F5> to refresh the screen.
To edit a member that has already been created,
  • Use the command WRKMBRPDM as explained in the previous section, reach the 'Work with members using PDM' display.
  • Use the tab keys to position the cursor at the desired member, and type option 2. The screen for editing that member will show up.
For example, to edit the member SRCMBR created before, type WRKMBRPDM YOURLIB/SRCFILE on any command line, and press < Enter> . From the "Work with members using PDM" display, type option 2 in front of member SRCMBR and press <Enter> . The edit display for this member is shown:


 Columns . . . .:   1  71                Edit              YOURLIB/SRCFILE

 SEU==> _________________________________________________________ SRCMBR
 FMT CB
......-A+++B++++++++++++++++++++++++++++++++++++++++++++++++++++++
        *************** Beginning of data ********************************
0001.00        THIS  IS  A  TEXT  DOCUMENT.
0002.00
0003.00        Begin  First Block.
0004.00            Text for the first block ...
0005.00        End  First Block.
0006.00
0007.00        Begin  Second Block.
0008.00               Text  for  second  block ...
0009.00        End  Second Block.
0010.00
        ****************** End of data ***********************************

 F3=Exit                   F4=Prompt                 F5=Refresh
 F10=Top                   F11=Bottom                F24=More keys

Inserting a line

To insert a line after a particular record, type I (insert) on the sequence number field of that record, and press <Enter> .

        *************** Beginning of data ********************************

I001.00        THIS  IS  A  TEXT  DOCUMENT.
0002.00
0003.00        Begin  First Block.
0004.00            Text for the first block ...
0005.00        End  First Block.
0006.00
0007.00        Begin  Second Block.
0008.00               Text  for  second  block ...
0009.00        End  Second Block.
0010.00
        ****************** End of data ***********************************

 F3=Exit                   F4=Prompt                 F5=Refresh
 F10=Top                   F11=Bottom                F24=More keys

The screen adjusts as shown below. Type in the line to be inserted and press <Enter> .

 Columns . . . .:   1  71                Edit YOURLIB/SRCFILE
 SEU==> ________________________________________________________  SRCMBR
FMT CB
......-A+++B+++++++++++++++++++++++++++++++++++++++++++++++++++++ +
        *************** Beginning of data ********************************
0001.00        THIS  IS  A  TEXT  DOCUMENT.
'''''''        PROGRAM-ID.   SAMPLE.
0002.00
0003.00        Begin  First Block.
0004.00            Text for the first block ...
0005.00        End  First Block.
0006.00
0007.00        Begin  Second Block.
0008.00               Text  for  second  block ...
0009.00        End  Second Block.
0010.00
        ****************** End of data ***********************************

 F3=Exit                   F4=Prompt                 F5=Refresh
 F10=Top                   F11=Bottom                F24=More keys

Copying a line

To copy the "Begin First Block" line to the end of the program, type C (copy) in the sequence number field, and press Enter. Note the message on the top that indicates a pending Copy line command.

 Columns . . . .:   1  71                Edit YOURLIB/SRCFILE
 SEU==> _________________________________________________________   SRCMBR
 FMT CB
......-A+++B++++++++++++++++++++++++++++++++++++++++++++++++++++++
        *************** Beginning of data ********************************
0001.00        THIS  IS  A  TEXT  DOCUMENT.
0001.01        It illustrates the use of SEU line commands.
0002.00
C              Begin  First Block.
0004.00            Text for the first block ...
0005.00        End  First Block.
0006.00
0007.00        Begin  Second Block.
0008.00               Text  for  second  block ...
0009.00        End  Second Block.
0010.00
        ****************** End of data ***********************************

Type A (after) on the last line as shown, and press Enter. This results in the pending line to be copied after the line you have indicated.

 Columns . . . .:   1  71                Edit              YOURLIB/SRCFILE
 SEU==> __________________________________________________________  SRCMBR
 FMT CB
......-A+++B++++++++++++++++++++++++++++++++++++++++++++++++++++++
        *************** Beginning of data********************************
0001.00        THIS  IS  A  TEXT  DOCUMENT.
0001.01        It illustrates the use of SEU line commands.
0002.00
C              Begin  First Block.
0004.00            Text for the first block ...
0005.00        End  First Block.
0006.00
0007.00        Begin  Second Block.
0008.00               Text  for  second  block ...
0009.00        End  Second Block.
A010.00
        ****************** End of data ************************************

The program looks as shown below, after the copy. To move a single line, use the command M (move) and follow the procedure as explained above for copy.

        *************** Beginning of data ********************************
0001.00        THIS  IS  A  TEXT  DOCUMENT.
0001.01        It illustrates the use of SEU line commands.
0002.00
0003.00        Begin  First Block.
0004.00            Text for the first block ...
0005.00        End  First Block.
0006.00
0007.00        Begin  Second Block.
0008.00               Text  for  second  block ...
0009.00        End  Second Block.
0010.00
0011.00        Begin  First Block.
        ****************** End of data ***********************************

Deleting a line

To delete a line, type D (delete) in front of it and press <Enter> . The line that was just copied may be deleted as shown below:

         *************** Beginning of data*****************************
0001.00        THIS  IS  A  TEXT  DOCUMENT.
0001.01        It illustrates the use of SEU line commands.
0002.00
0003.00        Begin  First Block.
0004.00            Text for the first block ...
0005.00        End  First Block.
0006.00
0007.00        Begin  Second Block.
0008.00               Text  for  second  block ...
0009.00        End  Second Block.
0010.00
D011.00        Begin  First Block.
        ****************** End of data ***********************************

Block Move

To move a block, type MM at the beginning and the end of the block, and press <Enter> . Now, the target for the move has to be specified. The Block Move is illustrated below; the first block of text being moved after the second one.

         *************** Beginning of data ********************************
0001.00        THIS  IS  A  TEXT  DOCUMENT.
0001.01        It illustrates the use of SEU line commands.
0002.00
MM             Begin  First Block.
0004.00            Text for the first block ...
0005.00        End  First Block.
MM
0007.00        Begin  Second Block.
0008.00               Text  for  second  block ...
0009.00        End  Second Block.
0010.00
        ****************** End of data ***********************************

Type A on the last line to move the block to the end of the program.

        *************** Beginning of data ********************************
0001.00        THIS  IS  A  TEXT  DOCUMENT.
0001.01        It illustrates the use of SEU line commands.
0002.00
MM             Begin  First Block.
0004.00            Text for the first block ...
0005.00        End  First Block.
MM
0007.00        Begin  Second Block.
0008.00               Text  for  second  block ...
0009.00        End  Second Block.
A010.00
        ****************** End of data ***********************************

Here is the member after the move:

        *************** Beginning of data ********************************
0001.00        THIS  IS  A  TEXT  DOCUMENT.
0001.01        It illustrates the use of SEU line commands.
0002.00
0007.00        Begin  Second Block.
0008.00               Text  for  second  block ...
0009.00        End  Second Block.
0010.00
0011.00        Begin  First Block.
0012.00            Text for the first block ...
0013.00        End  First Block.
0014.00
        ****************** End of data ***********************************

Block Copy

Enclose the block to be copied within CC commands, and specify the target. The block copy resembles the block move explained above. Note below, that B is specified as the target, to copy the block before the indicated line.

        *************** Beginning of data ********************************
0001.00        THIS  IS  A  TEXT  DOCUMENT.
0001.01        It illustrates the use of SEU line commands.
0002.00
CC             Begin  Second Block.
0008.00               Text  for  second  block ...
0009.00        End  Second Block.
CC
0011.00        Begin  First Block.
0012.00            Text for the first block ...
0013.00        End  First Block.
B
        ****************** End of data ***********************************

Block Delete

To delete a block, enclose it within DD commands and press <Enter> . The block that was just copied may be deleted as shown:

        *************** Beginning of data ********************************
0001.00        THIS  IS  A  TEXT  DOCUMENT.
0001.01        It illustrates the use of SEU line commands.
0002.00
0007.00        Begin  Second Block.
0008.00               Text  for  second  block ...
0009.00        End  Second Block.
0010.00
0011.00        Begin  First Block.
0012.00            Text for the first block ...
0013.00        End  First Block.
DD             Begin  Second Block.
0013.02               Text  for  second  block ...
0013.03        End  Second Block.
DD
0014.00
        ****************** End of data ***********************************

The source member looks as follows, after our experimentation with the above line commands:

       *************** Beginning of data ********************************
0001.00        THIS  IS  A  TEXT  DOCUMENT.
0001.01        It illustrates the use of SEU line commands.
0002.00
0007.00        Begin  Second Block.
0008.00               Text  for  second  block ...
0009.00        End  Second Block.
0010.00
0011.00        Begin  First Block.
0012.00            Text for the first block ...
0013.00        End  First Block.
0014.00
        ****************** End of data ***********************************

To get a complete list of commands for SEU place the cursor on the sequence number list and press the help key.

SEU Commands

SEU commands are entered in the "SEU==>" field at the top of the screen.

FIND

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.

CHANGE

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]

TOP

Go to the first page of the work screen.

BOTTOM

Go to the last page of the work screen.

SAVE

Save changes and continue editing. SAVE [ [ [ library/ ] file ] member ]

FILE

Save changes and exit from edit session. FILE [ [ [ library/ ] file ] member ]

CANCEL

Cancel session and exit session.

SET

See the IBM SEU manual for more information.

Function Keys in SEU

When a member is being edited, the Edit display supports a diverse set of function keys that allow you to perform specific tasks.
______________________________________________________________________________
Key Name            Function
______________________________________________________________________________
F1  Help                Press the help key for details about the  display.
F3  Exit                End the current task, returns to previous entry point.
F4  Prompt              Provides assistance for the options selected 
                        in the list or a command on a command line.
                        PDM will fill in the default values.
F5  Refresh             Refresh the current display.  Rebuilds display and
                        shows it again.
F10 Cursor              Moves the cursor from the data area to the SEU
                        command line, and from the SEU command line to
                        the data area.
F11 Previous            Record Places the previous record in the prompt.
F13 Change Session      Go to the Change Session Defaults Defaults
                        display.
F14 Find/Change Options Go the Find/Change Options display.
F15 Browse/Copy Options Go the Browse/Copy Options display.
F16 Repeat Find         Perform find or repeat current find.
F17 Repeat Change       Perform change or repeat current change
                        function.
F18 DBCS Conversion     Perform DBCS conversion.
F19 Left                View the info. to the left of the current display.
F20 Right               View the info. to the right of the current display.
F23 Select Prompt       Go to the Select Prompt display.  SEU returns
                        to the EDIT Session and displays the prompt
                        after you make a selection.
F24 More keys           View the other function keys available for the
                        current display.

Summary of Line Commands

The Sequence_number field displays the sequence number of the record and is used for entering SEU line commands. To use a line command, type the command over the digits that make up the sequence number.
The following is a list of all the 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.

Steps in Developing a Program

In this section, we are going to use a simple Control Language (CL) program to illustrate the steps in developing, compiling, and running a program on the AS/400. We will also demonstrate how to find compilation errors when they occur, and how to obtain information about certain compilation and runtime errors. The intention here is not to teach CL programming.
The CL program is very simple; all it does is make the library that you have created (in my case, YOURLIB) the current library while retaining the existing current library on the library list. First, let's create a source physical (PF-SRC) file called QCLSRC (the IBM-supplied name for a CL source physical file). The command line form of issuing CL commands will be used in this section (you may want to use the <F4>prompt facility to assist you if you are not familiar with the commands). The following creates a PF-SRC file in the library ALIBRARY. ALIBRARY represents the library that has the same name as your user profile or your other library, that is the one you created in an earlier section.
CRTSRCPF FILE(ALIBRARY/QCLSRC)
Once the PF-SRC file has been created, work with the file by typing:
WRKMBRPDM FILE(ALIBRARY/QCLSRC)
Then create a source member called TEST in QCLSRC by pressing <F6> . This will start the SEU editor. Enter TEST for the name of the source member, CLP for the source type (to see what source types are available, put the cursor on the "Source type" field and press <F4> ), and a brief description of the source member. Once you have entered all the necessary information, press <Enter> . You will enter a SEU editing session. Type in the following program:

        *************** Beginning of data ********************************
0002.00              PGM
0003.00              DCL        VAR(&OLDCURLIB) TYPE(*CHAR) LEN(10)
0004.00              RTVJOBA    CURLIB(&OLDCURLIB)
0005.00              CHGCURLIB  CURLIB(&YOURLIB)  /* intentional error */
0006.00              ADDLIBLE   LIB(&OLDCURLIB)
0007.00              ENDPGM
        ****************** End of data ***********************************

You can use the SEU line command, IP (insert line and prompt), to help you in selecting a CL command. Also, note that CL programs are "free format" in that components of CL statements do not have to be placed in particular columns on the screen (some source types, such as RPG, are "fixed-format"; the IP line command can help enormously in coding such programs).
A CL program begins with the PGM command, which is optional if the CL program does not receive any parameters. (Aside: If a CL program has a parameter named &MYVAR, the PGM statement is coded as: PGM PARM(&MYVAR). The ampersand symbol, "&", denotes that &MYVAR is a variable. In this case, &MYVAR will be used to hold the parameter's value. Moreover, the variable &MYVAR has to be declared using the DCL command.) For more information, the reader is referred to the IBM "CL Programmer's Guide" or the online education modules: "AS/400 Control Language Programming" in the "Tutorial Support System" course, and the modules "Creating a Control Language Program" and "How to Use Error Handling Facilities" in the "Facilities and Implementation" course.
The second statement declares a CL variable called &OLDCURLIB. This variable will be used to save the name of the existing current library. The variable will be used to hold a character string with a maximum length of 10. Note that SEU provides syntax checking for CL programs. Remove the parameters of DCL so that the statement contains only "DCL", and press <Enter> . SEU will highlight that statement, indicating that there is a syntax error. SEU will not let you exit an editing session that has syntax errors unless you explicitly specify that you want to exit in the exit screen. Put the parameters back on the DCL statement.
The RTVJOBA command, on the third statement, is used to retrieve the name of the job's existing current library, saving it in the variable &OLDCURLIB. The reason for this step will be explained shortly.
The CHGCURLIB command, on the fourth statement, is used to make YOURLIB the new current library (where "YOURLIB" is any existing library that you have access to). Notice that we have intentionally introduced an error in this statement. We have mistakenly prefixed YOURLIB with "&", that is we really want CHGCURLIB CURLIB(YOURLIB) instead of CHGCURLIB CURLIB(&YOURLIB).
A name with "&" as its prefix denotes that it is a CL variable. This is an error because if we intended &YOURLIB to be a variable, it must be declared in a DCL statement. Note that SEU cannot detect this kind of error. This error will be detected during compilation.
The ADDLIBLE command, on the fifth statement, adds the name of the former current library (which we saved in the variable &OLDCURLIB in the RTVJOBA statement) to the library list. This step is needed if we want this library to stay on the library list. This is because when the CHGCURLIB command is executed, the "old" current library will not be retained on the library list. Hence, the need to use RTVJOBA to save the name of that library, and to add it back on the library list using ADDLIBLE. The last statement, ENDPGM, indicates the end of the CL program. Now, exit and save the program as it is (i.e. with the error).

Compiling a Program

In the "Work with Members using PDM" screen, enter option 14 to compile the member that contain the CL source program. Option 14, in this case, will invoke the CRTCLPGM (Create CL Program) command. Option 14 will invoke a different "create program" command for a different source type (e.g. if the source type is CBL, it will invoke the CRTCBLPGM command). If you prompt on the option (ie. press <F4> when you use option 14), you will see the following screen:

                        Create CL Program (CRTCLPGM)
 Type choices, press Enter.
 Program  . . . . . . . . . . . . > TEST          Name, *PGMID
   Library  . . . . . . . . . . . >   ALIBRARY    Name, *CURLIB
 Source file  . . . . . . . . . . > QCLSRC        Name
   Library  . . . . . . . . . . . >   ALIBRARY    Name, *LIBL, *CURLIB
 Source member  . . . . . . . . . > TEST          Name, *PGM
 Generation severity level  . . .   29            0-29
 Text 'description' . . . . . . .   *SRCMBRTXT

                            Additional Parameters

 Replace program  . . . . . . . . > *YES          *NO, *YES
                                                                 Bottom

 F3=Exit   F4=Prompt   F5=Refresh   F10=Additional parameters   F12=Cancel
 F13=How to use this display        F24=More keys

The "Program" field specifies the name of the *PGM object that will be created if the compilation is successful. This name defaults to name of the source member. The "Library" field specifies the library that will contain the *PGM object. The default is the library that contains the source member. You can change these default values. Unless you want to rename the *PGM object or put it in another library, accept the defaults.
On pressing <Enter> , you will see a message at the bottom of the screen saying that the compilation job has been submitted to QBATCH, which is the job queue for batch jobs. If there are no compilation errors, you will receive a message saying that the job completed normally. Since there is an error in the above program, a message will return saying that the job has ended abnormally, meaning there are compilation errors. Press <Enter>to continue.

Finding Compilation Errors

To find out the cause of the compilation error, type WRKSPLF to see what's in your output queue. There should be a spooled file with the same name as your source member (the compiler listing) and a job log (QPJOBLOG). Type 5 against QPJOBLOG to display it. There should be a message stating that the program was not created because of compilation error. The message will refer you to the compiler listing of the program. Press <Enter> to exit this display. Type 5 to display the contents of the compiler listing of the program. A segment of that listing is presented here:

    200-              PGM
    300-              DCL        VAR(&OLDCURLIB) TYPE(*CHAR) LEN(10)
    400-              RTVJOBA    CURLIB(&OLDCURLIB)
    500-              CHGCURLIB  CURLIB(&YOURLIB)
* CPD0727 40  Variable '&YOURLIB   ' is referred to but not declared.
    600-              ADDLIBLE   LIB(&OLDCURLIB)
    700-              ENDPGM
                             * * * * *   E N D   O F   S O U R C E   * * * * *

 5738SS1 V2R1M1  920306            Control Language             YOURLIB/TEST

                                          Cross Reference
 Declared Variables
 Name             Defined     Type            Length      References
 &OLDCURLIB          300      *CHAR             10           400   600

* CPD0791 00  No labels used in program.

                   * * * * *   E N D   O F   C R O S S   R E F E R E N C E   *
 5738SS1 V2R1M1  920306            Control Language        YOURLIB/TEST

                                          Message Summary
               Severity
 Total       0-9  10-19  20-29  30-39  40-49  50-59  60-69 70-79  80-89  90-99
     2       1      0      0      0      1      0      0      0    0      0

 Program TEST not created in library YOURLIB. Maximum error severity 40.

There are two errors in the listing (errors are marked with "*" in column 1): the first with a severity of 40 and the second with severity of 0. The second error is only an information message; it is not the cause of the compilation failure. The meaning of first error is evident; it is the cause of the failure. You can use the DSPMSGD (Display Message Description) command to get more information about a compilation error. For example, to get more details about the error CPD0727 DSPMSGD RANGE(CPD0727) MSGF(QCPFMSG) where QCPFMSG is the system message file and CPD0727 is the message ID. Let's go back to the source member and fix the problem.

Using SEU to Find Compilation Errors

You may want to use SEU to view your compiler listing instead of the way discussed above, especially if the compiler listing is too lengthy to scan by eye. SEU provides special support for locating compilation errors. To view a spooled file while you are in SEU, press <F15> (Browse/Copy). Enter 2 in the selection field. Place the cursor on the "Browse/copy spool file" field and press <F4>. Select the appropriate spool file. On return to the editing session, you should see a split screen with the member you are editing on top and the spooled file on the bottom. To find compilation errors, in the bottom screen type FIND *ERR on the SEU command line (or simply, F *ERR). An advantage of using SEU for this purpose is that you can see both the source member and the compiler listing on the same screen, and make the corrections to the source member on the spot.
Using SEU, edit the source member to remove the ampersand, "&", from YOURLIB. The program should compile normally after this change. To make the situation more interesting, let's introduce another type of error. In the ADDLIBLE statement, specify some library name that you do not own or one that you are not authorized to use. In our example, we specify a nonexistent library called DOGNAP, that is ADDLIBLE DOGNAP. The rest of the source remain the same as before (except for removing the ampersand character). Compile the source member (you will probably be asked if you want to delete the existing *PGM object. Respond with a "Y"). The program should compile normally. The *PGM object will be created in the library that contains your source file unless you specified otherwise.

Running a Program

Use the WRKOBJPDM command to work with the library that contain the *PGM object that was created. Type 16 against the *PGM object to run/execute it. Alternatively, you can run the program by using the CALL command (in fact, option 16 invokes the CALL command). If the library that contains the *PGM object is in your library list, type CALL TEST on a command line. If the library is not in your library list, you can still run the program by qualifying it with the library name CALL ALIBRARY/TEST The example program used here does not take any input parameters. But if you created a program that requires an input parameter(s), you can pass the parameter value(s) by prompting on either the option 16 or the CALL command. If your program takes more than one input parameter, type '+' on the "Parameters" field and press <Enter> . This will bring another screen that allows you to enter multiple parameters. You can also us pass parameters using the command line method. For example, CALL MYPROG PARM(parameter1 parameter2 ...)

Diagnosing Runtime Errors

In any case, when you run the program, you will get a runtime or object error message similar to the one below:

                        Display Program Messages

 Job 287471/T03/DSP02 started on 07/20/92 at 13:48:44 in subsystem QINTER

 CPF2110 received by TEST at 600. (C D I R)

 Type reply, press Enter.

   Reply . . . ________________________________________________________
        


 F3=Exit   F12=Cancel

To find out the cause of the error, place the cursor on the message id (in this case CPF2110) and press <F1>. You see a screen similar to the one below. The message text, in this case, indicated clearly what the problem is, i.e. the library DOGNAP was not found. Sometimes you can obtain additional messages by pressing <F10> to display messages in the job log.

                         Additional Message Information


 Message ID  . . . . . . :   CPA0701        Severity . . . . . .: 99
 Message type  . . . . . :   INQUIRY
 Date sent . . . . . . . :   07/20/92       Time sent  . . . . .: 14:00:05
 From program  . . . . . :   QCLXERR        Instruction  . . . .: 0000

 To program  . . . . . . :   *EXT           Instruction  . . . .: 0000
 Message . . . . :   CPF2110 received by TEST at 600. (C D I R)
 Cause . . . . . :   Control language (CL) program TEST inlibrary YOURLIB
   detected an error at statement number 600. Message text for CPF2110 is:
   Library DOGNAP not found.
 Recovery  . . . :   This inquiry message can be avoided bychanging the

  program. Monitor for the error (MONMSG command) and perform error
  recovery within the program. To continue, choose a reply value.

 Possible choices for replying to message . . . . . . . . . . . . . . . :
   C -- Cancel the CL program.
   D -- Dump the CL program variables and cancel the CL program.
   I -- Ignore the failing command.

                                                                 More...

 Press Enter to continue.

 F3=Exit           F10=Display messages in job log        F12=Cancel

Again, the DSPMSGD ("Display Message Description") command can be used to obtain more information about the error. For example, DSPMSGD RANGE(CPF2110) MSGF(QCPFMSG) where QCPFMSG is the system message file and CPF2110 is the message ID.
Press <Enter> to cancel the program. Go back to the source member, fix the error, and recompile. The next time you run the program, it should run without any problems. Type DSPLIBL to check whether the library has been added and whether it has been made the current library.

Creating an Initial Program

An initial program is similar to the AUTOEXEC.BAT file in MS-DOS. It is executed when the user logs on. The initial program has to reside in your default library (i.e. the library with the same name as your user profile) and it has to be named INITIALPGM. For instance, you can make the above CL program your initial program. Rename the source member to INITIALPGM and recompile it. If you created the source member in a another library, when you recompile it using the option 14, press < F4>to prompt on it. Specify your default library as the library where the *PGM object is to be stored.

Understanding Object Authorities

Introduction

To maintain security of data and/or program objects the AS/400 offers a variety of options available to limit access to object. These authorities must be set to secure object to the level of security required. Likewise, if objects are to be shared or used between users, the object authorities must be relaxed correctly to maintain object integrity. This section is designed to help users maintain correct authorities and to understand the authorities on the objects that they own.

Authorities and their meanings

Object Authorities
Object authority is used to control access to an object including the ability to see an object description, control read and write access to an object, or control an object's existence.
*OBJMGT
provides the authority to specify the security (grant/revoke object authority), move or rename the object, and add members to database file.
*OBJEXIST
provides the authority to control the object existence and ownership. The user with this authority can delete, save, and transfer ownership of the object.
*OBJOPR
provides the authority to look at the description of an object and use the object as determined by the data authority that the user has to the object.
Data Authorities
Data authority is the authority to access data contained in an object, for example records in a database file. This includes the ability to view, update, add, or delete records.
*READ
provides the authority to get the contents or an entry in an object or to run a program.
*ADD
provides the authority to add entries to an object.
*UPD
provides the authority to change the entries in an object.
*DLT
provides the authority to remove entries from an object.
Combinations of Object and Data Authorities
These are keywords, each representing predefined combination of object and data authorities. They reduce the time required to assign specific authorities to users.
*ALL
allows the user to perform all authorized operations (object and data) on the object.
*CHANGE
provides *OBJOPR authority and all data authority.
*USE
provides *OBJOPR authority and data read authority.
*EXCLUDE
authority prevents the user from accessing the object even if *PUBLIC is authorized.
In addition to these, users can create customized combinations of object and data authorities.

Changing authorities with EDTOBJAUT

We use an example here to illustrate the use of some of the types of authorities discussed above. In this example, we want to allow a certain user to copy a member from the file "SRCFILE" which is stored in the library "YOURLIB". First of all, we need to allow the user to have access to the library "YOURLIB". To do that, we use the "Edit Object Authority", EDTOBJAUT, command to edit the authority on "YOURLIB". (Note that your default library, i.e. the library that has the same name as your user profile, is normally owned by your security officer so you cannot change its authorities). Type EDTOBJAUT on a command line and press <F4>. Fill in the blanks for object, library, and object type (*LIB) and press <Enter> .

                        Edit Object Authority (EDTOBJAUT)

 Type choices, press Enter.
 Object . . . . . . . . . . . . . > YOURLIB       Name
   Library  . . . . . . . . . . .     *LIBL       Name, *LIBL, *CURLIB
 Object type  . . . . . . . . . . > *LIB          *ALRTBL, *AUTL, *CFGL...

To see the detail screen as shown below, press <F11>. Note that the owner of "YOURLIB" has *ALL authority on the object.

                             Edit Object Authority

 Object . . . . . . . :   YOURLIB         Object type  . . . . :  *LIB

   Library  . . . . . :     QSYS          Owner  . . . . . . . :  JOHNDOE


 Type changes to current authorities, press Enter.

   Object secured by authorization list  . . . . . . . . . . . .:  *NONE

              Object    ----Object-----  ----------Data-----------

 User        Authority  Opr  Mgt  Exist  Read  Add  Update Delete
 JOHNDOE     *ALL        X    X     X     X     X     X       X
 *PUBLIC     *EXCLUDE    _    _     _     _     _     _       _


 F3=Exit   F5=Refresh    F6=Add new users   F10=Grant with reference object
 F11=Nondisplay detail   F12=Cancel         F17=Top   F18=Bottom

Press <F6> to add a user to the list of users authorized to this object. Type in the name of the user and *USE for the object authority. Press <Enter> to return to the previous screen. Notice that *USE gives the user *OBJOPR and *READ authorities on "YOURLIB". (Note: If you want to edit a specific authority, type "X" in the position relating to that authority to grant authority or a space to delete that authority.)
Next, we need to allow the user access to the file "SRCFILE". Use EDTOBJAUT to edit the authority on the file "SRCFILE". Type EDTOBJAUT OBJ(YOURLIB/SRCFILE) OBJTYPE(*FILE) or use the prompt to fill in the parameters. Press <F6> to add the user to the authorization list with *USE authority. This will allow them to do perform various operations on "SRCFILE" including copying members from the file. To allow them to copy the entire file (i.e. "SRCFILE"), *OBJMGT must be granted. To do that, type "X" under "Mgt" in the detail screen for that user. Note that the object authority changes from *USE to USER DEF (meaning a customized authority).

Changing Authorities with GRTOBJAUT and RVKOBJAUT

To use GRTOBJAUT and RVKOBJAUT type the command and prompt <F4>. Fill in the library name, object name, object type along with the user you are granting authorities and the respective authority being granted. At any time press <F1> for more help.

Sending and Receiving Network Files

Users can send and receive network files to and from each other. The "Send Network File" (SNDNETF) command can be used to send a member of a physical database file (PF-DTA or PF-SRC) to another user. In the example shown below, the member "SNDMBR" of the physical database file "SNDFILE" (which is contained in the library "SNDLIB") is to be sent to the user "RCV". "MKTAS400" is the address of the AS/400 at Minnesota State University, Mankato. When the network file arrives at its destination, a message is sent to both the sender and receiver.

                         Send Network File (SNDNETF)

 Type choices, press Enter.
 File . . . . . . . . . . . . . . > SNDFILE___    Name
   Library  . . . . . . . . . . . >   SNDLIB____  Name, *LIBL, *CURLIB
 User ID:                           _
   User ID  . . . . . . . . . . . > RCV_______    Character value
   Address  . . . . . . . . . . . > MKTAS400__    Character value
                + for more values   _
Member . . . . . . . . . . . . . > SNDMBR____     Name, *FIRST

                            Additional Parameters
 To file type . . . . . . . . . .   *FROMFILE_    *FROMFILE, *DATA

 VM/MVS class . . . . . . . . . .   A             A, B, C, D, E, F, G, H, I
 Send priority  . . . . . . . . .   *NORMAL__     *NORMAL, *HIGH

 F3=Exit  F4=Prompt  F5=Refresh  F12=Cancel  F13=How to use this display
 F24=More keys

The receiver will have to run the "Work with Network Files" (WRKNETF) command to inspect their network files.

                    Work with Network Files (WRKNETF)

 User . . . . . . . . . . . . :   RCV_______
 User ID/Address  . . . . . . :   RCV_______  MKTAS400

 Type options, press Enter.

   1=Receive network file   3=Submit job   4=Delete network file
   5=Display physical file member
                                File   -------From-------
----Arrival----
 Opt  File        Member       Number  User ID   Address   Date    Time
 __   SNDFILE     SNDMBR            1  SENDER    MKTAS400 08/26/92  16:37



F3=Exit   F4=Prompt   F5=Refresh   F9=Retrieve   F11=Display type/records
F12=Cancel

Type 1 in the "Opt" blank in front of the network file to receive and press <F4>to prompt. The following screen will show up.

                      Receive Network File (RCVNETF)

 Type choices, press Enter.
 From file  . . . . . . . . . . . > 'SNDFILE'__  Character value
 To data base file  . . . . . . .   *FROMFILE__     Name, *FROMFILE
   Library  . . . . . . . . . . .     *LIBL____     Name, *LIBL, *CURLIB
 Member to be received  . . . . . > 'SNDMBR'__   Character value, *ONLY
 To member  . . . . . . . . . . .   *FROMMBR____    Name, *FROMMBR, *FIRST

 F3=Exit   F4=Prompt   F5=Refresh   F10=Additional parameters  F12=Cancel
 F13=How to use this display        F24=More keys

Fill in the "To data base file", "Library", and "To member" blanks with the appropriate receiving file, library and member names and press <Enter>. Note that the receiving file must already exist before trying to receive members.

Printing Procedure

When programs on the AS/400 produce output intended to be printed the material does not go directly to the printer. Instead the output is bundled together with other output in an object called an "output queue" (*OUTQ). These sub objects are called "spooled files." To send these spooled files to a printer, first you must work with your output queue; then, change the attributes of the desired spooled file, specifying the correct print device name.
There are several ways by which spooled files are generated. Here are some:
  • From the WRKMBRPDM display, option 6 in front of the desired member will generate a spooled file that is your program member.
  • Pressing the Print Screen key (<Shift><Print Screen>on the PS/2 running PC-Support or <Ctrl>p on the ASCII connections) will generate a spooled file of the current display. Note that if you do a print screen, you will have to press the <Reset>key to clear the message at the bottom of the screen in order to continue your session.
  • The system automatically generates spooled files in some cases like presenting job log, information on processed records for a database file and abnormal job end conditions.

Moving a Spooled File to a Writer

To get a physical copy of a spooled file on your output queue, two facts must be true. First, the spooled file must be placed on a started writer and second, the spooled file must have a status of released. To work with your spooled files on your output queue type WRKSPLF and press <Enter>. This screen allows you to do many things with your spooled files.
Note: If this is the first time that you are using the WRKSPLF command, you should change the "assistance level" for this screen. To do this press <F21>and change the assistance level from "basic" to intermediate". This will gives you more features on the screen. Try pressing the <F10>or <F11>keys to obtain different views of your spooled files.
Typing 2 in the option field of spooled file in the WRKSPLF screen will change the spooled file's attributes. The attributes that you will be interested in are the "Print device" and "Save file".
By changing the attribute "Print device" from "*OUTQ" to a valid printer (use the WRKWTR command to find out which printers are available), you will move your spooled file from your output queue to a printer writer. The printer writer names at MSU are:
Printer Name     Width/Paper      Printer Type       Location
  PRT01          132 Col. 11"     Line Printer        Morris Hall
  VAXPRTS2       132 Col. 11"     Line Printer        MSU ACC
  PS/2 printers  132/80 8.5"      Dot Matrix          MSU ACC Lab Rooms
If "Save file" is changed from "*NO" to "*YES" the spooled file will not be deleted after the file has been printed.
Typing 3 in the option field of spooled file in the WRKSPLF screen will keep the spooled file from printing if placed on a printer writer and change the status to *HLD.
Typing 4 in the option field of spooled file in the WRKSPLF screen will delete the spooled file from your output queue. Spooled files should be deleted as soon as they are not needed to reduce clutter in your output queue.
Typing 5 in the option field of spooled file in the WRKSPLF screen will allow you to view your spooled file.
Typing 6 in the option field of spooled file in the WRKSPLF screen will will release a file that is held to become available to print and will change its status to *RDY.
If you printed to VAXPRTS2, your printouts can be picked up in the ACC printer area at any time. VAXPRTS2 is a printer that is connected to VAX1. The printer will never say it is started although it actually is. Normally you will not be authorized to print to writer PRT01. This printer is the system printer.

Printing to a PS/2 Printer

To see which PS/2 printers are available for printing from the AS/400, type WRKWTR ("Work with Writers"). The name of the printer is: "PC0" (i.e. "P" + "C" + zero) + the number of the PS/2 to which the printer is connected + "S2" (e.g. PC0614S2). Make sure that the printer you want to print to has been started. For the printer to be started, the PS/2 workstation that is connected to the printer must be signed on to the AS/400. Also, make sure that the printer is ready for printing. Press <Alt><Esc>on the computer that is attached to the printer to display the status of the printer; make sure it says "Ready". If not, select the "stop" option and then select "start". Also make sure the printer's status is "ONLINE".

Step by Step Printing Example

Type WRKSPLF { or OQ } Press <Enter>.
This will allow you to work with your spooled files.
Use the <Field EXIT>key or <Tab>to move to the desired spool file.
This will move us to the correct spool file option field.
Type 5 in the option field.
This will mark the spool file for displaying.
Press <Enter> .
This will display the spool file.
Press <Enter>.
This will bring you back to the work with spool file screen.
Press 2 <Enter>.
This will permit you to change the spool file attributes.
Type in the name of the printer <Enter>.
This will move the file to the printer writer.
Press the <F5>key.
This will refresh the screen to show you the current status of your spooled files.
If the STS (status) is RDY or WTR the printer will print your spooled file. If the status is HLD then release it by typing a 6 in the option field of the spooled file and press <Enter>.

More Printing Help

For more help on printing type STRSCHIDX <Enter>then type SPOOLED QUEUES <Enter>.

Common Problems

Note that the command keys used in this section are those of the PS/2 running PC Support.

Stopping Infinite Loops/Ending a Previous Request

If you have issued a command and it is taking too long finish it may be an infinite, endless, loop. To stop your infinite loop:
  • Press <Left Ctrl> (this will reset any keyboard errors)
  • Press <Alt><Print Screen>(this sequence is call "System Request")
  • Type 2. (This is the option on System Request to end a previous request.)
  • Press <Enter> . Note: You can also press <Alt><Print Screen>and press <Enter>to display a menu of system requests, and then select the appropriate command.

Ending Disconnected Jobs with Infinite Loops

If for some reason you have been disconnect from the system while executing an infinite loop request the job may continue to execute. This will cause the system to run very slowly. To end the disconnected job:
  • On a command line, type the "Work with Active Jobs" command: WRKACTJOB and press <Enter> . The locally-defined alias for WRKACTJOB, AJ, can also be used.
  • On the "Work with Active Jobs" display, type option 4 (End) against the job that is causing the loop and press <F4>to prompt on the option. In the "How to end" field, type in *IMMED i.e. to end the job immediately.
  • Press <Enter>.

Out of Storage Quota Errors

Depending on the specific class that requires use of the AS/400 there is a maximum storage quota allocated to your user profile. You can see this information by typing: DSPUSRPRF username. Because OS/400 retains every version of a *PGM object that results from a compilation, your storage can be used up very quickly. When you have exceeded (or nearly exceeded) your storage quota and you try to start, for example, SEU, you may get an error message "Error found on SEU command". To deal with this problem, you must clear the *PGM objects from library QRPLOBJ. To do this type WRKOBJPDM QRPLOBJ. You may get an authority problem do to the fact that you do not own all of the object in that library. The command will clear your objects out regaurdless of the error.

DDS and Data Files on the AS/400

Creating a data file

The following discussion assumes that you already have a source physical file in your current library. We will continue to use SRCFILE in library YOURLIB for explanation. The reader must substitute the appropriate names for source physical file and library, where applicable.
The first step is to to reach the 'Work with members using PDM' display. This can be done by typing WRKMBRPDM YOURLIB/SRCFILE on any command line.
To create a data file member, you have to start the Source Entry Utility. Press <F6> from the 'Work with members using PDM' display or type STRSEU on any command line and press <F4>. The following screen shows up:

                       Start Source Entry Utility (STRSEU)

 Type choices, press Enter.

 Source file  . . . . . . . . . .   *PRV______    Name, *PRV
   Library  . . . . . . . . . . .   __________    Name, *LIBL, *CURLIB, *PRV
 Source member  . . . . . . . . .   *PRV______    Name, *PRV, *SELECT
 Source type  . . . . . . . . . .   *SAME_____    Name, *SAME, BAS, BASP, C...
 Option . . . . . . . . . . . . .   *BLANK____    *BLANK, ' ', 2, 5, 6
 Text 'description' . . . . . . .   *BLANK_________________________________

The Source type for a data file must be specified as PF, this type denotes aPhysical File. For example, to create a data file called TESTDATA in the source file SRCFILE in library YOURLIB, fill in the fields as shown:

                       Start Source Entry Utility (STRSEU)

 Type choices, press Enter.

 Source file  . . . . . . . . . .   SRCFILE___    Name, *PRV
   Library  . . . . . . . . . . .     YOURLIB___  Name, *LIBL, *CURLIB, *PRV
 Source member  . . . . . . . . .   TESTDATA__    Name, *PRV, *SELECT
 Source type  . . . . . . . . . .   PF________    Name, *SAME, BAS, BASP, C...
 Option . . . . . . . . . . . . .   *BLANK____    *BLANK, ' ', 2, 5, 6
 Text 'description' . . . . . . .   Your_description_for_the_member_...______

The Edit display shows up. It is convenient to use the prompt facility for defining the DDS source. The prompter helps you to supply the source information in the correct format. Press <F4> to invoke the prompter and <F12>to cancel it.
When the prompter is invoked, the screen looks as shown:

 Find  . . . _____________________________________________________    TESTDATA

 FMT PF .....A..........T.Name++++++RLen++TDpB......Functions++++++++++++++++++
        *************** Beginning of data *************************************
0001.00
        ****************** End of data ****************************************

 Prompt type . . .   PF      Sequence number . . .  0001.00

 Name                                     Data      Decimal
 Type       Name        Ref     Length    Type     Positions    Use
  _         _____        _      ______     _          ___        _

 Functions ___________________________

 F3=Exit            F4=Prompt          F5=Refresh         F10=Top
 F11=Bottom         F12=Cancel         F24=More keys

An explanation of the different fields shown above follows: The fields marked with * are not commonly used, so for normal applications you may conveniently ignore them.
Name_Type
Choose one of the following:
Blank
Leave the field blank to indicate a field name.
R
Type R in column 17 to indicate a record format name.
K
Type K in column 17 to indicate a key field name.
Name
Type a record format, field, or key field name in this position. The maximum length allowed is 10 characters, beginning in column 19.
Reference (*)
Type R in this field to use the reference function to copy attributes of a previously defined named field to the field you are now defining.
Length
Type a value to indicate the number of characters in a character field or the number of digits in a numeric field. For example, for Character type the range is 1-32766, for Packed decimal the range is 1-31 digits and so on.
Data_Type
Choose one of the following:
A
for character data.
P
for packed decimal data.
S
for zoned decimal data.
B
for zoned binary data.
F
for floating point data.
H
for hexadecimal data.
Decimal_Positions
Type a value from 0 through 31 to indicate the number of decimal positions to the right of the decimal point within a packed decimal, a zoned decimal, a floating point, or a binary field.
Use (*)
Type B or leave the field blank to indicate a field used for both input and output.
Functions (*)
Type in keyword entries valid for defining physical files in positions 45 through 80 of this field.
The DDS source for TESTDATA is shown below. RECFMT1 is the record format name. There are two fields in the data file, FIELD1 and FIELD2. FIELD1 is of character data type with length 10, and FIELD2 is a packed decimal of length 5 with 2 decimal positions. The last line of the member declares FIELD1 to be the key field.

 Find  . . . __________________________________________________________  TST1

 FMT PF .....A..........T.Name++++++RLen++TDpB......Functions++++++++++++++++++
        *************** Beginning of data *************************************
0000.01
0001.00                 R RECFMT1
0002.00                   FIELD1        10A
0003.00                   FIELD2         5P 2
0004.00                 K FIELD1
0005.00
        ****************** End of data ****************************************

 F3=Exit                   F4=Prompt                 F5=Refresh
 F10=Top                   F11=Bottom                F24=More keys

Press <F3>and hit <Enter>to save the member TESTDATA. For more details about exiting SEU refer to the section 'How to exit SEU'.
The member TESTDATA that was just created contains only the definition of the data file and hence our the next step is to actually create the file. This can be done by compiling the member we have just created. From the 'Work with members using PDM' display, position the cursor at member TESTDATA, and choose option 14 (compile). If the compilation is successful, the file TESTDATA will be created in YOURLIB. Otherwise, look into your spooled file (WRKSPLF) and identify the problem.

Loading a data file

To load a data file, use the command UPDDTA (Update Data Area). Type UPDDTA on any command line and press <F4>. The following screen shows up:

                     Update Data with Temp Program (UPDDTA)

 Type choices, press Enter.

 Data base file . . . . . . . . .   __________    Name
   Library  . . . . . . . . . . .     *LIBL_____  Name, *LIBL, *CURLIB
 Member . . . . . . . . . . . . .   *FIRST______  Name, *FIRST

                                                                    Bottom

 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display
 F24=More keys

Supply the values for the data base file to be loaded and the library it is contained in, and press <Enter>. For example, to populate our file TESTDATA we would fill in the values as shown:

                     Update Data with Temp Program (UPDDTA)

 Type choices, press Enter.

 Data base file . . . . . . . . .   TESTDATA__    Name
   Library  . . . . . . . . . . .     YOURLIB__   Name, *LIBL, *CURLIB
 Member . . . . . . . . . . . . .   *FIRST____    Name, *FIRST

                                                                     Bottom

 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display
Enter the values for different fields and press Enter>. To stop the process of loading the data file, press <F3>and press < Enter>.

Screen Design Using SDA

To aid in the creation of user interfaces on the AS/400, the operating system includes a utility called SDA (Screen Design Aid). This system allows a programmer to "paint" screens and menus used by a program from within a simple editor, defining input and output fields and special text attributes. These screens may then be called from an application program, allowing the program to have all the features of the AS/400 user interface without direct programming of the appearance of the interface.
This section will only cover those aspects of screen design not related to interfacing with applications. For information on this area, see the manual for the language of the application source.

Starting SDA

The first steps in creating a set of screens for a program are the same as those for creating a program source member. A source physical file must be created (or one already in existence may be used) and a member must be created in the PF-SRC to hold the screens.
To create the screen design member, issue the command STRSDA (for STaRt SDA) from a command line. A menu of options will appear which allow you to create a screen, create a menu, or test a design. Choosing the first option brings the following screen:

                                 Design Screens

 Type choices, press Enter.

   Design option . . . . . .   _            1=Select file keywords
                                            2=Select record keywords
                                            3=Select subfile keywords
                                            4=Select subfile control keywords
                                            5=Define screen image (fields)
                                            6=Save DDS source, create object
   Record  . . . . . . . . .   __________   Name, F4 for Record list
   Additional records  . . .   __________   Name
     (to be displayed on Work Screen)
   Source file . . . . . . .   QDDSSRC___   Name
     Library . . . . . . . .   *LIBL_____   Name, *LIBL, *CURLIB
   Member  . . . . . . . . .   __________   Name, F4 for Member list
   Source type . . . . . . .   __________   DSPF,
                                            Blank for default

 F3=Exit     F4=Prompt     F12=Cancel

Since no screen design exists yet, it is necessary to first create one using the "5" option on the "Design option line". Also, a source file must be provided, and a member specified. If the member does not yet exist, it will be created. Finally, a record name must be given. Since each member can have several records, a single screen design member could contain any number of screens, with each one given a distinct record name. Once the information is entered, the screen should look like this:

                                 Design Screens

 Type choices, press Enter.

   Design option . . . . . .   5            1=Select file keywords
                                            2=Select record keywords
                                            3=Select subfile keywords
                                            4=Select subfile control keywords
                                            5=Define screen image (fields)
                                            6=Save DDS source, create object
   Record  . . . . . . . . .   SCREEN1___   Name, F4 for Record list
   Additional records  . . .   __________   Name
     (to be displayed
      on Work Screen)
   Source file . . . . . . .   SRCFILE___   Name
     Library . . . . . . . .   YOURLIB___   Name, *LIBL, *CURLIB
   Member  . . . . . . . . .   SCRNMBR___   Name, F4 for Member list
   Source type . . . . . . .   __________   DSPF,
                                            Blank for default
 F3=Exit     F4=Prompt     F12=Cancel

The "SOURCE TYPE" field may be left blank. It will default to the proper type for SDA.
These options will start SDA on a screen named SCREEN1 in the member SCRNMBR of file SRCFILE in library YOURLIB. Pressing <Enter> will bring up the main SDA display. This is simply a blank "pasteboard" on which you may place text and fields.

Using The Work Screen

Use the Work Screen to design the display you are creating. On the Work Screen you can add fields and constants, place fields you have selected from a database, move, copy, shift, and remove fields, and add or remove attributes and colors. You can also perform additional operations, such as requesting extended field definition.

You can use the following function keys on the Work Screen:

F1=Help
Press <F1> to show the same information as the help key. <F1> is active on all displays but does not appear in the function key area.
F3=Exit
Press <F3> to have the Design Screens display appear.
F4=Prompt
Press <F4> to have the Work with Fields display appear.
F6=Condition
Press <F6> to have the Condition Work Screen display appear.
F10=Database
Press <F10> to have the Select Data Base Files display appear.
F11=Switch
Press <F11>to display a list of selected database fields on the bottom row of the Work Screen. Press <F11>to switch back and forth between the list of selected data base fields and the list of not selected database fields.
F12=Cancel
Press <F12>to save your work and continue to the Design Screens display.
F14=Ruler
Press <F14>to place a vertical and horizontal ruler on the Work Screen where you position the cursor. The ruler does not interfere with your data. Press <F14>to remove the ruler. Defining fields on the ruler may cause unpredictable results.
F15=Subfile Prompt
Press <F15>to Display a prompt on the bottom row of the Work Screen that allows you to change the subfile line (SFLLIN) and subfile page (SFLPAG) sizes that were in effect for the current record being defined.
F17=Print
Press <F17> to Print the current contents of the Work Screen.

Adding Fields

To add a user-defined field, type + followed by I (input), O (output), or B (both) for alphabetic fields, or followed by 3 (input), 6 (output), or 9 (both) for numeric fields and press Enter. To add a floating point field, add a numeric field followed by E (single-precision) or D (double-precision) and press Enter. You can use uppercase or lowercase letters. You indicate the length of a field by the number of characters following +, or by the length specified in brackets after the first character.
The following examples illustrate user-defined fields:
+BBB or +b(3)
Three-character, alphabetic, both (input and output) field.
+66.66 or +6(4,2)
Four-character, numeric, input field with two decimal positions (set by an edit word).
+3.33E or +3(3,2)e
Single-precision, input, floating-point field with three significant digits and two decimal positions.
+99.999d or +9(5,3)D
Double-precision, both (input and output), floating-point field with five significant digits and three decimal positions.

Adding Constants

To add a new constant or change an existing constant:
  • Type a constant. A blank character ends the constant.
  • Type constants with single quotation marks to define separate constants for each character string (word) that is followed by a blank.
  • Surround a character string with single quotation marks to define a single constant.
  • Surround several constants with single quotation marks to redefine them as one constant.
  • Use a double quotation mark to end one constant and start a new constant while taking up only one position.
  • To add a MSGCON (MeSsaGe CONstant) field, type + followed by M. To work with a MSGCON field, type ? in front of the field. When you press Enter, the Define Message Constant display appears. Press < F12>to return to the Work Screen.
  • To add system date or time fields, type *DATE or *TIME.
  • Use the at sign (@) in pairs to delimit a DBCS (Double Byte Character Set) constant. SDA will replace each pair with a shift in and a shift out pair when you press <Enter>. You can then type DBCS data between the delimiters. You cannot use a DBCS insert key on the Work Screen.
The following examples illustrate constant fields:
'xxx"YYY'
Defines two constant fields.
'xxx YYY zzz'
Combines three constant fields into one field.
+MMM or +(M3)
The Define Message Constant display appears.

Adding Fields from a Data Base File

The fields you select from a database file, appear on the bottom row of the Work Screen. You move fields from the bottom line to your display by typing & followed by the field number, if you are in multiple mode, and the column heading position and pressing Enter. The fields begin in the position where you type &. The following examples illustrate moving fields to your display:
                    Symbol
Single Field    Multiple Field  Field
Mode    Mode    Meaning                        

&       &n  Places field.  Does not add column heading.

&L      &nL Places field.  Adds a column heading to the
                        left of the field.

&R      &nR Places field.  Adds a column heading to the
                        right of the field.

&C      &nC Places field.  Adds a column above the field. 
                        Left-aligns column heading for an alphabetic
                        field and right-aligns column heading for a
                        numeric fields.

&P      &nP Places the column heading only.

Adding or Removing Attributes and Colors

To add or remove display attributes or colors on the Work Screen, type one of following commands (in uppercase or lowercase) in the position preceding the field (the attribute byte of the field):
         Command                           Command
         Add   Remove   Attribute          Add   Remove   Color

         H     -H       High intensity     CB    -CB      Blue

         R     -R       Reverse image      CG    -CG      Green

         S     -S       Column             CP    -CP      Pink
                        separators

         B     -B       Blink              CR    -CR      Red

         N     -N       Nondisplay         CT    -CT      Turquoise

         U     -U       Underscore         CW    -CW      White

               -A       Remove all               -CA      Remove all
                        attributes                        colors
You can carry out the above operations by typing * in the position preceding the field (the attribute byte of the field), pressing < Enter>, and working with the field keyword displays that appear.

Moving, Copying, and Shifting Fields

Reposition fields on the Work Screen by typing one of the following and pressing <Enter>:
-, =
Type - in the position preceding the field (the attribute byte of the field) and type = where you want the field to appear.
-, ==
Type - in the position preceding the field (the attribute byte of the field) and type == where you want a copy of the field to appear.
-, -, ==
Type - in any position preceding the field, type - in any position after the last field, and type == where you want a copy of the group of fields to appear.
<<<, >>>
Type <<< in the position preceding the field (the attribute byte of the field), or type >>> after the field (over the first attribute byte), to shift the field left or right as far as the signs extend.

Removing Fields

Remove fields from the Work Screen by typing one of the following and pressing <Enter>DO NOT use the <Delete>key to delete items on the work screen:
Blanks
Type a blank in the position preceding the field (the attribute byte of the field), and over the entire field.
D
Type D in the position preceding the field (the attribute byte of the field).

Additional Features

Extended field definition
Type * in the position preceding the field (the attribute byte of the field) to add field-level attributes and keywords.
Display field length and description
Type ? in the position preceding the field to display field length and text or column heading description on the last row of the Work Screen. You can rename the field by changing the name on the last row.
Display MSGCON field definition
Type ? in the position preceding the field to show the Define Message Constant display. You can change the message number, file, and library.
Date and time keywords
Type *DATE or *TIME to define special constants on the display where the system date and time will be automatically substituted.

Subfile Field Definition

You can define fields for a subfile similar to nonsubfile fields with the following considerations:
  • You can modify fields on the first record of the subfile. Anything you type is assumed to be a definition of the first record.
  • To modify the values of the SFLPAG (number of records on the display) and SFLLIN (number of spaces between fields), press < F15>to display the subfile prompt line. <F15>is allowed only for subfile records.
  • Any field that you define for the subfile will appear the number of times specified by the SFLPAG keyword.

Compiling And Testing Screens

Once the screen design is complete and <F3>is pressed, PDM returns to the "Design Screens" menu shown above. Choosing the "6" option on the Design Option line saves the source file for the screen and compiles it into a screen file which may be used by a program. IF THIS OPTION IS NOT CHOSEN AFTER THE SCREEN DESIGN IS COMPLETE, THE MODIFICATIONS WILL NOT BE SAVED. Note that it isn't necessary to save a file after every RECORD created; Several screens from a single member can be created before compilation. However, the file must be compiled before exiting SDA. Using the "6" option for a screen produces the following display:

                        Save DDS - Create Display File

 Type choices, press Enter.
   Save generated DDS source  . . . . . . .   Y            Y=Yes
     Source file  . . . . . . . . . . . . .   SRCFILE___   Name
       Library  . . . . . . . . . . . . . .   YOURLIB___   Name, *LIBL ...
     Member . . . . . . . . . . . . . . . .   SCRNMBR___   F4 for list
     Replace existing member  . . . . . . .   Y            Y=Yes
   Create display file  . . . . . . . . . .   Y            Y=Yes
     (CRTDSPF)                                             F4 for prompt
     Display file . . . . . . . . . . . . .   SCRNFIL___   Name
       Library  . . . . . . . . . . . . . .   YOURLIB___   Name, *LIBL ...
     If create fails, display listing . . .   Y            Y=Yes
     Replace existing file  . . . . . . . .                Y=Yes
     Create file if DDS message severity
       (GENLVL) is less than  . . . . . . .   20           0, 10, 20, 30
   Submit create job in batch . . . . . . .   Y            Y=Yes
     Job description  . . . . . . . . . . .   QBATCH____   Name
       Library  . . . . . . . . . . . . . .   QGPL______   Name, *LIBL ...

 F3=Exit   F12=Cancel

These options will compile all the screen records in member SCRNMBR of file SRCFILE in library YOURLIB to a *FILE object called SCRNFIL in YOURLIB. That file may then be used by user programs.
It may be advantageous to test screen designs before using them with programs. This can be accomplished using the "Test Display Files" option from the initial SDA menu. The screen test program will request the name of a screen and display file (created using the compilation procedure above,) followed by a prompt screen for values for the output fields. SDA displays the screen with the values supplied.

Debugging Programs on the AS/400

In addition to the utilities provided for creating, editing, and compiling programs, the AS/400 provides a facility to aid in the debugging of programs as they are running. Called the EPM (Extended Program Model) debugger, this tool allows the user to view and change the values of variables and step through the program by using breakpoints which interrupt program execution and return control to the debugger.

Starting the debugger

Before using the debugger, the source program must be compiled with the *DEBUG and *SOURCE options. These will, respectively, include debugging information in the executable program (so the debugger has access to variable and routine names) and produce a source output listing from the compiler. This source output should be printed before starting the debugger, as the compiler adds its own line numbers to the source which will be necessary in referencing specific lines while using the debugger. The source output is also useful as a hardcopy reference while the program is executing, since the debugger does not list source lines as the program executes.
To specify these options at compilation time, first prompt on the compile option on the Work with Members Using PDM display (or on the CRT___PGM command for the language of the source file) by pressing < F4>(PROMPT) with the "14" (COMPILE) option on the options line of the file you wish to compile. This will show the initial options screen for the compiler. To enter the compiler options, it is necessary to prompt for more options by pressing <F10>, which reveals the following screen:

                        Create Pascal Program (CRTPASPGM)

 Type choices, press Enter.

 Program  . . . . . . . . . . . . > TEST______    Name
   Library  . . . . . . . . . . . >   YOURLIB___  Name, *CURLIB
 Source file  . . . . . . . . . . > SRCFILE___    Name
   Library  . . . . . . . . . . . >   YOURLIB___  Name, *LIBL, *CURLIB
 Source member  . . . . . . . . . > TEST______    Name, *PGM
 Text 'description' . . . . . . .   *SRCMBRTXT_____________________________

Additional Parameters

 Compiler options . . . . . . . .   *DEBUG____    *LIST, *NOLIST, *CHECK...
                + for more values   *SOURCE___
  Language level . . . . . . . . .   *EXTENDED__   *EXTENDED, *ANSI83, *SYSTEM
 String temporary threshold . . .   2046____      256-32767

 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display
 F24=More keys

The above example is from a Pascal source member. However, other languages will have similar prompt displays.
Placing the *DEBUG and *SOURCE options on the "Compiler options" lines will cause the compiler to produce a source listing and place it in the output queue and will include debugging information in the output program. Pressing <Enter>once all options are entered will submit the compilation. After the member has been compiled (assuming there are no errors in compilation,) the source listing should be printed and used with the next steps.

Using the debugger

The process of Debugging essentially consists of four phases:
  1. Start the Debugger
  2. Add breakpoints
  3. Call the program to be debugged and
  4. End the Debugger
These phases are discussed in detail below:

Phase 1 (Start the Debugger)

The command to start the debugger is:
===> strdbg YOURLIB/TEST
where TEST is the program in library YOURLIB, that you intend to debug.

Phase 2 (Add Breakpoints)

A Breakpoint is a place in a program where the system stops the processing of that program and gives control to the display station user or to a specified program. The command ADDBKP is used to set breakpoints. The simplest form of ADDBKP takes the following form:
===> addbkp stmt(n1 n2 ... n10) where n1, n2 ... n10 are the statement numbers where the breakpoint is to occur. You may specify 1 to 10 statement numbers where the breakpoint should occur. For example, ' addbkp stmt(10 20 30) ' will set the breakpoints at statements 10, 20 and 30. The program breaks before processing a statement specified as a breakpoint.

Phase 3 (Calling the Program)

Once the breakpoints are set, the next step is to run the program using the CALL command.
===> call YOURLIB/TEST
You will notice that the program stops execution when the breakpoint is reached. From the 'Display Break Point' screen, you can check the values of the program variables as explained below:
  • Press <F10>(command entry) on the 'Display Breakpoint' screen.
  • This will take you to the command entry screen. Display the program variables with DSPPGMVAR command: ===> dsppgmvar VARNAME
    where VARNAME is the variable name you intend to display.
  • Using the above command, you can check for as many variables as you want to from the command entry screen. To exit the command entry press <F3>. Control is transferred back to the breakpoint.
  • Press <Enter>to resume execution of the program. The program will stop at the next breakpoint if any, or will terminate.

Ending the Debugger

Once you are done with debugging, it is very important that you end the Debugger, before you issue any other command. The command to do it is:
===> enddbg

No comments:

Post a Comment