Attempting to use I5_TYPE_STRUCT as a parameter.

The place for general PHP questions and hints for PHP on IBM i

Attempting to use I5_TYPE_STRUCT as a parameter.

Postby raym3748 on Fri Sep 25, 2015 2:56 pm

I am using this sample code as my prototype. What I cannot find is the RPG code for the call.

Code: Select all
<?php
$person = array(
    "name" => array(I5_TYPE_CHAR, 50),
    "age" => array(I5_TYPE_INT, 0),
    "ID" => array(I5_TYPE_BYTE, 10)
);
$data = array(
"person" => array(I5_TYPE_STRUCT, $person),
"last_accesses" => array(I5_TYPE_INT, 0, I5_OUT, 3),
"account_balance" => array(I5_TYPE_PACKED, "10.3", I5_OUT)
);
$prg = i5_program_prepare("MYLIB/PERSONPGM", $data);
?>


I set up my parameters to match the RPG but the i5_program_prepare fails with the message that it is expecting a string parameter. If I change the I5_TYPE_STRUCT to a I5_TYPE_CHAR and set the length to match the length of the data structure parameter in the RPG, it runs without error. Trouble is, I get back a huge string of data that is difficult to use.

Has anyone successfully used the I5_TYPE_STRUCT parameter with RPG and would be willing to give me some pointers?

Thanks.
raym3748
 
Posts: 1
Joined: Fri Sep 25, 2015 2:51 pm

Return to PHP Questions / Hints

Who is online

Users browsing this forum: No registered users and 1 guest