ILE RPG Reference - IBMpublic.dhe.ibm.com/systems/power/docs/systemi/v5r3/en_US/sc092… ·...
Transcript of ILE RPG Reference - IBMpublic.dhe.ibm.com/systems/power/docs/systemi/v5r3/en_US/sc092… ·...
-
iSeries
WebSphere®®
Development
Studio
ILE
RPG
Reference
Version
5
SC09-2508-05
ERserver
���
-
iSeries
WebSphere®®
Development
Studio
ILE
RPG
Reference
Version
5
SC09-2508-05
ERserver
���
-
Note!
Before
using
this
information
and
the
product
it
supports,
be
sure
to
read
the
general
information
under
“Notices”
on
page
795.
Sixth
Edition
(May
2004)
This
edition
applies
to
Version
5,
Release
3,
Modification
Level
0,
of
IBM®
WebSphere
Development
Studio
for
iSeries
(5722-WDS),
ILE
RPG
compiler,
and
to
all
subsequent
releases
and
modifications
until
otherwise
indicated
in
new
editions.
This
edition
applies
only
to
reduced
instruction
set
computer
(RISC)
systems.
This
edition
replaces
SC09-2508-04.
Order
publications
through
your
IBM
representative
or
the
IBM
branch
office
serving
your
locality.
Publications
are
not
stocked
at
the
address
given
below.
IBM
welcomes
your
comments.
You
can
send
your
comments
to:
IBM
Canada
Ltd.
Laboratory
Information
Development
8200
Warden
Avenue
Markham,
Ontario,
Canada
L6G
1C7
You
can
also
send
your
comments
by
FAX,
or
you
can
send
your
comments
electronically
to
IBM.
See
“How
to
Send
Your
Comments”
for
a
description
of
the
methods.
When
you
send
information
to
IBM,
you
grant
IBM
a
nonexclusive
right
to
use
or
distribute
the
information
in
any
way
it
believes
appropriate
without
incurring
any
obligation
to
you.
©
Copyright
International
Business
Machines
Corporation
1994,
2004.
All
rights
reserved.
US
Government
Users
Restricted
Rights
–
Use,
duplication
or
disclosure
restricted
by
GSA
ADP
Schedule
Contract
with
IBM
Corp.
|||
#
####
#
-
Contents
About
This
Reference
.
.
.
.
.
.
.
. xi
Who
Should
Use
This
Reference
.
.
.
.
.
.
. xi
Prerequisite
and
Related
Information
.
.
.
.
.
. xii
How
to
Send
Your
Comments
.
.
.
.
.
.
.
. xii
What's
New
.
.
.
.
.
.
.
.
.
.
.
.
.
. xii
Changes
to
this
Guide
Since
V5R1
.
.
.
.
.
. xiii
What's
New
This
Release?
.
.
.
.
.
.
.
.
. xiii
What's
New
in
V5R2?
.
.
.
.
.
.
.
.
.
. xvii
What's
New
in
V5R1?
.
.
.
.
.
.
.
.
.
.
. xx
What's
New
in
V4R4?
.
.
.
.
.
.
.
.
.
. xxv
What's
New
in
V4R2?
.
.
.
.
.
.
.
.
.
. xxix
What's
New
in
V3R7?
.
.
.
.
.
.
.
.
.
. xxxiii
What's
New
in
V3R6/V3R2?
.
.
.
.
.
.
. xxxvii
Part
1.
RPG
IV
Concepts
.
.
.
.
.
. 1
Chapter
1.
Symbolic
Names
and
Reserved
Words
.
.
.
.
.
.
.
.
.
.
. 3
Symbolic
Names
.
.
.
.
.
.
.
.
.
.
.
.
. 3
Array
Names
.
.
.
.
.
.
.
.
.
.
.
.
. 4
Conditional
Compile
Names
.
.
.
.
.
.
.
. 4
Data
Structure
Names
.
.
.
.
.
.
.
.
.
. 4
EXCEPT
Names
.
.
.
.
.
.
.
.
.
.
.
. 4
Field
Names
.
.
.
.
.
.
.
.
.
.
.
.
. 4
KLIST
Names
.
.
.
.
.
.
.
.
.
.
.
.
. 4
Labels
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 4
Named
Constants
.
.
.
.
.
.
.
.
.
.
.
. 4
PLIST
Names
.
.
.
.
.
.
.
.
.
.
.
.
. 5
Prototype
Names
.
.
.
.
.
.
.
.
.
.
.
. 5
Record
Names
.
.
.
.
.
.
.
.
.
.
.
.
. 5
Subroutine
Names
.
.
.
.
.
.
.
.
.
.
. 5
Table
Names
.
.
.
.
.
.
.
.
.
.
.
.
. 5
RPG
IV
Words
with
Special
Functions/Reserved
Words
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 5
User
Date
Special
Words
.
.
.
.
.
.
.
.
.
. 7
Rules
for
User
Date
.
.
.
.
.
.
.
.
.
.
. 7
PAGE,
PAGE1-PAGE7
.
.
.
.
.
.
.
.
.
.
. 8
Rules
for
PAGE,
PAGE1-PAGE7
.
.
.
.
.
.
. 8
Chapter
2.
Compiler
Directives
.
.
.
. 11
/FREE...
/END-FREE
(Positions
7-11)
.
.
.
.
.
. 11
/TITLE
(Positions
7-12)
.
.
.
.
.
.
.
.
.
. 11
/EJECT
(Positions
7-12)
.
.
.
.
.
.
.
.
.
. 11
/SPACE
(Positions
7-12)
.
.
.
.
.
.
.
.
.
. 12
/COPY
or
/INCLUDE
.
.
.
.
.
.
.
.
.
.
. 12
Results
of
the
/COPY
or
/INCLUDE
during
Compile
.
.
.
.
.
.
.
.
.
.
.
.
.
. 14
Nested
/COPY
or
/INCLUDE
.
.
.
.
.
.
. 14
Using
/COPY,
/INCLUDE
in
Source
Files
with
Embedded
SQL
.
.
.
.
.
.
.
.
.
.
.
. 14
Conditional
Compilation
Directives
.
.
.
.
.
. 15
Defining
Conditions
.
.
.
.
.
.
.
.
.
. 15
Predefined
Conditions
.
.
.
.
.
.
.
.
.
. 16
Condition
Expressions
.
.
.
.
.
.
.
.
.
. 17
Testing
Conditions
.
.
.
.
.
.
.
.
.
.
. 17
The
/EOF
Directive
.
.
.
.
.
.
.
.
.
. 19
Handling
of
Directives
by
the
RPG
Preprocessor
20
Chapter
3.
Program
Cycle
.
.
.
.
.
. 21
General
RPG
IV
Program
Cycle
.
.
.
.
.
.
.
. 21
Detailed
RPG
IV
Program
Cycle
.
.
.
.
.
.
. 22
Detailed
RPG
IV
Object
Program
Cycle
.
.
.
. 24
Initialization
Subroutine
.
.
.
.
.
.
.
.
. 28
Ending
a
Program
without
a
Primary
File
.
.
. 30
Program
Control
of
File
Processing
.
.
.
.
. 31
Chapter
4.
RPG
IV
Indicators
.
.
.
.
. 35
Indicators
Defined
on
RPG
IV
Specifications
.
.
. 35
Overflow
Indicators
.
.
.
.
.
.
.
.
.
. 35
Record
Identifying
Indicators
.
.
.
.
.
.
. 36
Control
Level
Indicators
(L1-L9)
.
.
.
.
.
. 37
Field
Indicators
.
.
.
.
.
.
.
.
.
.
.
. 45
Resulting
Indicators
.
.
.
.
.
.
.
.
.
. 46
Indicators
Not
Defined
on
the
RPG
IV
Specifications
47
External
Indicators
.
.
.
.
.
.
.
.
.
.
. 47
Internal
Indicators
.
.
.
.
.
.
.
.
.
.
. 48
Return
Indicator
(RT)
.
.
.
.
.
.
.
.
.
. 49
Using
Indicators
.
.
.
.
.
.
.
.
.
.
.
.
. 49
File
Conditioning
.
.
.
.
.
.
.
.
.
.
. 50
Field
Record
Relation
Indicators
.
.
.
.
.
. 50
Function
Key
Indicators
.
.
.
.
.
.
.
.
. 52
Halt
Indicators
(H1-H9)
.
.
.
.
.
.
.
.
. 53
Indicators
Conditioning
Calculations
.
.
.
.
. 54
Indicators
Used
in
Expressions
.
.
.
.
.
.
. 57
Indicators
Conditioning
Output
.
.
.
.
.
. 57
Indicators
Referred
to
As
Data
.
.
.
.
.
.
.
. 60
*IN
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 60
*INxx
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 60
Additional
Rules
.
.
.
.
.
.
.
.
.
.
. 61
Summary
of
Indicators
.
.
.
.
.
.
.
.
.
. 62
Chapter
5.
File
and
Program
Exception/Errors
.
.
.
.
.
.
.
.
.
. 65
File
Exception/Errors
.
.
.
.
.
.
.
.
.
.
. 65
File
Information
Data
Structure
.
.
.
.
.
.
. 65
File
Exception/Error
Subroutine
(INFSR)
.
.
. 79
Program
Exception/Errors
.
.
.
.
.
.
.
.
. 82
Program
Status
Data
Structure
.
.
.
.
.
.
. 83
Program
Exception/Error
Subroutine
.
.
.
.
. 91
Chapter
6.
Procedures
and
subprocedures
.
.
.
.
.
.
.
.
.
.
. 93
Subprocedure
Definition
.
.
.
.
.
.
.
.
.
. 94
Procedure
Interface
Definition
.
.
.
.
.
.
. 95
Return
Values
.
.
.
.
.
.
.
.
.
.
.
. 96
Scope
of
Definitions
.
.
.
.
.
.
.
.
.
. 96
Subprocedure
Calculations
.
.
.
.
.
.
.
. 97
NOMAIN
Module
.
.
.
.
.
.
.
.
.
.
.
. 100
©
Copyright
IBM
Corp.
1994,
2004
iii
||##
|
|
-
Mixing
Main
Procedures
and
Exported
Subprocedures
.
.
.
.
.
.
.
.
.
.
.
.
. 100
Implicit
Opening
of
Files
and
Locking
of
Data
Areas
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 100
Implicit
Closing
of
Files
and
Unlocking
of
Data
Areas
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 101
Initialization
of
Global
Data
.
.
.
.
.
.
. 101
Possible
Problems
.
.
.
.
.
.
.
.
.
.
. 101
Recommendations
.
.
.
.
.
.
.
.
.
.
. 101
Subprocedures
and
Subroutines
.
.
.
.
.
.
. 101
Chapter
7.
General
File
Considerations
.
.
.
.
.
.
.
.
.
.
. 103
Primary/Secondary
Multi-file
Processing
.
.
.
. 103
Multi-file
Processing
with
No
Match
Fields
.
. 103
Multi-file
Processing
with
Match
Fields
.
.
.
. 103
File
Translation
.
.
.
.
.
.
.
.
.
.
.
.
. 111
Specifying
File
Translation
.
.
.
.
.
.
.
. 112
Translating
One
File
or
All
Files
.
.
.
.
.
. 112
Translating
More
Than
One
File
.
.
.
.
.
. 113
Part
2.
Definitions
.
.
.
.
.
.
.
. 115
Chapter
8.
Defining
Data
and
Prototypes
.
.
.
.
.
.
.
.
.
.
.
. 117
General
Considerations
.
.
.
.
.
.
.
.
.
. 117
Scope
of
Definitions
.
.
.
.
.
.
.
.
.
. 118
Storage
of
Definitions
.
.
.
.
.
.
.
.
.
. 119
Standalone
Fields
.
.
.
.
.
.
.
.
.
.
.
. 119
Variable
Initialization
.
.
.
.
.
.
.
.
.
. 120
Constants
.
.
.
.
.
.
.
.
.
.
.
.
.
. 120
Literals
.
.
.
.
.
.
.
.
.
.
.
.
.
. 121
Named
Constants
.
.
.
.
.
.
.
.
.
.
. 125
Figurative
Constants
.
.
.
.
.
.
.
.
.
. 126
Data
Structures
.
.
.
.
.
.
.
.
.
.
.
.
. 128
Qualifying
Data
Structure
Names
.
.
.
.
.
. 129
Array
Data
Structures
.
.
.
.
.
.
.
.
. 129
Defining
Data
Structure
Parameters
in
a
Prototype
or
Procedure
Interface
.
.
.
.
.
. 130
Defining
Data
Structure
Subfields
.
.
.
.
. 130
Special
Data
Structures
.
.
.
.
.
.
.
.
. 132
Data
Structure
Examples
.
.
.
.
.
.
.
. 134
Prototypes
and
Parameters
.
.
.
.
.
.
.
.
. 145
Prototypes
.
.
.
.
.
.
.
.
.
.
.
.
. 145
Prototyped
Parameters
.
.
.
.
.
.
.
.
. 146
Procedure
Interface
.
.
.
.
.
.
.
.
.
. 148
Chapter
9.
Using
Arrays
and
Tables
151
Arrays
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 151
Array
Name
and
Index
.
.
.
.
.
.
.
.
. 152
The
Essential
Array
Specifications
.
.
.
.
. 152
Coding
a
Run-Time
Array
.
.
.
.
.
.
.
. 152
Loading
a
Run-Time
Array
.
.
.
.
.
.
.
. 152
Coding
a
Compile-Time
Array
.
.
.
.
.
.
. 154
Loading
a
Compile-Time
Array
.
.
.
.
.
. 154
Coding
a
Prerun-Time
Array
.
.
.
.
.
.
. 156
Example
of
Coding
Arrays
.
.
.
.
.
.
.
. 156
Loading
a
Prerun-Time
Array
.
.
.
.
.
.
. 157
Sequence
Checking
for
Character
Arrays
.
.
. 157
Initializing
Arrays
.
.
.
.
.
.
.
.
.
.
.
. 158
Run-Time
Arrays
.
.
.
.
.
.
.
.
.
.
. 158
Compile-Time
and
Prerun-Time
Arrays
.
.
.
. 158
Defining
Related
Arrays
.
.
.
.
.
.
.
.
.
. 159
Searching
Arrays
.
.
.
.
.
.
.
.
.
.
.
. 160
Searching
an
Array
Without
an
Index
.
.
.
. 161
Searching
an
Array
with
an
Index
.
.
.
.
. 161
Using
Arrays
.
.
.
.
.
.
.
.
.
.
.
.
. 162
Specifying
an
Array
in
Calculations
.
.
.
.
. 162
Sorting
Arrays
.
.
.
.
.
.
.
.
.
.
.
.
. 163
Sorting
using
part
of
the
array
as
a
key
.
.
. 164
Array
Output
.
.
.
.
.
.
.
.
.
.
.
.
. 164
Editing
Entire
Arrays
.
.
.
.
.
.
.
.
.
. 164
Using
Dynamically-Sized
Arrays
.
.
.
.
.
.
. 165
Tables
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 166
LOOKUP
with
One
Table
.
.
.
.
.
.
.
. 166
LOOKUP
with
Two
Tables
.
.
.
.
.
.
.
. 166
Specifying
the
Table
Element
Found
in
a
LOOKUP
Operation
.
.
.
.
.
.
.
.
.
. 167
Chapter
10.
Data
Types
and
Data
Formats
.
.
.
.
.
.
.
.
.
.
.
.
.
. 169
Internal
and
External
Formats
.
.
.
.
.
.
.
. 169
Internal
Format
.
.
.
.
.
.
.
.
.
.
.
. 170
External
Format
.
.
.
.
.
.
.
.
.
.
. 170
Character
Data
Type
.
.
.
.
.
.
.
.
.
.
. 172
Character
Format
.
.
.
.
.
.
.
.
.
.
. 172
Indicator
Format
.
.
.
.
.
.
.
.
.
.
. 172
Graphic
Format
.
.
.
.
.
.
.
.
.
.
. 173
UCS-2
Format
.
.
.
.
.
.
.
.
.
.
.
. 174
Variable-Length
Character,
Graphic
and
UCS-2
Formats
.
.
.
.
.
.
.
.
.
.
.
.
.
. 175
Conversion
between
Character,
Graphic
and
UCS-2
Data
.
.
.
.
.
.
.
.
.
.
.
.
. 183
Alternate
Collating
Sequence
.
.
.
.
.
.
. 184
Numeric
Data
Type
.
.
.
.
.
.
.
.
.
.
. 186
Binary
Format
.
.
.
.
.
.
.
.
.
.
.
. 186
Float
Format
.
.
.
.
.
.
.
.
.
.
.
. 187
Integer
Format
.
.
.
.
.
.
.
.
.
.
.
. 189
Packed-Decimal
Format
.
.
.
.
.
.
.
.
. 189
Unsigned
Format
.
.
.
.
.
.
.
.
.
.
. 190
Zoned-Decimal
Format
.
.
.
.
.
.
.
.
. 191
Considerations
for
Using
Numeric
Formats
.
. 192
Representation
of
Numeric
Formats
.
.
.
.
. 193
Date
Data
Type
.
.
.
.
.
.
.
.
.
.
.
.
. 195
Separators
.
.
.
.
.
.
.
.
.
.
.
.
. 197
Initialization
.
.
.
.
.
.
.
.
.
.
.
.
. 197
Time
Data
Type
.
.
.
.
.
.
.
.
.
.
.
. 198
Separators
.
.
.
.
.
.
.
.
.
.
.
.
. 199
Initialization
.
.
.
.
.
.
.
.
.
.
.
.
. 199
*JOBRUN
.
.
.
.
.
.
.
.
.
.
.
.
.
. 199
Timestamp
Data
Type
.
.
.
.
.
.
.
.
.
. 199
Separators
.
.
.
.
.
.
.
.
.
.
.
.
. 199
Initialization
.
.
.
.
.
.
.
.
.
.
.
.
. 200
Object
Data
Type
.
.
.
.
.
.
.
.
.
.
.
. 200
Where
You
Can
Specify
an
Object
Field
.
.
. 200
Basing
Pointer
Data
Type
.
.
.
.
.
.
.
.
. 201
Setting
a
Basing
Pointer
.
.
.
.
.
.
.
.
. 203
Examples
.
.
.
.
.
.
.
.
.
.
.
.
.
. 204
Procedure
Pointer
Data
Type
.
.
.
.
.
.
.
. 208
Database
Null
Value
Support
.
.
.
.
.
.
.
. 209
iv
ILE
RPG
Reference
####
-
User
Controlled
Support
for
Null-Capable
Fields
and
Key
Fields
.
.
.
.
.
.
.
.
.
.
.
. 210
Input-Only
Support
for
Null-Capable
Fields
.
. 216
ALWNULL(*NO)
.
.
.
.
.
.
.
.
.
.
. 217
Error
Handling
for
Database
Data
Mapping
Errors
217
Chapter
11.
Editing
Numeric
Fields
219
Edit
Codes
.
.
.
.
.
.
.
.
.
.
.
.
.
. 220
Simple
Edit
Codes
.
.
.
.
.
.
.
.
.
.
. 220
Combination
Edit
Codes
.
.
.
.
.
.
.
.
. 220
User-Defined
Edit
Codes
.
.
.
.
.
.
.
. 222
Editing
Considerations
.
.
.
.
.
.
.
.
. 222
Summary
of
Edit
Codes
.
.
.
.
.
.
.
.
. 222
Edit
Words
.
.
.
.
.
.
.
.
.
.
.
.
.
. 225
How
to
Code
an
Edit
Word
.
.
.
.
.
.
. 226
Parts
of
an
Edit
Word
.
.
.
.
.
.
.
.
. 226
Summary
of
Coding
Rules
for
Edit
Words
.
.
. 230
Editing
Externally
Described
Files
.
.
.
.
.
. 231
Part
3.
Specifications
.
.
.
.
.
.
. 233
Chapter
12.
About
Specifications
.
.
. 235
RPG
IV
Specification
Types
.
.
.
.
.
.
.
.
. 235
Main
Source
Section
Specifications
.
.
.
.
. 236
Subprocedure
Specifications
.
.
.
.
.
.
. 237
Program
Data
.
.
.
.
.
.
.
.
.
.
.
. 237
Common
Entries
.
.
.
.
.
.
.
.
.
.
.
. 238
Syntax
of
Keywords
.
.
.
.
.
.
.
.
.
. 238
Continuation
Rules
.
.
.
.
.
.
.
.
.
. 239
Chapter
13.
Control
Specifications
245
Using
a
Data
Area
as
a
Control
Specification
.
.
. 245
Control-Specification
Statement
.
.
.
.
.
.
. 245
Position
6
(Form
Type)
.
.
.
.
.
.
.
.
. 246
Positions
7-80
(Keywords)
.
.
.
.
.
.
.
. 246
Control-Specification
Keywords
.
.
.
.
.
.
. 246
ACTGRP(*NEW
|
*CALLER
|
’activation-group-name’)
.
.
.
.
.
.
.
.
. 247
ALTSEQ{(*NONE
|
*SRC
|
*EXT)}
.
.
.
.
. 247
ALWNULL(*NO
|
*INPUTONLY
|
*USRCTL)
247
AUT(*LIBRCRTAUT
|
*ALL
|
*CHANGE
|
*USE
|
*EXCLUDE
|
’authorization-list-name’)
. 248
BNDDIR(’binding-directory-name’
{:’binding-directory-name’...})
.
.
.
.
.
.
. 249
CCSID(*GRAPH
:
parameter
|
*UCS2
:
number
|
*CHAR
:
*JOBRUN)
.
.
.
.
.
.
.
.
. 249
COPYNEST(number)
.
.
.
.
.
.
.
.
.
. 250
COPYRIGHT(’copyright
string’)
.
.
.
.
.
. 250
CURSYM(’sym’)
.
.
.
.
.
.
.
.
.
.
. 251
CVTOPT(*{NO}DATETIME
*{NO}GRAPHIC
*{NO}VARCHAR
*{NO}VARGRAPHIC)
.
.
. 251
DATEDIT(fmt{separator})
.
.
.
.
.
.
.
. 252
DATFMT(fmt{separator})
.
.
.
.
.
.
.
. 252
DEBUG{(*NO
|
*YES)}
.
.
.
.
.
.
.
.
. 252
DECEDIT(*JOBRUN
|
’value’)
.
.
.
.
.
. 253
DECPREC(30|31|63)
.
.
.
.
.
.
.
.
.
. 253
DFTACTGRP(*YES
|
*NO)
.
.
.
.
.
.
.
. 254
DFTNAME(rpg_name)
.
.
.
.
.
.
.
.
. 254
ENBPFRCOL(*PEP
|
*ENTRYEXIT
|
*FULL)
254
EXPROPTS(*MAXDIGITS
|
*RESDECPOS)
.
. 255
EXTBININT{(*NO
|
*YES)}
.
.
.
.
.
.
.
. 255
FIXNBR(*{NO}ZONED
*{NO}INPUTPACKED)
255
FLTDIV{(*NO
|
*YES)}
.
.
.
.
.
.
.
.
. 256
FORMSALIGN{(*NO
|
*YES)}
.
.
.
.
.
.
. 256
FTRANS{(*NONE
|
*SRC)}
.
.
.
.
.
.
.
. 256
GENLVL(number)
.
.
.
.
.
.
.
.
.
.
. 257
INDENT(*NONE
|
’character-value’)
.
.
.
. 257
INTPREC(10
|
20)
.
.
.
.
.
.
.
.
.
.
. 257
LANGID(*JOBRUN
|
*JOB
|
’language-identifier’)
.
.
.
.
.
.
.
.
.
. 257
NOMAIN
.
.
.
.
.
.
.
.
.
.
.
.
. 258
OPENOPT
(*NOINZOFL
|
*INZOFL)
.
.
.
. 258
OPTIMIZE(*NONE
|
*BASIC
|
*FULL)
.
.
. 258
OPTION(*{NO}XREF
*{NO}GEN
*{NO}SECLVL
*{NO}SHOWCPY
*{NO}EXPDDS
*{NO}EXT
*{NO}SHOWSKP)
*{NO}SRCSTMT)
*{NO}DEBUGIO)
.
.
.
.
.
.
.
.
.
.
. 259
PRFDTA(*NOCOL
|
*COL)
.
.
.
.
.
.
. 260
SRTSEQ(*HEX
|
*JOB
|
*JOBRUN
|
*LANGIDUNQ
|
*LANGIDSHR
|
’sort-table-name’)
.
.
.
.
.
.
.
.
.
.
. 260
TEXT(*SRCMBRTXT
|
*BLANK
|
’description’)
261
THREAD(*SERIALIZE)
.
.
.
.
.
.
.
.
. 261
TIMFMT(fmt{separator})
.
.
.
.
.
.
.
.
. 262
TRUNCNBR(*YES
|
*NO)
.
.
.
.
.
.
.
. 262
USRPRF(*USER
|
*OWNER)
.
.
.
.
.
.
. 262
Chapter
14.
File
Description
Specifications
.
.
.
.
.
.
.
.
.
.
. 263
File
Description
Specification
Statement
.
.
.
. 263
File-Description
Keyword
Continuation
Line
263
Position
6
(Form
Type)
.
.
.
.
.
.
.
.
. 264
Positions
7-16
(File
Name)
.
.
.
.
.
.
.
. 264
Position
17
(File
Type)
.
.
.
.
.
.
.
.
. 265
Position
18
(File
Designation)
.
.
.
.
.
.
. 265
Position
19
(End
of
File)
.
.
.
.
.
.
.
.
. 266
Position
20
(File
Addition)
.
.
.
.
.
.
.
. 267
Position
21
(Sequence)
.
.
.
.
.
.
.
.
. 268
Position
22
(File
Format)
.
.
.
.
.
.
.
. 268
Positions
23-27
(Record
Length)
.
.
.
.
.
. 269
Position
28
(Limits
Processing)
.
.
.
.
.
. 269
Positions
29-33
(Length
of
Key
or
Record
Address)
.
.
.
.
.
.
.
.
.
.
.
.
.
. 270
Position
34
(Record
Address
Type)
.
.
.
.
. 270
Position
35
(File
Organization)
.
.
.
.
.
.
. 272
Positions
36-42
(Device)
.
.
.
.
.
.
.
.
. 273
Position
43
(Reserved)
.
.
.
.
.
.
.
.
. 274
Positions
44-80
(Keywords)
.
.
.
.
.
.
.
. 274
File-Description
Keywords
.
.
.
.
.
.
.
.
. 274
BLOCK(*YES
|*NO)
.
.
.
.
.
.
.
.
.
. 274
COMMIT{(rpg_name)}
.
.
.
.
.
.
.
.
. 275
DATFMT(format{separator})
.
.
.
.
.
.
. 275
DEVID(fieldname)
.
.
.
.
.
.
.
.
.
.
. 276
EXTFILE(filename)
.
.
.
.
.
.
.
.
.
. 276
EXTIND(*INUx)
.
.
.
.
.
.
.
.
.
.
. 277
EXTMBR(membername)
.
.
.
.
.
.
.
.
. 277
FORMLEN(number)
.
.
.
.
.
.
.
.
.
. 277
FORMOFL(number)
.
.
.
.
.
.
.
.
.
. 278
IGNORE(recformat{:recformat...})
.
.
.
.
.
. 278
INCLUDE(recformat{:recformat...})
.
.
.
.
. 278
INDDS(data_structure_name)
.
.
.
.
.
.
. 278
Contents
v
##
-
INFDS(DSname)
.
.
.
.
.
.
.
.
.
.
. 279
INFSR(SUBRname)
.
.
.
.
.
.
.
.
.
. 279
KEYLOC(number)
.
.
.
.
.
.
.
.
.
.
. 279
MAXDEV(*ONLY
|
*FILE)
.
.
.
.
.
.
.
. 279
OFLIND(indicator)
.
.
.
.
.
.
.
.
.
. 280
PASS(*NOIND)
.
.
.
.
.
.
.
.
.
.
.
. 280
PGMNAME(program_name)
.
.
.
.
.
.
. 280
PLIST(Plist_name)
.
.
.
.
.
.
.
.
.
.
. 281
PREFIX(prefix{:nbr_of_char_replaced})
.
.
.
. 281
PRTCTL(data_struct{:*COMPAT})
.
.
.
.
.
. 282
RAFDATA(filename)
.
.
.
.
.
.
.
.
.
. 283
RECNO(fieldname)
.
.
.
.
.
.
.
.
.
. 283
RENAME(Ext_format:Int_format)
.
.
.
.
.
. 283
SAVEDS(DSname)
.
.
.
.
.
.
.
.
.
.
. 284
SAVEIND(number)
.
.
.
.
.
.
.
.
.
. 284
SFILE(recformat:rrnfield)
.
.
.
.
.
.
.
. 284
SLN(number)
.
.
.
.
.
.
.
.
.
.
.
. 285
TIMFMT(format{separator})
.
.
.
.
.
.
. 285
USROPN
.
.
.
.
.
.
.
.
.
.
.
.
.
. 285
File
Types
and
Processing
Methods
.
.
.
.
.
. 285
Chapter
15.
Definition
Specifications
287
Definition
Specification
Statement
.
.
.
.
.
. 287
Definition
Specification
Keyword
Continuation
Line
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 288
Definition
Specification
Continued
Name
Line
288
Position
6
(Form
Type)
.
.
.
.
.
.
.
.
. 288
Positions
7-21
(Name)
.
.
.
.
.
.
.
.
. 288
Position
22
(External
Description)
.
.
.
.
. 289
Position
23
(Type
of
Data
Structure)
.
.
.
.
. 289
Positions
24-25
(Definition
Type)
.
.
.
.
.
. 290
Positions
26-32
(From
Position)
.
.
.
.
.
. 290
Positions
33-39
(To
Position
/
Length)
.
.
.
. 291
Position
40
(Internal
Data
Type)
.
.
.
.
.
. 292
Positions
41-42
(Decimal
Positions)
.
.
.
.
. 293
Position
43
(Reserved)
.
.
.
.
.
.
.
.
. 293
Positions
44-80
(Keywords)
.
.
.
.
.
.
.
. 293
Definition-Specification
Keywords
.
.
.
.
.
. 293
ALIGN
.
.
.
.
.
.
.
.
.
.
.
.
.
. 294
ALT(array_name)
.
.
.
.
.
.
.
.
.
.
. 294
ALTSEQ(*NONE)
.
.
.
.
.
.
.
.
.
.
. 294
ASCEND
.
.
.
.
.
.
.
.
.
.
.
.
.
. 295
BASED(basing_pointer_name)
.
.
.
.
.
.
. 295
CCSID(number
|
*DFT)
.
.
.
.
.
.
.
.
. 296
CLASS(*JAVA:class-name)
.
.
.
.
.
.
.
. 296
CONST{(constant)}
.
.
.
.
.
.
.
.
.
. 296
CTDATA
.
.
.
.
.
.
.
.
.
.
.
.
.
. 297
DATFMT(format{separator})
.
.
.
.
.
.
. 297
DESCEND
.
.
.
.
.
.
.
.
.
.
.
.
. 297
DIM(numeric_constant)
.
.
.
.
.
.
.
.
. 298
DTAARA{(*VAR:)data_area_name}
.
.
.
.
. 298
EXPORT{(external_name)}
.
.
.
.
.
.
.
. 300
EXTFLD(field_name)
.
.
.
.
.
.
.
.
.
. 300
EXTFMT(code)
.
.
.
.
.
.
.
.
.
.
.
. 301
EXTNAME(file-name{:format-name}{:*ALL|
*INPUT|*OUTPUT|*KEY})
.
.
.
.
.
.
.
. 301
EXTPGM(name)
.
.
.
.
.
.
.
.
.
.
. 302
EXTPROC({*CL|*CWIDEN|*CNOWIDEN|
{*JAVA:class-name:}}name)
.
.
.
.
.
.
.
. 302
FROMFILE(file_name)
.
.
.
.
.
.
.
.
. 306
IMPORT{(external_name)}
.
.
.
.
.
.
.
. 307
INZ{(initial
value)}
.
.
.
.
.
.
.
.
.
. 307
LIKE(name)
.
.
.
.
.
.
.
.
.
.
.
.
. 309
LIKEDS(data_structure_name)
.
.
.
.
.
.
. 310
LIKEREC(intrecname{:*ALL|*INPUT|*OUTPUT
|*KEY})
.
.
.
.
.
.
.
.
.
.
.
.
.
. 311
NOOPT
.
.
.
.
.
.
.
.
.
.
.
.
.
. 312
OCCURS(numeric_constant)
.
.
.
.
.
.
. 312
OPDESC
.
.
.
.
.
.
.
.
.
.
.
.
.
. 313
OPTIONS(*NOPASS
*OMIT
*VARSIZE
*STRING
*TRIM
*RIGHTADJ)
.
.
.
.
.
.
.
.
.
. 314
OVERLAY(name{:pos
|
*NEXT})
.
.
.
.
.
. 322
PACKEVEN
.
.
.
.
.
.
.
.
.
.
.
.
. 324
PERRCD(numeric_constant)
.
.
.
.
.
.
. 324
PREFIX(prefix{:nbr_of_char_replaced})
.
.
.
. 324
PROCPTR
.
.
.
.
.
.
.
.
.
.
.
.
. 325
QUALIFIED
.
.
.
.
.
.
.
.
.
.
.
.
. 325
STATIC
.
.
.
.
.
.
.
.
.
.
.
.
.
. 325
TIMFMT(format{separator})
.
.
.
.
.
.
. 326
TOFILE(file_name)
.
.
.
.
.
.
.
.
.
. 326
VALUE
.
.
.
.
.
.
.
.
.
.
.
.
.
. 326
VARYING
.
.
.
.
.
.
.
.
.
.
.
.
. 327
Summary
According
to
Definition
Specification
Type
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 327
Chapter
16.
Input
Specifications
.
.
. 331
Input
Specification
Statement
.
.
.
.
.
.
.
. 331
Program
Described
.
.
.
.
.
.
.
.
.
. 331
Externally
Described
.
.
.
.
.
.
.
.
.
. 331
Program
Described
Files
.
.
.
.
.
.
.
.
.
. 332
Position
6
(Form
Type)
.
.
.
.
.
.
.
.
. 332
Record
Identification
Entries
.
.
.
.
.
.
.
. 332
Positions
7-16
(File
Name)
.
.
.
.
.
.
.
. 332
Positions
16-18
(Logical
Relationship)
.
.
.
. 332
Positions
17-18
(Sequence)
.
.
.
.
.
.
.
. 333
Position
19
(Number)
.
.
.
.
.
.
.
.
.
. 333
Position
20
(Option)
.
.
.
.
.
.
.
.
.
. 334
Positions
21-22
(Record
Identifying
Indicator,
or
**)
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 334
Positions
23-46
(Record
Identification
Codes)
335
Field
Description
Entries
.
.
.
.
.
.
.
.
. 337
Position
6
(Form
Type)
.
.
.
.
.
.
.
.
. 338
Positions
7-30
(Reserved)
.
.
.
.
.
.
.
. 338
Positions
31-34
(Data
Attributes)
.
.
.
.
.
. 338
Position
35
(Date/Time
Separator)
.
.
.
.
. 338
Position
36
(Data
Format)
.
.
.
.
.
.
.
. 338
Positions
37-46
(Field
Location)
.
.
.
.
.
. 339
Positions
47-48
(Decimal
Positions)
.
.
.
.
. 340
Positions
49-62
(Field
Name)
.
.
.
.
.
.
. 340
Positions
63-64
(Control
Level)
.
.
.
.
.
. 340
Positions
65-66
(Matching
Fields)
.
.
.
.
.
. 341
Positions
67-68
(Field
Record
Relation)
.
.
.
. 341
Positions
69-74
(Field
Indicators)
.
.
.
.
.
. 342
Externally
Described
Files
.
.
.
.
.
.
.
.
. 342
Position
6
(Form
Type)
.
.
.
.
.
.
.
.
. 342
Record
Identification
Entries
.
.
.
.
.
.
.
. 343
Positions
7-16
(Record
Name)
.
.
.
.
.
.
. 343
Positions
17-20
(Reserved)
.
.
.
.
.
.
.
. 343
Positions
21-22
(Record
Identifying
Indicator)
343
Positions
23-80
(Reserved)
.
.
.
.
.
.
.
. 343
Field
Description
Entries
.
.
.
.
.
.
.
.
. 343
Positions
7-20
(Reserved)
.
.
.
.
.
.
.
. 344
vi
ILE
RPG
Reference
||
#
#
#
-
Positions
21-30
(External
Field
Name)
.
.
.
. 344
Positions
31-48
(Reserved)
.
.
.
.
.
.
.
. 344
Positions
49-62
(Field
Name)
.
.
.
.
.
.
. 344
Positions
63-64
(Control
Level)
.
.
.
.
.
. 344
Positions
65-66
(Matching
Fields)
.
.
.
.
.
. 344
Positions
67-68
(Reserved)
.
.
.
.
.
.
.
. 345
Positions
69-74
(Field
Indicators)
.
.
.
.
.
. 345
Positions
75-80
(Reserved)
.
.
.
.
.
.
.
. 345
Chapter
17.
Calculation
Specifications
347
Traditional
Syntax
.
.
.
.
.
.
.
.
.
.
.
. 347
Calculation
Specification
Extended
Factor-2
Continuation
Line
.
.
.
.
.
.
.
.
.
.
. 348
Position
6
(Form
Type)
.
.
.
.
.
.
.
.
. 348
Positions
7-8
(Control
Level)
.
.
.
.
.
.
. 348
Positions
9-11
(Indicators)
.
.
.
.
.
.
.
. 350
Positions
12-25
(Factor
1)
.
.
.
.
.
.
.
. 350
Positions
26-35
(Operation
and
Extender)
.
.
. 350
Positions
36-49
(Factor
2)
.
.
.
.
.
.
.
. 351
Positions
50-63
(Result
Field)
.
.
.
.
.
.
. 352
Positions
64-68
(Field
Length)
.
.
.
.
.
.
. 352
Positions
69-70
(Decimal
Positions)
.
.
.
.
. 352
Positions
71-76
(Resulting
Indicators)
.
.
.
. 352
Extended
Factor
2
Syntax
.
.
.
.
.
.
.
.
. 353
Positions
7-8
(Control
Level)
.
.
.
.
.
.
. 353
Positions
9-11
(Indicators)
.
.
.
.
.
.
.
. 353
Positions
12-25
(Factor
1)
.
.
.
.
.
.
.
. 353
Positions
26-35
(Operation
and
Extender)
.
.
. 354
Positions
36-80
(Extended
Factor
2)
.
.
.
.
. 354
Free-Form
Syntax
.
.
.
.
.
.
.
.
.
.
.
. 355
Positions
8-80
(Free-form
Operations)
.
.
.
. 356
Chapter
18.
Output
Specifications
.
. 357
Output
Specification
Statement
.
.
.
.
.
.
. 357
Program
Described
.
.
.
.
.
.
.
.
.
. 357
Externally
Described
.
.
.
.
.
.
.
.
.
. 357
Program
Described
Files
.
.
.
.
.
.
.
.
.
. 358
Position
6
(Form
Type)
.
.
.
.
.
.
.
.
. 358
Record
Identification
and
Control
Entries
.
.
.
. 358
Positions
7-16
(File
Name)
.
.
.
.
.
.
.
. 358
Positions
16-18
(
Logical
Relationship)
.
.
.
. 358
Position
17
(Type)
.
.
.
.
.
.
.
.
.
.
. 359
Positions
18-20
(Record
Addition/Deletion)
.
. 359
Position
18
(Fetch
Overflow/Release)
.
.
.
. 360
Positions
21-29
(Output
Conditioning
Indicators)
360
Positions
30-39
(EXCEPT
Name)
.
.
.
.
.
. 361
Positions
40-51
(Space
and
Skip)
.
.
.
.
.
. 362
Positions
40-42
(Space
Before)
.
.
.
.
.
.
. 363
Positions
43-45
(Space
After)
.
.
.
.
.
.
. 363
Positions
46-48
(Skip
Before)
.
.
.
.
.
.
. 363
Positions
49-51
(Skip
After)
.
.
.
.
.
.
.
. 363
Field
Description
and
Control
Entries
.
.
.
.
. 363
Positions
21-29
(Output
Indicators)
.
.
.
.
. 363
Positions
30-43
(Field
Name)
.
.
.
.
.
.
. 364
Position
44
(Edit
Codes)
.
.
.
.
.
.
.
.
. 365
Position
45
(Blank
After)
.
.
.
.
.
.
.
. 365
Positions
47-51
(End
Position)
.
.
.
.
.
.
. 366
Position
52
(Data
Format)
.
.
.
.
.
.
.
. 367
Positions
53-80
(Constant,
Edit
Word,
Data
Attributes,
Format
Name)
.
.
.
.
.
.
.
. 368
Externally
Described
Files
.
.
.
.
.
.
.
.
. 369
Position
6
(Form
Type)
.
.
.
.
.
.
.
.
. 369
Record
Identification
and
Control
Entries
.
.
.
. 369
Positions
7-16
(Record
Name)
.
.
.
.
.
.
. 369
Positions
16-18
(
Logical
Relationship)
.
.
.
. 369
Position
17
(Type)
.
.
.
.
.
.
.
.
.
.
. 370
Position
18
(Release)
.
.
.
.
.
.
.
.
.
. 370
Positions
18-20
(Record
Addition)
.
.
.
.
. 370
Positions
21-29
(Output
Indicators)
.
.
.
.
. 370
Positions
30-39
(EXCEPT
Name)
.
.
.
.
.
. 370
Field
Description
and
Control
Entries
.
.
.
.
. 370
Positions
21-29
(Output
Indicators)
.
.
.
.
. 370
Positions
30-43
(Field
Name)
.
.
.
.
.
.
. 370
Position
45
(Blank
After)
.
.
.
.
.
.
.
. 371
Chapter
19.
Procedure
Specifications
373
Procedure
Specification
Statement
.
.
.
.
.
. 373
Procedure
Specification
Keyword
Continuation
Line
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 373
Procedure
Specification
Continued
Name
Line
374
Position
6
(Form
Type)
.
.
.
.
.
.
.
.
. 374
Positions
7-21
(Name)
.
.
.
.
.
.
.
.
. 374
Position
24
(Begin/End
Procedure)
.
.
.
.
. 374
Positions
44-80
(Keywords)
.
.
.
.
.
.
.
. 375
Procedure-Specification
Keywords
.
.
.
.
.
. 375
EXPORT
.
.
.
.
.
.
.
.
.
.
.
.
.
. 375
Part
4.
Operations,
Expressions,
and
Functions
.
.
.
.
.
.
.
.
.
. 377
Chapter
20.
Operations
.
.
.
.
.
.
. 379
Operation
Codes
.
.
.
.
.
.
.
.
.
.
.
. 379
Built-in
Functions
.
.
.
.
.
.
.
.
.
.
.
. 386
Arithmetic
Operations
.
.
.
.
.
.
.
.
.
. 390
Ensuring
Accuracy
.
.
.
.
.
.
.
.
.
. 392
Performance
Considerations
.
.
.
.
.
.
. 392
Integer
and
Unsigned
Arithmetic
.
.
.
.
.
. 392
Arithmetic
Operations
Examples
.
.
.
.
.
. 393
Array
Operations
.
.
.
.
.
.
.
.
.
.
.
. 393
Bit
Operations
.
.
.
.
.
.
.
.
.
.
.
.
. 394
Branching
Operations
.
.
.
.
.
.
.
.
.
. 395
Call
Operations
.
.
.
.
.
.
.
.
.
.
.
.
. 395
Prototyped
Calls
.
.
.
.
.
.
.
.
.
.
. 396
Operational
Descriptors
.
.
.
.
.
.
.
.
. 397
Parsing
Program
Names
on
a
Call
.
.
.
.
. 397
Parsing
System
Built-In
Names
.
.
.
.
.
. 399
Value
of
*ROUTINE
.
.
.
.
.
.
.
.
.
. 399
Compare
Operations
.
.
.
.
.
.
.
.
.
.
. 400
Conversion
Operations
.
.
.
.
.
.
.
.
.
. 402
Data-Area
Operations
.
.
.
.
.
.
.
.
.
. 402
Date
Operations
.
.
.
.
.
.
.
.
.
.
.
. 404
Unexpected
Results
.
.
.
.
.
.
.
.
.
. 405
Declarative
Operations
.
.
.
.
.
.
.
.
.
. 406
Error-Handling
Operations
.
.
.
.
.
.
.
.
. 407
File
Operations
.
.
.
.
.
.
.
.
.
.
.
.
. 408
Keys
for
File
Operations
.
.
.
.
.
.
.
.
. 410
Indicator-Setting
Operations
.
.
.
.
.
.
.
. 410
Information
Operations
.
.
.
.
.
.
.
.
.
. 411
Initialization
Operations
.
.
.
.
.
.
.
.
.
. 411
Memory
Management
Operations
.
.
.
.
.
. 412
Contents
vii
#
#
-
Message
Operation
.
.
.
.
.
.
.
.
.
.
. 413
Move
Operations
.
.
.
.
.
.
.
.
.
.
.
. 413
Moving
Character,
Graphic,
UCS-2,
and
Numeric
Data
.
.
.
.
.
.
.
.
.
.
.
. 414
Moving
Date-Time
Data
.
.
.
.
.
.
.
.
. 416
Move
Zone
Operations
.
.
.
.
.
.
.
.
.
. 419
Result
Operations
.
.
.
.
.
.
.
.
.
.
.
. 420
Size
Operations
.
.
.
.
.
.
.
.
.
.
.
.
. 420
String
Operations
.
.
.
.
.
.
.
.
.
.
.
. 420
Structured
Programming
Operations
.
.
.
.
. 422
Subroutine
Operations
.
.
.
.
.
.
.
.
.
. 425
Coding
Subroutines
.
.
.
.
.
.
.
.
.
. 425
Test
Operations
.
.
.
.
.
.
.
.
.
.
.
.
. 428
Chapter
21.
Expressions
.
.
.
.
.
. 429
General
Expression
Rules
.
.
.
.
.
.
.
.
. 430
Expression
Operands
.
.
.
.
.
.
.
.
.
.
. 431
Expression
Operators
.
.
.
.
.
.
.
.
.
.
. 431
Operation
Precedence
.
.
.
.
.
.
.
.
.
. 433
Data
Types
.
.
.
.
.
.
.
.
.
.
.
.
.
. 434
Data
Types
Supported
by
Expression
Operands
434
Format
of
Numeric
Intermediate
Results
.
.
. 438
Precision
Rules
for
Numeric
Operations
.
.
.
. 438
Using
the
Default
Precision
Rules
.
.
.
.
. 439
Precision
of
Intermediate
Results
.
.
.
.
.
. 440
Example
of
Default
Precision
Rules
.
.
.
.
. 440
Using
the
″Result
Decimal
Position″
Precision
Rules
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 442
Example
of
″Result
Decimal
Position″
Precision
Rules
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 443
Short
Circuit
Evaluation
.
.
.
.
.
.
.
.
.
. 444
Order
of
Evaluation
.
.
.
.
.
.
.
.
.
.
. 444
Chapter
22.
Built-in
Functions
.
.
.
. 445
%ABS
(Absolute
Value
of
Expression)
.
.
.
.
. 445
%ADDR
(Get
Address
of
Variable)
.
.
.
.
.
. 446
%ALLOC
(Allocate
Storage)
.
.
.
.
.
.
.
. 448
%BITAND
(Bitwise
AND
Operation)
.
.
.
.
. 449
%BITNOT
(Invert
Bits)
.
.
.
.
.
.
.
.
.
. 450
%BITOR
(Bitwise
OR
Operation)
.
.
.
.
.
.
. 451
%BITXOR
(Bitwise
Exclusive-OR
Operation)
.
.
. 452
Examples
of
Bit
Operations
.
.
.
.
.
.
.
. 453
%CHAR
(Convert
to
Character
Data)
.
.
.
.
. 456
%CHECK
(Check
Characters)
.
.
.
.
.
.
.
. 458
%CHECKR
(Check
Reverse)
.
.
.
.
.
.
.
. 460
%DATE
(Convert
to
Date)
.
.
.
.
.
.
.
.
. 462
%DAYS
(Number
of
Days)
.
.
.
.
.
.
.
.
. 463
%DEC
(Convert
to
Packed
Decimal
Format)
.
.
. 464
Numeric
or
character
expression
.
.
.
.
.
. 464
Date,
time
or
timestamp
expression
.
.
.
.
. 464
%DECH
(Convert
to
Packed
Decimal
Format
with
Half
Adjust)
.
.
.
.
.
.
.
.
.
.
.
.
.
. 466
%DECH
Examples
.
.
.
.
.
.
.
.
.
.
. 466
%DECPOS
(Get
Number
of
Decimal
Positions)
.
. 468
%DIFF
(Difference
Between
Two
Date,
Time,
or
Timestamp
Values)
.
.
.
.
.
.
.
.
.
.
. 469
%DIV
(Return
Integer
Portion
of
Quotient)
.
.
. 472
%EDITC
(Edit
Value
Using
an
Editcode)
.
.
.
. 473
%EDITFLT
(Convert
to
Float
External
Representation)
.
.
.
.
.
.
.
.
.
.
.
.
. 476
%EDITW
(Edit
Value
Using
an
Editword)
.
.
.
. 477
%ELEM
(Get
Number
of
Elements)
.
.
.
.
.
. 478
%EOF
(Return
End
or
Beginning
of
File
Condition)
479
%EQUAL
(Return
Exact
Match
Condition)
.
.
. 481
%ERROR
(Return
Error
Condition)
.
.
.
.
.
. 483
%FIELDS
(Fields
to
update)
.
.
.
.
.
.
.
. 484
%FLOAT
(Convert
to
Floating
Format)
.
.
.
.
. 485
%FOUND
(Return
Found
Condition)
.
.
.
.
. 486
%GRAPH
(Convert
to
Graphic
Value)
.
.
.
.
. 488
%HOURS
(Number
of
Hours)
.
.
.
.
.
.
.
. 490
%INT
(Convert
to
Integer
Format)
.
.
.
.
.
. 491
%INTH
(Convert
to
Integer
Format
with
Half
Adjust)
.
.
.
.
.
.
.
.
.
.
.
.
.
. 491
%KDS
(Search
Arguments
in
Data
Structure)
.
.
. 493
%LEN
(Get
or
Set
Length)
.
.
.
.
.
.
.
.
. 494
%LEN
Used
for
its
Value
.
.
.
.
.
.
.
. 494
%LEN
Used
to
Set
the
Length
of
Variable-Length
Fields
.
.
.
.
.
.
.
.
. 495
%LOOKUPxx
(Look
Up
an
Array
Element)
.
.
. 497
Sequenced
arrays
that
are
not
in
the
correct
sequence
.
.
.
.
.
.
.
.
.
.
.
.
.
. 498
%MINUTES
(Number
of
Minutes)
.
.
.
.
.
. 499
%MONTHS
(Number
of
Months)
.
.
.
.
.
.
. 500
%MSECONDS
(Number
of
Microseconds)
.
.
.
. 501
%NULLIND
(Query
or
Set
Null
Indicator)
.
.
.
. 502
%OCCUR
(Set/Get
Occurrence
of
a
Data
Structure)
503
%OPEN
(Return
File
Open
Condition)
.
.
.
.
. 504
%PADDR
(Get
Procedure
Address)
.
.
.
.
.
. 505
%PADDR
Used
with
a
Prototype
.
.
.
.
.
. 505
%PARMS
(Return
Number
of
Parameters)
.
.
.
. 507
%REALLOC
(Reallocate
Storage)
.
.
.
.
.
.
. 509
%REM
(Return
Integer
Remainder)
.
.
.
.
.
. 510
%REPLACE
(Replace
Character
String)
.
.
.
.
. 511
%SCAN
(Scan
for
Characters)
.
.
.
.
.
.
.
. 513
%SECONDS
(Number
of
Seconds)
.
.
.
.
.
. 515
%SHTDN
(Shut
Down)
.
.
.
.
.
.
.
.
.
. 516
%SIZE
(Get
Size
in
Bytes)
.
.
.
.
.
.
.
.
. 517
%SQRT
(Square
Root
of
Expression)
.
.
.
.
.
. 519
%STATUS
(Return
File
or
Program
Status)
.
.
.
. 520
%STR
(Get
or
Store
Null-Terminated
String)
.
.
. 523
%STR
Used
to
Get
Null-Terminated
String
.
. 523
%STR
Used
to
Store
Null-Terminated
String
.
. 524
%SUBARR
(Set/Get
Portion
of
an
Array)
.
.
.
. 525
%SUBDT
(Extract
a
Portion
of
a
Date,
Time,
or
Timestamp)
.
.
.
.
.
.
.
.
.
.
.
.
.
. 528
%SUBST
(Get
Substring)
.
.
.
.
.
.
.
.
.
. 529
%SUBST
Used
for
its
Value
.
.
.
.
.
.
.
. 529
%SUBST
Used
as
the
Result
of
an
Assignment
529
%THIS
(Return
Class
Instance
for
Native
Method)
531
%TIME
(Convert
to
Time)
.
.
.
.
.
.
.
.
. 532
%TIMESTAMP
(Convert
to
Timestamp)
.
.
.
. 533
%TLOOKUPxx
(Look
Up
a
Table
Element)
.
.
. 534
%TRIM
(Trim
Characters
at
Edges)
.
.
.
.
.
. 536
%TRIML
(Trim
Leading
Characters)
.
.
.
.
.
. 538
%TRIMR
(Trim
Trailing
Characters)
.
.
.
.
.
. 539
%UCS2
(Convert
to
UCS-2
Value)
.
.
.
.
.
. 540
%UNS
(Convert
to
Unsigned
Format)
.
.
.
.
. 541
%UNSH
(Convert
to
Unsigned
Format
with
Half
Adjust)
.
.
.
.
.
.
.
.
.
.
.
.
. 541
%XFOOT
(Sum
Array
Expression
Elements)
.
.
. 543
%XLATE
(Translate)
.
.
.
.
.
.
.
.
.
.
. 544
viii
ILE
RPG
Reference
##########
#
#
#
#
|
|
|
|
|
-
%YEARS
(Number
of
Years)
.
.
.
.
.
.
.
. 545
Chapter
23.
Operation
Codes
.
.
.
. 547
ACQ
(Acquire)
.
.
.
.
.
.
.
.
.
.
.
.
. 548
ADD
(Add)
.
.
.
.
.
.
.
.
.
.
.
.
.
. 549
ADDDUR
(Add
Duration)
.
.
.
.
.
.
.
.
. 550
ALLOC
(Allocate
Storage)
.
.
.
.
.
.
.
.
. 552
ANDxx
(And)
.
.
.
.
.
.
.
.
.
.
.
.
. 553
BEGSR
(Beginning
of
Subroutine)
.
.
.
.
.
. 554
BITOFF
(Set
Bits
Off)
.
.
.
.
.
.
.
.
.
.
. 555
BITON
(Set
Bits
On)
.
.
.
.
.
.
.
.
.
.
. 557
CABxx
(Compare
and
Branch)
.
.
.
.
.
.
.
. 559
CALL
(Call
a
Program)
.
.
.
.
.
.
.
.
.
. 561
CALLB
(Call
a
Bound
Procedure)
.
.
.
.
.
.
. 562
CALLP
(Call
a
Prototyped
Procedure
or
Program)
563
CASxx
(Conditionally
Invoke
Subroutine)
.
.
.
. 568
CAT
(Concatenate
Two
Strings)
.
.
.
.
.
.
. 570
CHAIN
(Random
Retrieval
from
a
File)
.
.
.
. 573
CHECK
(Check
Characters)
.
.
.
.
.
.
.
. 576
CHECKR
(Check
Reverse)
.
.
.
.
.
.
.
.
. 579
CLEAR
(Clear)
.
.
.
.
.
.
.
.
.
.
.
.
. 582
Clearing
Variables
.
.
.
.
.
.
.
.
.
.
. 582
Clearing
Record
Formats
.
.
.
.
.
.
.
. 582
CLEAR
Examples
.
.
.
.
.
.
.
.
.
.
. 583
CLOSE
(Close
Files)
.
.
.
.
.
.
.
.
.
.
. 586
COMMIT
(Commit)
.
.
.
.
.
.
.
.
.
.
. 587
COMP
(Compare)
.
.
.
.
.
.
.
.
.
.
.
. 588
DEALLOC
(Free
Storage)
.
.
.
.
.
.
.
.
. 589
DEFINE
(Field
Definition)
.
.
.
.
.
.
.
.
. 591
*LIKE
DEFINE
.
.
.
.
.
.
.
.
.
.
.
. 591
*DTAARA
DEFINE
.
.
.
.
.
.
.
.
.
. 593
DELETE
(Delete
Record)
.
.
.
.
.
.
.
.
. 595
DIV
(Divide)
.
.
.
.
.
.
.
.
.
.
.
.
. 597
DO
(Do)
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 598
DOU
(Do
Until)
.
.
.
.
.
.
.
.
.
.
.
. 600
DOUxx
(Do
Until)
.
.
.
.
.
.
.
.
.
.
.
. 601
DOW
(Do
While)
.
.
.
.
.
.
.
.
.
.
.
. 603
DOWxx
(Do
While)
.
.
.
.
.
.
.
.
.
.
. 604
DSPLY
(Display
Message)
.
.
.
.
.
.
.
.
. 606
DUMP
(Program
Dump)
.
.
.
.
.
.
.
.
. 609
ELSE
(Else)
.
.
.
.
.
.
.
.
.
.
.
.
.
. 611
ELSEIF
(Else
If)
.
.
.
.
.
.
.
.
.
.
.
.
. 612
ENDyy
(End
a
Structured
Group)
.
.
.
.
.
. 613
ENDSR
(End
of
Subroutine)
.
.
.
.
.
.
.
. 615
EVAL
(Evaluate
expression)
.
.
.
.
.
.
.
. 616
EVALR
(Evaluate
expression,
right
adjust)
.
.
.
. 618
EXCEPT
(Calculation
Time
Output)
.
.
.
.
.
. 619
EXFMT
(Write/Then
Read
Format)
.
.
.
.
.
. 621
EXSR
(Invoke
Subroutine)
.
.
.
.
.
.
.
.
. 623
EXTRCT
(Extract
Date/Time/Timestamp)
.
.
.
. 624
FEOD
(Force
End
of
Data)
.
.
.
.
.
.
.
.
. 626
FOR
(For)
.
.
.
.
.
.
.
.
.
.
.
.
.
. 627
FORCE
(Force
a
Certain
File
to
Be
Read
Next
Cycle)
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 630
GOTO
(Go
To)
.
.
.
.
.
.
.
.
.
.
.
.
. 631
IF
(If)
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 633
IFxx
(If)
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 634
IN
(Retrieve
a
Data
Area)
.
.
.
.
.
.
.
.
. 636
ITER
(Iterate)
.
.
.
.
.
.
.
.
.
.
.
.
. 638
KFLD
(Define
Parts
of
a
Key)
.
.
.
.
.
.
.
. 640
KLIST
(Define
a
Composite
Key)
.
.
.
.
.
.
. 641
LEAVE
(Leave
a
Do/For
Group)
.
.
.
.
.
.
. 643
LEAVESR
(Leave
a
Subroutine)
.
.
.
.
.
.
. 645
LOOKUP
(Look
Up
a
Table
or
Array
Element)
.
. 646
MHHZO
(Move
High
to
High
Zone)
.
.
.
.
. 649
MHLZO
(Move
High
to
Low
Zone)
.
.
.
.
.
. 650
MLHZO
(Move
Low
to
High
Zone)
.
.
.
.
.
. 651
MLLZO
(Move
Low
to
Low
Zone)
.
.
.
.
.
. 652
MONITOR
(Begin
a
Monitor
Group)
.
.
.
.
. 653
MOVE
(Move)
.
.
.
.
.
.
.
.
.
.
.
.
. 655
MOVEA
(Move
Array)
.
.
.
.
.
.
.
.
.
. 669
Character,
graphic,
and
UCS-2
MOVEA
Operations
.
.
.
.
.
.
.
.
.
.
.
.
. 669
Numeric
MOVEA
Operations
.
.
.
.
.
.
. 669
General
MOVEA
Operations
.
.
.
.
.
.
. 670
MOVEL
(Move
Left)
.
.
.
.
.
.
.
.
.
.
. 676
MULT
(Multiply)
.
.
.
.
.
.
.
.
.
.
.
. 686
MVR
(Move
Remainder)
.
.
.
.
.
.
.
.
. 687
NEXT
(Next)
.
.
.
.
.
.
.
.
.
.
.
.
. 688
OCCUR
(Set/Get
Occurrence
of
a
Data
Structure)
689
ON-ERROR
(On
Error)
.
.
.
.
.
.
.
.
.
. 693
OPEN
(Open
File
for
Processing)
.
.
.
.
.
.
. 694
ORxx
(Or)
.
.
.
.
.
.
.
.
.
.
.
.
.
. 696
OTHER
(Otherwise
Select)
.
.
.
.
.
.
.
.
. 697
OUT
(Write
a
Data
Area)
.
.
.
.
.
.
.
.
. 699
PARM
(Identify
Parameters)
.
.
.
.
.
.
.
. 700
PLIST
(Identify
a
Parameter
List)
.
.
.
.
.
.
. 703
POST
(Post)
.
.
.
.
.
.
.
.
.
.
.
.
.
. 705
READ
(Read
a
Record)
.
.
.
.
.
.
.
.
.
. 707
READC
(Read
Ne