List of Figures


Chapter 1: Introduction

Figure 1.1: PL/I example.
Figure 1.2: RPG code example.
Figure 1.3a: An RPG code example using the SELECT-WHEN operations.
Figure 1.3b: An RPG code example using the IF/ELSEIF in-line case.
Figure 1.4: Read a file, calculate price, and update file.
Figure 1.5: Example of indicator usage.
Figure 1.6: Logic of the program code shown in Figure 1.5.
Figure 1.7: Rewriting code without indicators.
Figure 1.8: Pseudocode for Figure 1.7.
Figure 1.9: Example of the attention-identification byte.
Figure 1.10: Examples of named constants
Figure 1.11: Example of RPG directives.

Chapter 2: Specification Formats

Figure 2.1: Header (control) specification ruler.
Figure 2.2: File specification ruler.
Figure 2.3: Definition specification.
Figure 2.4: Extended name specification.
Figure 2.5: Special reserved positions ("star position") specification.
Figure 2.6: Field definition specification.
Figure 2.7: Extended name declarations.
Figure 2.8: Program-described file input specification ruler.
Figure 2.9: Program-described file continuation input specification ruler.
Figure 2.10: Program-described field input specification ruler
Figure 2.11: Externally described file format input specification ruler.
Figure 2.12: Externally described field input specification ruler.
Figure 2.13: Standard calculation specification.
Figure 2.14: Alternate calculation specification with extended factor 2.
Figure 2.15: Output header specification.
Figure 2.16: Output header continuation specification.
Figure 2.17: Output field specification.
Figure 2.18: Procedure specification ruler.
Figure 2.19: An edit-word example with the floating currency symbol.
Figure 2.20: An example of edit-word usage.
Figure 2.21: An example using the custom currency symbol.
Figure 2.22: Code example with compile-time arrays.
Figure 2.23: Sample output from program shown in Figure 2.22.

Chapter 3: Expressions

Figure 3.1: Examples of assignment expressions.
Figure 3.2: Expressions on conditional statements.
Figure 3.3: Expressions on the definition specification.
Figure 3.4: Expressions in free format RPG.

Chapter 4: Built-In Functions

Figure 4.1: Example usage of a built-in function.
Figure 4.2: An example of the %ABS built-in function.
Figure 4.3: An example of the %ADDR built-in function.
Figure 4.4: An example of the %CHAR built-in function.
Figure 4.5: An example of the %DECPOS built-in function.
Figure 4.6: Example of %DIV built-in function.
Figure 4.7: An example of the %EDITC built-in function.
Figure 4.8: An example of the %EDITW built-in function.
Figure 4.9: An example of the %ELEM built-in function.
Figure 4.10: An example of the %EOF built-in function.
Figure 4.11: An example of the %EQUAL built-in function.
Figure 4.12: An example of the %ERROR built-in function.
Figure 4.13: An example of the %FLOAT built-in function.
Figure 4.14: An example of the %FOUND built-in function.
Figure 4.15: An example of the %GRAPHIC built-in function.
Figure 4.16: Example of %INT built-in function.
Figure 4.17: Example of %LEN built-in function.
Figure 4.18: An example of the %NULLIND built-in function.
Figure 4.19: Multiple occurrence data structure use of %OCCUR function.
Figure 4.20: An example of the %OPEN built-in function.
Figure 4.21: An example of the %PADDR built-in function.
Figure 4.22: An example of the %PARMS built-in function.
Figure 4.23: An example of the %REM built-in function.
Figure 4.24: An example of the %SCAN built-in function.
Figure 4.25: An example of the %SIZE built-in function.
Figure 4.26: An example of the %STATUS built-in function.
Figure 4.27: An example of the %STR built-in function.
Figure 4.28: Example of %SUBST built-in function.
Figure 4.29: An example of the %TRIM built-in function.
Figure 4.30: The result of the %TRIM function shown in Figure 4.29.
Figure 4.31: An example of the %UNS built-in function.
Figure 4.32: An example of the %XFOOT built-in function.

