9.101 GET_NUM_AREA

Note: Built-In Function Rules     Usage Options

Gets a numeric value from a numeric data area.

Arguments

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

Data area name

1

10

 

 

2

A

Opt

Library name
Default: *LIBL

1

10

 

 

3

A

Opt

Lock data area
Y - lock data area.
N - do not lock data area.
Default: N

1

1

 

 

 

Return Values

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

N

Opt

Returned value

 

15

0

0

 

Example

Retrieve a batch number #BATCH from data area named NEXTBATCH which should be located via the job's library list.

Increment the batch number value and place the incremented value back into the data area.

Make sure that no 2 jobs can be assigned the same batch number by using the lock and unlock options.

USE        BUILTIN(GET_NUM_AREA) 

           WITH_ARGS(NEXTBATCH '''*LIBL''' 'Y') TO_GET(#BATCH)

CHANGE     FIELD(#BATCH) TO('#BATCH + 1')

USE        BUILTIN(PUT_NUM_AREA) 

           WITH_ARGS(#BATCH NEXTBATCH '''*LIBL'' 'Y')