Topic
1 reply Latest Post - ‏2010-09-13T13:53:29Z by DirkVW
MikeC123
MikeC123
1 Post
ACCEPTED ANSWER

Pinned topic API data type

‏2010-03-04T00:46:07Z |
Hi,
I'm trying to code a CL program for API QYASSDMO and are having problems lining up the correct data types. The API is described as:
QYASSDMO
Session handle
INPUT; CHAR(8)

Operation key
INPUT; BINARY(4)

Operation variable
INPUT; CHAR(*)

Length of operation variable
INPUT; BINARY(4)

Format name of operation variable
INPUT; CHAR(8)

Error code
I/O; CHAR(*)

I need to use format DMOP0700 which is described as:
Offset Type Field
Dec Hex
0 0 BINARY(4) Offset to ASP numbers
4 4 BINARY(4) Number of ASP numbers
8 8 BINARY(4) ASP operation option
12 C BINARY(4) Reserved (must be set to 0)
NOTE: The following fields repeat the number of times specified in the number of ASP numbers field.
BINARY(4) ASP number
So far I have the following code:
DCL VAR(&HANDLE) TYPE(*CHAR) LEN(8)
DCL VAR(&ERROR) TYPE(*CHAR) LEN(96)
DCL VAR(&OPKEY) TYPE(*CHAR) LEN(4)
DCL VAR(&OPVAR) TYPE(*PTR)
DCL VAR(&OPVARLEN) TYPE(*CHAR) LEN(4)
DCL VAR(&FORMAT) TYPE(*CHAR) LEN(8) VALUE('DMOP0700')
DCL VAR(&ASPNO) TYPE(*CHAR) LEN(4)
DCL VAR(&ASPTHRESH) TYPE(*CHAR) LEN(4)
DCL VAR(&OFFASPNUM) TYPE(*CHAR) LEN(4)
DCL VAR(&NUMASP) TYPE(*CHAR) LEN(4)
DCL VAR(&NUMASP1) TYPE(*CHAR) LEN(4)
DCL VAR(&ASPOPT) TYPE(*CHAR) LEN(4)
DCL VAR(&RESERV) TYPE(*CHAR) LEN(4)
/* value of 20 to specify detach operation */
CHGVAR VAR(%BIN(&OPKEY 1 4)) VALUE(20)
CHGVAR VAR(%BIN(&ASP 1 4)) VALUE(&ASP)
/* value of 1 do specify detach with tracking */
CHGVAR VAR(%BIN(&ASPOPT 1 4)) VALUE(1)
CHGVAR VAR(%BIN(&RESERV 1 4)) VALUE(0)
CHGVAR VAR(%BIN(&OPVARLEN 1 4)) VALUE(20)
CHGVAR VAR(&OPVAR) VALUE(&OFFASPNUM *CAT &NUMASP *CAT &ASPOPT *CAT &RESERV +
*CAT &ASPNO)

CALL PGM(QYASSDMO) PARM(&HANDLE &OPKEY &OPVAR &OPVARLEN &FORMAT &ERROR)

I'm getting error CPFBA4B
Message . . . . : Length of operation variable not valid.

Cause . . . . . : The value of the length of operation variable must be at
least as large as the size of the format specified in the format name
operation variable parameter.
Recovery . . . : Assign a value to the length of operation variable that is
large enough to contain the format specified in the format name of operation
variable parameter.

Would anyone have a sample of this API working?
Updated on 2010-09-13T13:53:29Z at 2010-09-13T13:53:29Z by DirkVW
  • DirkVW
    DirkVW
    1 Post
    ACCEPTED ANSWER

    Re: API data type

    ‏2010-09-13T13:53:29Z  in response to MikeC123
    Hi Mike,

    I'm struggling with the same problem. I've tried to code this in ILE RPG. I've coded the parameters as 4B for binary and I get the same CPFBA4B as a result.

    Did you get more information in the mean tiime ?
    Any help or documentation would be very much appreciated.
    Dirk.