RPG NotesPart2
RPG NotesPart2
Use READC and CHAIN to read and update the data into the data base
SFLNXTCHG
Record-level keyword on the subfile record used to force the workstation user to correct
errors
The record will be retrieved from the subfile by a READC even if the user did not
modify any field in that record on the display
SFLFOLD/SFLDROP
Use these keywords to display the subfile initially in the folded or in the truncated format, if the
subfile record does not fit in one line
SFLDROP
Initial Look
Series or list of variables in computer memory, all of which have the same name but are
differentiated with special number called subscripts
Each array element occupies an area in memory next to, or contiguous to, the others
Types of Arrays
Compile-time:
Loaded when the program is created and it becomes part of the program. The data for
the array elements is supplied within the program
Pre-runtime:
Array is loaded from a file whenever the program is called, before any input, output or
calculation processing started
Run-time:
Loaded while the program is running. The execution of the program loads the array
Example - Runtime
Array Opcodes
LOKUP
SORTA
MOVEA
XFOOT
Data Structures
Uses
To Group fields
To split fields
As a parameter list
Types
Basic
Multiple Occurrence
Data Area
Program Status
File Information
Example Redefining
Initialization
Multiple Occurrence
Indicator specified in Low column will be set on if the factor 1 tries to position in DS, which out
of range
The data structure name and the data area name will be the same
The data structure name and the data area name will be the same
Using LDA as a DS
Another way
Using multiple Data Areas
This will reduce the coding of writing multiple IN and OUT statements
Ex: IN *NAMVAR
OUT *NAMVAR
Subprograms
Easier Maintenance
Even though the parameters are passed by reference, the indicator array is unique for each
program
SETON LR
RETRN
Complete the current cycle, return to calling program without ending the subprogram
SETON RT
LR Vs RT/RETRN
Subprogram Deactivation
Use RCLRSC
Use QCMDEXC
House Keeping
Run-time clearing and resetting of all elements record format, data structure, array, or a
variable (field, subfield, or indicator)
Opcodes:
CLEAR
RESET
*INZSR
Invoked
Exception/Error Handling
division by zero, not valid array index, SQRT of a negative number, Decimal Data Error,
Called program not found
Status Codes
Exception Handling Methods
Resulting indicator set in the LO column is used for trapping the error
UPDATE
CLOSE
WRITE
READ another in the same file for UPDATE
Release
UNLCK
EXCPT
Test Opcode
Opertion Extender
P in position 53