PreviousNext
Help > Programming with LAUNCHER Office > Advanced programming > API Programs with AS400 client > LNCGETKW - API Program
LNCGETKW - API Program

 Program LNCGETKW gets the value associated with a keyword on return of a call to LNCCMD.

This program can also convert a number stored in character format in a variable, into packed or zoned decimal format.

 

Syntax

 

DCL

VAR(&HANDLE) TYPE(*CHAR) LEN(50)

DCL

VAR(&PARM1) TYPE(*CHAR) LEN(512)

DCL

VAR(&KEYW) TYPE(*CHAR) LEN(...)

DCL

VAR(&VALUE) TYPE( . . .

DCL

VAR(&FORMAT) TYPE(*CHAR) LEN(10)

 

 

CALL

PGM(LNCGETKW) PARM(&HANDLE &PARM1 +

&KEYW &VALUE &FORMAT)

 

 

Parameters

 

Parameters

 

&PARMX

Variable &PARMX contains the value returned by a previous call to LNCCMD.

 

&KEYW

&KEYW contains the keyword for witch we want to get the value.
The keyword can be inside doubles quotes ("), or, it must be ended by a punctuation character or a blank.

Example: CHGVAR VAR(&KEYW) VALUE('Pattern;') 

If the first character of &KEYW is an asterix (*), then the next characters represent a data format, in the form : Tn.d .
The text stored in &PARMX will be then converted into a decimal format in &VALUE.
T is the data type:
A for character.
P for packed decimal
S for zoned decimal.
n is the number of digits or characters in &VALUE.
d is the number of digits after the decimal point for a numeric value.

Example: CHGVAR VAR(&KEYW) VALUE('*P8.2 ') 

 

&VALUE

Variable where the value associated to the keyword must be stored.

 

&FORMAT

Format of parameter &VALUE, in the form : Tn.d
T is the data type:
A for character.
P for packed decimal
S for zoned decimal.
n is the number of digits or characters in &VALUE.
d is the number of digits after the decimal point for a numeric value.

If &FORMAT is absent, variable &VALUE is considered as character type, and its size will be not controlled.

.

 

 

 

Example

 

DCL  VAR(&SBJ) TYPE(*CHAR) LEN(50)
DCL  VAR(&SND) TYPE(*CHAR) LEN(50)
...
CALL  PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 &PARM2 &RES)

/* Here &RES contains: */
/* 'Subject="My message";SenderName="Accounting service"' */
CALL PGM(LNCGETKW) PARM(&HANDLE &RES 'Subject ' &SBJ 'A50')
CALL PGM(LNCGETKW) PARM(&HANDLE &RES 'SenderName ' &SND 'A50')

/* After the calls: */
/* &SBJ = 'My message' */
/* &SND = 'Accounting service' */