IBM AS/400 manual Operation Codes, Example of an ILE RPG Program

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 30
Image 30
Example of an ILE RPG Program

Example of an ILE RPG Program

Each RPG IV indicator has a two-character

name (for example, LR, 01,

referred

to

in

some

entries

of

some

specifications

just

by the two-c

and

in others

by the

special name *INxx where

xx

is

the

two-charact

can

use

several

types

of these

indicators;

each type

signals

somethin

The

positions

on

the

specification

in

which

you define an indicator de

use of the indicator. Once you define an

indicator

in

your

program,

control calculation and output operations.

 

 

 

 

 

 

 

Indicator

variables

can

be

used

any

place

an

indicator

of

the form

used with the exception of the OFLIND and EXTIND keywords on the fil description specifications.

An RPG program sets and resets certain indicators at specific times d program cycle. In addition, the state of indicators can be changed lation operations.

Operation Codes

The RPG IV programming language allows you to do many different types

ations on your Operationdata. codes , entered on the calculation specifications, indicate what operations will be done. For example, if you want to re record, you could READuse operationthe code. The following is a list of the operations available.

Arithmetic operations

Indicator-setting operations

Array operations

Information operations

Bit operations

Initialization operations

Branching operations

Memory Management Operations

Call operations

Message operation

Compare operations

Move operations

Data-Area operations

String operations

Date/Time/Timestamp operations

Structured programming operations

Declarative operations

Subroutine operations

File operations

Test operations

Example of an ILE RPG

Program

This

section illustrates a simple ILE RPG program that performs payroll c

lations.

Problem

Statement

The payroll department of a small company wants to create a print outpu employees' pay for that week. Assume there are two disk files, EMPLOYEE TRANSACT, on the system.

The first file, EMPLOYEE, contains employee records. The figure below sh format of an employee record:

EMP_REC

EMP_NUMBER

EMP_NAME

EMP_RATE

1

6

22

27

6 ILE RPG for AS/400 Programmer's Guide

Page 30
Image 30
IBM AS/400 manual Operation Codes, Example of an ILE RPG Program