Chapter 5: Operation Codes

Figure 5.1: Logic flow of the two forms of CASxx.
Figure 5.2: Contents of fields used in Example 5.19.
Figure 5.3: Diagram of mainline flow with EXSR.
Figure 5.4: Syntax of the FOR/ENDFOR operation.
Figure 5.5: The two forms of IF-THEN-ELSE.
Figure 5.6: Definitions of fields used in MOVE and MOVEL examples.
Figure 5.7: The SETLL operation by relative record number.

Chapter 6: Program Organization

Figure 6.1: Source file structure with mainline procedure.
Figure 6.2: Source member with embedded procedures.
Figure 6.3: Source file transition to *PGM object.
Figure 6.4: Scope of global and local variables.
Figure 6.5: Independent source files.
Figure 6.6: Modules sharing IMPORT/EXPORT data.

Chapter 7: Modern Operation Code Usage

Figure 7.1: Indicator-controlled branching.
Figure 7.2: Traditional RPG II-style indicator usage.
Figure 7.3: Multi-indicator controlled branching.
Figure 7.4: Traditional multi-indicator control logic
Figure 7.5: An example of "IF" controlled program logic.
Figure 7.6: Combined indicator/DO controlled logic.
Figure 7.7: Combining DO and IF operations.
Figure 7.8: DO-loop controlled level-break processing.
Figure 7.9: Traditional level-break processing.
Figure 7.10: DO UNTIL controlled logic
Figure 7.11: DO WHILE controlled logic.
Figure 7.12: Compare and branch operations.
Figure 7.13: Compare and GOTO operations.
Figure 7.14: IF and GOTO operations.
Figure 7.15: COMP operation used to communicate with a DEVICE file.
Figure 7.16: IF and SETON used to communicate with a DEVICE file.
Figure 7.17: Using IF to test a range of values.
Figure 7.18: Traditional RPG code used to test a range of values.
Figure 7.19: IF with OR to test for a list of values.
Figure 7.20: Traditional RPG COMP operation to test a list of values.
Figure 7.21: Equivalent mathematical operations.
Figure 7.22: Mathematical operations with rounding.

Chapter 8: Structured Programming

Figure 8.1: Hierarchy chart of a top-down design.
Figure 8.2: An outline for a top-down development approach.
Figure 8.3: Program code for customer inquiry.
Figure 8.4: Program code to update an order's line item.
Figure 8.5: The IF operation used in choice selection.
Figure 8.6: The DOW operation used as repetition.
Figure 8.7: The FOR loop used for repetition.
Figure 8.8: Coding an intermediate result for comparison.
Figure 8.9: Using IF to eliminate the need for an intermediate result field.
Figure 8.10: An example of preferred coding.
Figure 8.11: The two forms of CASE.
Figure 8.12: Successive CASE operations sample code.
Figure 8.13: CASE-controlled logic module.

Chapter 9: Inter-Module Communication

Figure 9.1: Hierarchy chart of a modular application.
Figure 9.2: Flowchart definition symbol.
Figure 9.3: Program-to-program call.
Figure 9.4: Parameter list definition using a named parameter list.
Figure 9.5: Entry parameter list.
Figure 9.6: Parameter passing by reference.
Figure 9.7: MATH parameter values.
Figure 9.8: PGMA calls PGMB with a named parameter list.
Figure 9.9: PGMB source—the called program.
Figure 9.10: PGMA source—unnamed parameter list.
Figure 9.11: Parameter movement upon calling a program.
Figure 9.12: Parameter movement upon entering a called program.
Figure 9.13: Parameter movement upon exiting a called program.
Figure 9.14: Parameter movement upon returning to the calling program.
Figure 9.15: Data structure used as a parameter.
Figure 9.16: Program receiving a data structure as a parameter.
Figure 9.17: Passing data to subprocedures.
Figure 9.18: Before-images and after-images of the name field.
Figure 9.19: Prototypes for three conversion procedures.
Figure 9.20: Procedure interface for TOUPPER.
Figure 9.21: Procedure interface for MAKEUPPER.
Figure 9.22: Passing a data structure to a subprocedure.
Figure 9.23: Data area declarations.
Figure 9.24: Data area data structure specification.
Figure 9.25: Externally described data area.
Figure 9.26: Data area data structure.
Figure 9.27: Data structure as data area host variable.
Figure 9.28: Stand-alone field as data area host variable.
Figure 9.29: Data structure subfield as data area host variable.
Figure 9.30: The DEFINE operation used in defining data area.

