Professional Documents
Culture Documents
RPG IV Introduction
1-1
Interactive applications
RPG/400
1990 AS/400 Enhancements
New operation codes Named constants Initialization subroutines Source code indentation
OL861115
Available beginning with V3R1 Component of ILE RPG for AS/400 Program Product Expanded or eliminated language limits Fulfill RPG programmers requirements Longer field names Free form expressions Date/time calculations supported Positioned for future growth ILE Part of OS/400 beginning with V2R3 More modularity
OL861120
Development Cycle
Define the problem Design the solution Write the program Test and debug the program Document the program Maintain the program
OL861125
1-8
OL86110L
Count each employee record read Write detail employee information Read an employee record
Print total number of employees End program
OL861130
1-10
OL861135
RPG IV Specifications
Seven types of Specifications:
Control Specifications File description Specifications Definition Specifications Input Specifications Calculation Specifications Output Specifications Procedure Specifications
Specific functions
Copyright IBM Corp. 1996, 2000 1-11
Fixed-position / free-form
OL861140
Print Program
FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords.................... ** ** Define the files ** FEmp_Mast IF E Disk FEmp_ReportO E Printer DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords++++++++Comments ** ** Define program work fields ** D Count S 3 0 CL0N01Factor1+++++++Opcode&ExtFactor2+++++++Result++++++++Len++D+HiLoEq ** ** Process data records ** C Read Emp_Mast ----40 ** ** Have we read a record? ** C If NOT (*in40) C Eval Count = Count + 1 C Write Detail C Endif ** ** At EOF, write total and terminate program by setting on LR ** C If *In40 C Write Total C Eval *InLR = *ON C Endif
OL861145
1-12
1-13
OL861150
1-14
OL861155
1-15
OL861160
1-17
OL861170
Compiler Directives
Format the listing
/COPY
Conditionally include / exclude code
/DEFINE /UNDEFINE
Documentation / readability
*
OL861175
1-19
OL861205
Output Report
Page: 1 NAME Haas Thompson Kwan Geyer Stern Pulaski Henderson Spenser Lucchesi O Connell Quintana Nicholls Adamson Pianka Yoshimura Scoutten Walker Brown Jones Lutz Jefferson Marino Smith Johnson Perez Schneider Parker Smith Setrignt Mehta Lee Gounot NUMBER OF EMPLOYEES EMPLOYEE INFORMATION SERIAL # 000010 000020 000030 000050 000060 000070 000090 000100 000110 000120 000130 000140 000150 000160 000170 000180 000190 000200 000210 000220 000230 000240 000250 000260 000270 000280 000290 000300 000310 000320 000330 000340 32
OL861210
DEPT A00 B01 C01 E01 D11 D21 E11 E21 A00 A00 C01 C01 D11 D11 D11 D11 D11 D11 D11 D11 D21 D21 D21 D21 D21 E11 E11 E11 E11 E21 E21 E21
TYPE REGULAR MANAGER MANAGER MANAGER MANAGER MANAGER MANAGER MANAGER REGULAR REGULAR REGULAR REGULAR REGULAR REGULAR REGULAR REGULAR REGULAR REGULAR REGULAR REGULAR REGULAR REGULAR REGULAR REGULAR REGULAR REGULAR REGULAR REGULAR REGULAR REGULAR REGULAR REGULAR
1-20
1-21
1-22
1-23
OL86120L
Unit Summary
Having completed this unit, you should be able to:
Describe the evolution of RPG as a high level language Explain the general purpose of each RPG IV specification type List the order of RPG IV specification entries in a program Describe the steps to code and test an RPG IV program List several unique features of the RPG language and discuss RPGs