9.155 PUT_CHAR_AREA

Note: Built-In Function Rules     Usage Options

Puts a character string into a character data area.

Arguments

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

Value to put

1

2000

 

 

2

A

Req

Data area name

1

10

 

 

3

A

Opt

Library name

Default: '*LIBL'
When data area is *LDA or *GDA this argument is '*LIBL'.

1

10

 

 

4

A

Opt

Unlock data area

'Y' - unlock data area

'N' - do not unlock data area

Default: 'N'

1

1

 

 

5

N

Opt

Start pos. to insert from.
Default: position 1

1

5

0

0

6

N

Opt

Length to insert
Default: full length

1

4

0

0

 

Note: Start position and length, if specified, must BOTH be provided as argument values.

Return Values

No return values.

Examples

Store a customer name #CUSNAM in a data area LASTCUST which resides in library QTEMP.

USE       BUILTIN(PUT_CHAR_AREA) WITH_ARGS(#CUSNAM LASTCUST QTEMP)

Store a customer name #CUSNAM in bytes 101 to 140 of a data area called INFOCUST which resides in library QTEMP.

USE        BUILTIN(PUT_CHAR_AREA) WITH_ARGS(#CUSNAM INFOCUST QTEMP N 101 40)

Store user name in the *LDA data area to be used for report headings.

USE       BUILTIN(PUT_CHAR_AREA) WITH_ARGS('''JOHN SMITH''' '''*LDA' '')

The first 10 positions of *GDA are updated by the current job. As a group job becomes active it sets a flag in the *GDA.

In other words by retrieving the *GDA you can find out what group jobs you have already activated.

CASE       OF_FIELD(#GROUP)

WHEN       VALUE_IS('*EQ JOB0001')

USE        BUILTIN(PUT_CHAR_AREA) WITH_ARGS('Y' '''*GDA''' '''*LIBL''' 'N' 1 1)

WHEN       VALUE_IS('*EQ JOB0002')

USE        BUILTIN(PUT_CHAR_AREA) WITH_ARGS('Y' '''*GDA''' '''*LIBL''' 'N' 2 1)

ENDCASE