Table 5.2 lists RPG operations along with brief descriptions.
Op Code | Description |
---|---|
ACQ | Acquire a program device. |
ADD | Add two values together. |
ADDDUR | Add duration to a DATE, TIME, or TIMESTAMP value. |
ALLOC | Allocate memory and runtime. |
ANDxx | Extend IFxx, DOWxx, DOUxx, and WHENxx conditioning. |
BEGSR | Begin a subroutine. |
BITOFF | Set off individual bits with a field. |
BITON | Set on individual bits with a field. |
CABxx | Compare two values, then branch to a label. |
CALL | Call another program. |
CALLB | Call a bound-in procedure. |
CALLP | Call with prototype. |
CASxx | Compare two values, then call a subroutine. |
CAT | Concatenate factor 1 to factor 2. |
CHAIN | Random file access by index. |
CHECK | Verify the data in factor 2 against factor 1 (from left to right). |
CHECKR | Verify the data in factor 2 against factor 1 (from right to left). |
CLEAR | Clear data structure, variable, or record format. |
CLOSE | Close a file. |
COMMIT | Commitment control, commit group. |
COMP | Compare two values and set on/off resulting indicators. |
DEFINE | Define one field like another field. |
DEALLOC | Release memory back to the system at runtime. |
DELETE | Delete a database record. |
DIV | Divide two values. |
DO | Begin DO loop with an optional counter. |
DOU | Begin DO UNTIL loop using expression conditioning. |
DOUxx | Begin DO UNTIL loop. |
DOW | Begin DO WHILE loop using expression conditioning. |
DOWxx | Begin DO WHILE loop. |
DSPLY | Display a message at the workstation. |
DUMP | Print a formatted dump. |
ELSE | Else clause, used in conjunction with the IFxx operation. |
ELSEIF | A combined ELSE and IF statement. |
END | End a DO, DOWxx, DOUxx, CASxx, IFxx, or SELECT group. |
ENDCS | End a CASxx group. |
ENDDO | End a DO, DOWxx ,or DOUxx loop. |
ENDFOR | End a FOR loop. |
ENDIF | End an IFxx group. |
ENDMON | End a MONITOR/ON-ERROR group. |
ENDSL | End a SELECT group. |
ENDSR | End of a subroutine. |
EVAL | Evaluate an expression. Left justifies result for character expressions. |
EVALR | Evaluate an expression. Right justifies result for character expressions. |
EXCEPT | Write a program-defined or externally described record format. |
EXFMT | Write, and then read, a workstation device. |
EXSR | Call an intra-program subroutine. |
EXTRCT | Extract a component of a DATE, TIME, or TIMESTAMP value. |
FEOD | Cause a file "cursor" reset; free locked records. |
FOR | Begin a FOR loop using expression syntax. |
FORCE | Force input priority alteration. |
GOTO | Perform an unconditional branch to a label. |
IFxx | Compare two values and perform a block of code. |
IN | Retrieve an external data area's data. |
ITER | Iterate a DO, DOWxx, or DOUxx loop. |
KFLD | Define a key field of a key list. |
KLIST | Define a key list used to access an indexed file. |
LEAVE | Leave a DO, DOWxx, or DOUxx loop. |
LEAVESR | Leave the current subroutine and immediately return to its caller. |
LOOKUP | Search an array or table for like or unlike elements. |
MHHZO | Move high zone to high zone. |
MHLZO | Move high zone to low zone. |
MLHZO | Move low zone to high zone. |
MLLZO | Move low zone to low zone. |
MONITOR | Begin a block of code that is monitored for errors. |
MOVE | Copy data, right-justified, from a field or constant to field. |
MOVEA | Copy data, left-justified, to all successive array elements. |
MOVEL | Copy data, left-justified, from a field or constant to a field. |
MULT | Multiply two values. |
MVR | Copy the remainder of a preceding division to a field. |
NEXT | Force the next input cycle to read input from a specific device. |
OCCUR | Set/get the occurrence of a multiple occurrence data structure. |
ON-ERROR | Begin an error trap block of code. |
OPEN | Open a file. |
ORxx | Extend IFxx, DOWxx, DOUxx, and WHENxx conditioning. |
OTHER | Otherwise clause of a SELECT/WHEN group. |
OUT | Update an external data area. |
PARM | Define a parameter field within a parameter list. |
PLIST | Define a parameter list. |
POST | Retrieve and post device-specific information to a data structure. |
READ | Read from a file. |
READC | Read next changed subfile record. |
READE | Read the next data file record with equal key index. |
READP | Read previous data file record. |
READPE | Read previous data file record with equal key index. |
REALLOC | Reallocate memory of a new size at runtime. |
REL | Release an acquired program device. |
RESET | Reset a variable to its initial value. |
RETURN | Return to calling program. |
ROLBK | Commitment control, roll back group. |
SCAN | Scan argument for search pattern and return position. |
SELECT | Begin an in-line SELECT/WHEN case group. |
SETGT | Set the file cursor greater than the specified index. |
SETLL | Set the file cursor less than the specified index. |
SETOFF | Set an indicator off. |
SETON | Set an indicator on. |
SHTDN | Test for system shut down. |
SORTA | Sort an array. |
SQRT | Compute the square root of a number. |
SUB | Subtract one value from another. |
SUBDUR |
|
SUBST | Copy substring value in factor 2 to the result field. |
TAG | Define the location and name of a label. |
TESTB | Test bit pattern. |
TESTN | Test character field for numeric data. |
TESTZ | Test the zone of the rightmost position of a field. |
TEST | Test for a valid DATE, TIME, or TIMESTAMP value. |
TIME | Retrieve the system time and date. |
UNLOCK |
|
UPDATE | Update a file. |
WHENxx | When select condition is true, then do. |
WRITE | Write to a file. |
XFOOT | Cross foot (sum up) an array. |
XLATE | Translate factor 2 using translate data in factor 1. |
Z-ADD | Zero and add numeric. |
Z-SUB | Zero and subtract numeric. |