9.99 GET_CHAR_AREA
Þ Note: Built-In Function Rules.
Gets a character string from a character data area.
For use with
|
Arguments
|
Note: Start position and length, if specified, must BOTH be provided as argument values.
Return Values
|
Examples
Retrieve a company name from a data area named COMPID. Use the job's current library list to locate the data area:
USE BUILTIN(GET_CHAR_AREA) WITH_ARGS(COMPID) TO_GET(#COMPANY)
Retrieve bytes 101 - 110 of data area called USERINFO in library QTEMP and place the result into a field called #OUTQ:
USE BUILTIN(GET_CHAR_AREA)
WITH_ARGS(USERINFO QTEMP N 101 10) TO_GET(#OUTQ)
Warning: When processing *LDA or *GDA, a start position and a length must be specified. If these arguments are not specified the program will terminate abnormally. * Retrieve the first 30 bytes of information from the Local Data Area (*LDA). Note: The *LDA data area will not be locked even if it is specified in the functions arguments.
DEFINE FIELD(#RETVAL) TYPE(*CHAR) LENGTH(30)
USE BUILTIN(GET_CHAR_AREA) WITH_ARGS('''*LDA''' '''*LIBL''' N 1 30) TO_GET(#RETVAL)
Retrieve some information passed by one of my group jobs into the Group Data Area (*GDA). The information is in positions 20 to 50 of the *GDA:
DEFINE FIELD(#RETVAL) TYPE(*CHAR) LENGTH(30)
USE BUILTIN(GET_CHAR_AREA) WITH_ARGS('''*GDA''' '''*LIBL''' N 20 30) TO_GET(#RETVAL)