Using the Source Entry Utility (SEU)

You can use the Source Entry Utility (SEU) to enter your source statements. SEU also provides prompting for the different specification templates as well as syntax checking. To start SEU, use the STRSEU (Start Source Entry Utility) command. For other ways to start and use SEU, refer to the ADTS for AS/400: Source Entry Utility manual.

If you name your source file QRPGLESRC, SEU automatically sets the source type to RPGLE when it starts the editing session for a new member. Otherwise, you have to specify RPGLE when you create the member.

If you need prompting after you type STRSEU, press F4. The STRSEU display appears, lists the parameters, and supplies the default values. If you supply parameter values before you request prompting, the display appears with those values filled in.

In the following example you enter source statements for a program which will print employee information from a master file. This example shows you how to:

  • Create a library
  • Create a source physical file
  • Start an SEU editing session
  • Enter source statements.
  1. To create a library called MYLIB, type:

    The CRTLIB command creates a library called MYLIB.

  2. To create a source physical file called QRPGLESRC type:
    TEXT('Source physical file for ILE RPG programs')

    The CRTSRCPF command creates a source physical file QRPGLESRC in library MYLIB.

  3. To start an editing session and create source member EMPRPT type:

    Entering OPTION(2) indicates that you want to start a session for a new member. The STRSEU command creates a new member EMPRPT in file QRPGLESRC in library MYLIB and starts an edit session.

    The SEU Edit display appears as shown in Figure 1. Note that the screen is automatically shifted so that position 6 is (for specification type) at the left edge.

    Figure 1. Edit Display for a New Member
     Columns . . . :    6  76            Edit                       MYLIB/QRPGLESRC
     SEU==>  ___________________________________________________________     EMPRPT
     FMT H  HKeywords++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            *************** Beginning of data ************************************* 
            ****************** End of data ****************************************
     F3=Exit   F4=Prompt   F5=Refresh   F9=Retrieve   F10=Cursor
     F16=Repeat find       F17=Repeat change          F24=More keys                 
    Member EMPRPT added to file MYLIB/QRPGLESRC.                                  +
  4. Type the following source in your SEU Edit display, using the following SEU prefix commands to provide prompting:
    • IPF — for file description specifications
    • IPD — for definition specifications
    • IPI — for input specifications
    • IPC — for calculation specifications
    • IPCX — for calculation specifications with extended Factor 2
    • IPO — for output specifications
    • IPP — for output specifications continuation
    • IPPR — for procedure specifications
    Figure 2. Source for EMPRPT member
          * MODULE NAME:    EMPRPT
          *                 QSYSPRT  (PRINTER FILE)
          * DESCRIPTION:    This program prints employee information
          *                 from the file EMPMST.
         FQSYSPRT   O    F   80        PRINTER
         FEMPMST    IP   E           K DISK
         D TYPE            S              8A
         D EMPTYPE         PR             8A
         D   CODE                         1A
         IEMPREC        01
         C                   EVAL      TYPE = EMPTYPE(ETYPE)
         OPRINT     H    1P                     2  6
         O                                           50 'EMPLOYEE INFORMATION'
         O          H    1P
         O                                           12 'NAME'
         O                                           34 'SERIAL #'
         O                                           45 'DEPT'
         O                                           56 'TYPE'
         O          D    01
         O                       ENAME               20
         O                       ENUM                32
         O                       EDEPT               45
         O                       TYPE                60
          * Procedure EMPTYPE returns a string representing the employee
          *   type indicated by the parameter CODE.
         P EMPTYPE         B
         D EMPTYPE         PI             8A
         D   CODE                         1A
         C                   SELECT
         C                   WHEN      CODE = 'M'
         C                   RETURN    'Manager'
         C                   WHEN      CODE = 'R'
         C                   RETURN    'Regular'
         C                   OTHER
         C                   RETURN    'Unknown'
         C                   ENDSL
         P EMPTYPE         E
  5. Press F3 (Exit) to go to the Exit display. Type Y (Yes) to save EMPRPT.

    The member EMPRPT is saved.

Figure 3 shows the DDS which is referenced by the EMPRPT source.

Figure 3. DDS for EMPRPT
     A* DESCRIPTION:  This is the DDS for the physical file EMPMST.   *
     A*               It contains one record format called EMPREC.    *
     A*               This file contains one record for each employee *
     A*               of the company.                                 *
     A          R EMPREC
     A            ENUM           5  0       TEXT('EMPLOYEE NUMBER')
     A            ENAME         20          TEXT('EMPLOYEE NAME')
     A            ETYPE          1          TEXT('EMPLOYEE TYPE')
     A            EDEPT          3  0       TEXT('EMPLOYEE DEPARTMENT')
     A            ENHRS          3  1       TEXT('EMPLOYEE NORMAL WEEK HOURS')
     A          K ENUM

To create a program from this source use the CRTBNDRPG command, specifying DFTACTGRP(*NO).