I am trying to use QzhbCgiParse API in RPGLE to parse the QUERY_STRING, but it keeps throwing the error 'Error code parameter not valid'.
Dcl-Pr QzhbCgiParse extproc('QzhbCgiParse');
cmdStr char(100) const;
outFmt char(8) const;
targetBuf char(5000);
targetSize int(10) const;
responseLen int(10);
errorCode likeds(WPError);
End-Pr;
Dcl-S cmdStr char(100);
Dcl-S outFmt char(8);
Dcl-S targetBuf char(5000);
Dcl-S targetSize int(10);
Dcl-S responseLen int(10);
Dcl-Ds WPError;
bytesProv int(10) inz(%size(WPError));
bytesAvail int(10) inz(0);
errMsgId char(7);
*n char(1);
errMsgData char(40);
End-Ds;
QzhbCgiParse('-v ':'CGII0100': targetBuf: %size(targetBuf) : responseLen :WPError);
I have tried many data structure for the error code parameter, all in vain. Please advise.
I have got it working, API prototype was the issue. Once i changed the prototype as below, it worked perfectly.