System i Resources
enskill.com

 

Onsite Classes
Expert System i training comes to you! RPG, SQL, WDSc and more.
 

DVD Training
Self-paced RPG IV classes and labs on your schedule.
 

System i Books
from leading System i authors.
 

e-Learning
Live instructor, no travel. Attend from your office or home.
 

Fixed Format

Note: This form of the Calculation specification should be considered obsolete. The preferred form is the Free Format specification.

 *.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8
 CL0N01Factor1+++++++Opcode(E)+Factor2+++++++Result++++++++Len++D+HiLoEq....
 CL0N01Factor1+++++++Opcode(E)+Extended-factor2+++++++++++++++++++++++++++++
 C.............................Extended-factor2-continuation++++++++++++++++
Columns Description
1–5 Sequence number
6 C
7-8 Control level: Blank, L0, L1–L9, LR, SR, AN, OR
9-11 Conditioning indicators: Blank, 01–99, KA–KN, KP–KY, L1–L9, LR, MR, H1–H9, RT, U1–U8, OA–OG, OV
12-25 Factor 1
26-35 Operation code, with optional extender(s)
36-49
or 36-80
Factor 2, or extended Factor 2
50-53 Result field
64-68 Result field length
69-70 Result field decimal positions
71-76 Resulting indicators (high/low/equal): Blank, 01–99, KA–KN, KP–KY, H1–H9, L1–L9, LR, RT, U1–U8, OA–OG, OV
77-80 (Blank)
81–100 Comments

Fixed Format (Only) Operation Codes

Opcode Description Free Format Alternative
ADD Add two values together Expression with + or +=
ADDDUR Add duration Expression with + or += and duration functions
ALLOC Allocate storage %ALLOC
ANDxx And operation AND
BITOFF Set bits off BITNOT
BITON Set bits on %BITOR
CABxx Compare and branch LEAVE, LEAVESR, ITER, RETURN
CALL Call a program CALLP
CALLB Call a bound procedure CALLP
CASxx Conditionally invoke subroutine EXSR
CAT Concatenate two character strings Expression with +
CHECK Check characters %CHECK
CHECKR Check characters (reversed) %CHECKR
COMP Compare two values Expression with =, <, >, <=, >= or <>
DEFINE Field definition LIKE, DTAARA (Definition specification)
DIV Divide operation Expression with /, /= or %DIV
DO Begin a DO group FOR
DOUxx Do until xx DOU
DOWxx Do while xx DOW
EXTRCT Extract date/time/timestamp %SUBDT
GOTO Go to label LEAVE, LEAVESR, ITER, RETURN
IFxx If xx IF
KFLD Define parts of a key Data structure ( Definition Specification ), with %KDS
KLIST Define a composite key Data structure ( Definition Specification ), with %KDS
LOOKUP Look up element in an array or table TLOOKUP
MHHZO Move high to high zone BITOR
MHLZO Move high to low zone BITOR
MLHZO Move low to high zone BITOR
MLLZO Move low to low zone BITOR
MOVE Move characters from source field to target field EVAL, EVALR
MOVEA Move array %SUBARR
MOVEL Move left EVAL
MULT Multiply Expression with * or *=
MVR Move remainder %REM
OCCUR Get or set occurrence of a data structure %OCCUR
ORxx Or condition xx OR
PARM Identify parameters Prototype ( Definition Specification )
PLIST Identify a parameter list Prototype ( Definition specification )
REALLOC Reallocate storage with new length %REALLOC
SCAN Scan character string %SCAN
SETOFF Set indicator off Expression
SETON Set indicator on Expression
SHTDN Shut down %SHTDN
SQRT Square root %SQRT
SUB Subtract Expression with – or -=
SUBDUR Subtract duration Expression with + or += and duration functions, or %DIFF
SUBST Substring %SUBST
TAG Tag LEAVE, LEAVESR, ITER, RETURN
TESTB Test value of bit field %BITAND
TESTN Test numeric MONITOR, ON-ERROR
TESTZ Test zone %BITAND
TIME Time of day TIME, %TIMESTAMP
WHENxx When true then select WHEN
XFOOT Sum the elements of an array %XFOOT
XLATE Translate %XLATE
Z-ADD Zero and add Expression
Z-SUB Zero and subtract Expression

Usage Conventions for syntax tables


Index | HomePage | Programming | RPG IV | Fixed Format