IBM AS/400 manual Fields, Value

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 232
Image 232

Changing

the Value

of

Fields

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Use

the

 

%VARS

debug built-in function when the

variable

name

conflicts

 

 

 

of

the

debug

command names. For example, EVAL %VAR(EVAL) can be used to

 

 

 

evaluate

a

variable

named

EVAL,

whereas

EVAL

EVAL

would

be

a syntax

err

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Changing

the

Value

of

Fields

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

You

can

change

the

value

of fields by

using

the

EVAL

command

with

an

 

 

 

ment

operator

(=).

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The

scope

of

the

fields

used

in the

EVAL command is defined by usin

 

 

 

command. However, you do not need to specifically define the scope o

 

 

 

contained

in

an

ILE

RPG module

because

they

are

all

of

global scope.

To change the value of the field, type:

EVAL field-name = value

on the debug command fieldne.-nameis the name

of

the variable that you w

to change andvalue is an

identifier,

literal,

or

constant value that you w

assign to variablefield-name.

For

example,

 

 

 

EVAL COUNTER=3

 

 

 

 

 

changes the valueCOUNTERof

to

3 and

shows

 

 

COUNTER=3 = 3

 

 

 

 

 

on the message line of the Display Module Source display.

Use the EVAL debug command to assign numeric, alphabetic, and alphanumer data to fields. You can also use the %SUBSTR built-in function in the expression.

When you assign values to a character field, the following rules apply

¹If the length of the source expression is less than the length of expression, then the data is left justified in the target express

remaining positions are filled with blanks.

¹If the length of the source expression is greater than the length

expression, then

the

data is left justified in the target express

to the length of

the

target expression.

Note: Graphic fields can be assigned any of the following:

¹

Another graphic

field

 

 

¹

A

graphic literal of

'theoK1K2iform'

G

¹

A

hexadecimal

literal

of 'hexthe

digitsform' X

UCS-2 fields must be changed using hexadecimal constants. For example,

%UCS2('AB') = U'00410042', then to set

a

UCS-2 field to the

UCS-2

form

the debugger, you would use EVAL ucs2 = X'00410042'.

 

 

Variable-length fields can be assigned

using, for example, EVAL varfldna

'abc'. This sets the data part of

the field

to 'abc' and

the

lengt

length part without changing the data,

determine

the hexadecimal

value

length (for example 11 is X'000B'), and

use EVAL

%SUBSTR(varfldname 1 2)

X'000B'.

 

 

 

 

 

208 ILE RPG for AS/400 Programmer's Guide

Page 232
Image 232
IBM AS/400 manual Fields, Value