Chapter 10: Procedures

Figure 10.1: Procedures stored in separately compiled modules.
Figure 10.2: Source file structure with mainline procedure.
Figure 10.5: Procedure and program prototypes.
Figure 10.6: Simple procedure prototype.
Figure 10.7: Example use of prototyped procedure.
Figure 10.8: Type 1 source file.
Figure 10.9: Type 3 source file with NOMAIN.
Figure 10.10: Prototype for the operational description API.
Figure 10.11: Using operational descriptor.

Chapter 11: File Processing

Figure 11.1: File description for a full-procedural DISK file.
Figure 11.2: DDS source to define a database file.
Figure 11.3: Random access of a database file using the CHAIN operation.
Figure 11.4: Database file with multiple key fields.
Figure 11.5: Random access of a database file with multiple key fields.
Figure 11.6: Random access of a database file by partial key.
Figure 11.7: Sequential access by key of the product structure file.
Figure 11.8: Logical file DDS.
Figure 11.9: Logical file DDS with dynamic SELECT/OMIT.
Figure 11.10: DDS of a primary physical file.
Figure 11.11: DDS of a secondary physical file.
Figure 11.12: DDS of a join logical file.
Figure 11.13: DDS for the order history file.
Figure 11.14: Processing by access path with a key list.
Figure 11.15: Associated file access source code.

Chapter 12: Alternate Syntax Options

Figure 12.1: Traditional fixed-format calculations.
Figure 12.2: Enhanced/alternative format calculations
Figure 12.3: Free-format calculations
Figure 12.4: Adding X to Y
Figure 12.5: Traditional commants
Figure 12.6: Free-format comments
Figure 12.7: Traditional syntax RPG with alternate comment syntax
Figure 12.8: Array and data structure syntax in enhanced calculation syntax
Figure 12.9: Array and Data Structure Syntax in Free Format Syntax
Figure 12.10: Date Manipulation using free-format syntax.
Figure 12.11: Using %DATE, %TIME, and %TIMESTAMP
Figure 12.12: Traditional RPG IV code to fill a subfile.
Figure 12.13: Fixed-format RPG IV code to fill a subfile.

Appendix B: Decimal Data Errors

Figure B.1: Storage for a five-position zoned decimal field (value 3741).
Figure B.2: Another representation of a zoned decimal field with a value of 3741.
Figure B.3: Storage for a seven-position packed decimal field (value 0).
Figure B.4: Storage for a seven-position packed decimal positive field (value 1207.38).

Appendix C: DDS Date and Time Format Considerations

Figure C.1: Internal storage format for date values.
Figure D.3: *LOVAL and *HIVAL for date and time fields.

Appendix D: Source Code Listings

Figure D.1: ZINCLUDE prototypes for ZTOOLS (part 1 of 2).
Figure D.2: ZTOOLS example procedures— Day of Week Ordinal.
Figure D.3: ZTOOLS example procedures— Day of Week Text.
Figure D.4: ZTOOLS example procedures— Return as Upper Case String.
Figure D.5: ZTOOLS example procedures— Convert to Uppercase.
Figure D.6: ZTOOLS example procedures— Return Length of Input String.
Figure D.7: Prototype for CEEGSI (Get String Information).
Figure D.8: Prototype for CEEDOD (Get Operation Descriptor).
Figure D.9: Function key attention identification bytes.
Figure D.10: Program status data structure.




The Modern RPG IV Language
The Modern RPG IV Language
ISBN: 1583470646
EAN: 2147483647
Year: 2003
Pages: 156
Authors: Robert Cozzi

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net