RPG Programming - FVTC IT | Home

Download Report

Transcript RPG Programming - FVTC IT | Home

RPG Programming
Test One Review
Chapter One
• RPG: Report Program Generator
– Released in the early 60’s
•
•
•
•
RPGII – released with System/3
RPGIII – 1970’s
RPG/400 – Release with the AS/400
RPGIV - 1994
– Higher Level Language
– Procedural Language
Chapter One
– First released with a Fixed Logic Cycle
– Uses Indicators
– Built in variables with value of 0 or 1
– Now it is procedural
– Program Variables – represents a location in
the memory of the computer that can store
data.
Chapter One
• Printer Spacing Chart
– Output Editing
• Syntax errors: errors in your use of the
rules of the language
• Logic errors: errors in design
• Debugging: discovering and correcting
errors
Chapter One
• Use SEU to enter source code
• Compile the course code
• Call the compiled object
Chapter Two
• File Description Specifications (F
Specs)
– Identifies the files your program uses
– Identifies how the files will be used
– Recommended entries (F Prompt):
•
•
•
•
•
•
File Name
File Type
File Designation
File Format
Record Length
Device
Chapter Two
• Input Specifications (I Specs)
– Record Identification Entries (I Prompt)
• File Name
• Sequence
– Field Description Entries (J Prompt)
• Field Location
• Decimal Positions
• Field Name
Chapter Two
• Calculation Specifications: Describes
processing steps
– Operation Code
– Factor 2/ Extended Factor 2 (C or CX Prompt)
Chapter Two
– Op Codes:
• EXCEPT: Directs the program to output lines from
the O Specs
• READ: Retrieve the next sequential record
• DOW: Do while loop, requires an ENDDO to
signal the end of the loop
• EVAL: Used to assign a value to a variable
• RETURN: Returns control to the program that
called.
Chapter Two
• Output Specifications (O Specs)
– Record Identification Entries (O Prompt)
•
•
•
•
File name
Type
Exception Name
Space and Skip Entries
– Field Description Entries (P Prompt)
•
•
•
•
Field Name
Constants
End Position
Edit Codes
Chapter Two
• Output Editing: Formatting output values
– Edit Codes
– Edit Words
Chapter Three
• Definition Specifications (D Specs): used
to define additional fields used in
programming but are not from an input file.
– Standalone Fields:
• Numeric Literal
• Character Literal
• Figurative Constants
– *BLANKS, *HIVAL, *ZERO, *ON, *OFF…
Chapter Three
• Initial Value: Value field contains at
programs start.
• Data Types (p. 43)
• Defining Constants:
– Value never changes during processing
– Defined with no specified length
Chapter Three
• Data Structures: means of organizing
multiple fields within a single section of
contiguous portions of memory
Chapter Four
• EVAL: Assigns a value to a field
– Uses the Extended Factor 2 format
– Supports the following arithmetic operators
•
•
•
•
•
•
•
•
+ addition
- subtraction
* Multiplication
/ Division
**Exponentiation
() Parentheses
<> Relational Symbols
AND OR Logical operators
Chapter Four
• Truncation: loss of digits from the right/or
left end of a result field
– High order Truncation
– Low order Truncation
Chapter Four
• Determining Field Sizes: (See chart)
• Rounding (Half Adjusting)
– (H)
• Result Decimal Position Rule
– (R)
• Line Continuation Character +
Chapter Four
• Character assignment also works with the
Eval Statement.
• Can also assign values with figurative
constants: (*Blanks, *Zero, etc..)
Chapter Four
• Data Type Conversion
– MOVE Operation: Value in Factor2 is copied
to the result field, character by character from
right to left.
– MOVEL Operation: Value in Factor2 is copied
to the result field, character by character from
left to right.
Chapter Four
• Built in Functions:
– %ABS (Absolute Value)
– %DIV (Divide, return Integer result)
– %REM (Divide, return Remainder)