ile rpg reference - ibm.com · pdf fileiseries websphere®® development studio ile rpg...

862
iSeries WebSphere ®® Development Studio ILE RPG Reference Version 5 SC09-2508-05 E Rserver

Upload: dangthuy

Post on 06-Feb-2018

293 views

Category:

Documents


3 download

TRANSCRIPT

  • 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

    .

    .

    .

    .

    .

    .

    .

    .

    . 2