230 likes | 338 Views
RPG III. C Specs - Opcodes. Add. qty1 add qty2 qty3 or add qty qty3. Sub. qty1 sub qty2 diff or sub qty diff. Mult. price mult qty sales or mult 0.14 sales. Div. sales div qty price or div qty sales. Read.
E N D
Add qty1 add qty2 qty3 or add qty qty3
Sub qty1 sub qty2 diff or sub qty diff
Mult price mult qty sales or mult 0.14 sales
Div sales div qty price or div qty sales
Read • Reads the next record from a database object (sequential read) read sales 99 will ‘turn on’ indicator 99 if the end of file is reached.
EXCPT (EXCEPT) • Writes output to printer files excpt format
SETON • Sets an indicator to ‘1’ seton 99
SETOF • Sets an indicator to ‘0’ setof 99
IF • RPG, RPGII, RPGIII • IFEQ, IFNE, IFLE, IFLT, IFGT, IFGE, etc • Ends with endif qty ifeq 0 endif • RPGIV free format • If • Ends with endif If qty = 0; Endif;
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;
Externally Described Files - SQL • Physical files created with SQL are a problem for RPG as the record format name is the same as the file name. • Use rename to resolve this SALESmast IF E DISK rename(salesmast:salesmastr)
CVTRPGSRC • Converts an RPGIII program to RPGIV • Expands factor sizes • Substitutes 5 character opcodes for 6 character equivalents • Creates definition specs for tables and arrays
EVAL • Executes an expression • RPG IV only • As an assignment eval *inlr = *on • As a mathematical expression eval counter = counter + 1
%eof function • RPGIV only • Checks the physical file for the end of file condition • Returns ‘1’ if end of file • Returns ‘0’ is a record is found Syntax: %eof(sales)
D-Specs (Definition) • Standalone variables • Named constants • Data Structures • Prototypes • Procedure Interfaces
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
D-Specs • Length • Length of Data • Decimal Places • Number of decimal places • Data type