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.
See Using the application development tools in the client product for information about getting started with the client tools.
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:
CRTLIB LIB(MYLIB)
The CRTLIB command creates a library called MYLIB.
CRTSRCPF FILE(MYLIB/QRPGLESRC) RCDLEN(112)
TEXT('Source physical file for ILE RPG programs')
The CRTSRCPF command creates a source physical file QRPGLESRC in library MYLIB.
STRSEU SRCFILE(MYLIB/QRPGLESRC)
SRCMBR(EMPRPT)
TYPE(RPGLE) OPTION(2)
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 27. Note that the screen is automatically shifted so that position 6 is (for specification type) at the left edge.
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. +
*===============================================================*
* MODULE NAME: EMPRPT
* RELATED FILES: EMPMST (PHYSICAL FILE)
* 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
The member EMPRPT is saved.
Figure 29 shows the DDS which is referenced by the EMPRPT source.
A*****************************************************************
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*****************************************************************
A*
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).