Download presentation
Presentation is loading. Please wait.
Published byWilla Arnold Modified over 9 years ago
1
Welcome to RPG544
2
Bit about Cindy
3
Administrative Stuff Standards Due Dates Web Page
4
RPG IV R – Report P – Program G – Generator Version 4
5
History of RPG 1964: RPG - Report Program Generator 1969: RPG II –With release of System/3 1979: RPG III –Interactive programming –Database –Structured Programming 1988: RPG/400 –Upgrade to RPG III 1994: RPG IV –Integrated Language Environment (ILE) –Modular Programming
6
Things that made RPG unique Program Cycle Read a record Loop until Eof process the record read a record End of loop Indicators
7
Specifications Programs are organized in a series of specifications and appear in this order Spec TypeDescriptionWhen Introduced HHeader (control)RPG FFileRPG DDefinitionRPG IV IInputRPG CCalculationRPG OOutputRPG PProcedureRPG IV
8
H-Specs (Control Specifications) Default formats (eg. Date formats) Changes to normal processing modes –Eg changing the internal method that the program uses to evaluate expressions Special options to use when compiling the program Language enhancements that effect the entire program H Datfmt(*ISO) Timfmt(*HMS)
9
F-Specs PositionUsePositionUse 7-16File Name23-27Record Length For program described 17File Type (I, U, or O) 36-49Device Disk, Printer, Workstation 18File Designation Blank – output file F – Full Procedural P – Primary File (logic cycle) S – Secondary File (logic Cycle) R – Record address file T – Table 44-80Keywords (see appendix A of text book) 22File Format F – Program Described E – Externally Described
10
D-Specs (Definition) Standalone variables Named constants Data Structures Prototypes Procedure Interfaces
11
D-Specs Data name –15 characters –Must start with a letter of the alphabet or $, # or @ –Remaining characters must be letters, numbers, _, #, $ or @ Declaration Type –DS – Data Structure –C – Constant –PR – Procedure –PI – Procedure Interface –S – Standalone Variable
12
D-Specs Length –Length of Data Decimal Places –Number of decimal places Data type
13
I-Specs (Field Definition) Used to define fields in the file PosUsePosUse 7 – 16Filename36Data Type 17 – 18Sequence NS – if no sequence required 2 digit number if sequence is required 37 – 46Field Location 19Number Leave blank 47 – 48Decimal Positions Required by numeric fields 20Option Leave blank 49 – 62Field Name 6 characters up to RPGIII 14 characters RPG IV 21 – 22Record id (indicator)
14
C-Specs (Calculation) Program logic! Factor1 Opcode Factor2 Result Indicators RPG IV introduces free form RPG for C- Specs
15
O-Specs (Output) Define the output of the program. May be report definitions or database. PosUsePosUse 7-16FileName30 - 43Field Names 17Type D-Detail H-Header E-Exception T-Total 53 – 80Constants / Edit Word 30 – 39Exception Name47 – 51End Position 40 – 45Skip and Space Entries52Edit code
16
P-Specs Will discuss later in the course
17
Add qty1addqty2qty3 or addqtyqty3
18
Sub qty1subqty2diff or subqtydiff
19
Mult pricemultqtysales or mult 0.14sales
20
Div salesdivqtyprice or div qtysales
21
Read Reads the next record from a database object (sequential read) readsales99 will ‘turn on’ indicator 99 if the end of file is reached.
22
EXCPT (EXCEPT) Writes output to printer files excpt format
23
IF RPG, RPGII, RPGIII –IFEQ, IFNE, IFLE, IFLT, IFGT, IFGE, etc –Ends with endif qtyifeq 0 endif RPGIV free format –If –Ends with endif If qty = 0; Endif;
24
Do Loops RPG, RPGII, RPGIII –DOWEQ, DOWNE, DOUEQ, DOUNE etc –Ends with ENDDO Qty Doweq 0 enddo RPGIV free format –DOW, DOU –Ends with ENDDO Dow qty < 0; enddo;
25
Itempgm Demo
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.