I was slapping together a quick proof of concept for
QIBM_QCA_CHG_COMMAND for my colleagues, and since I didn't want the exit
point program to actually do anything, I used dump(a) to dump the
variables out. I was a little surprised that one of the variables I'm
using displays NOT ADDRESSABLE. Did I miss something in the 7.2 Memo To
Users in how DUMP behaves?
RPGLE:
**free
/copy qrpglesrc,stdhspec
// QIBM_QCA_CHG_COMMAND example
//
http://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_72/apis/xcachg.htm%23HDRCACHGX?lang=en
// ADDEXITPGM EXITPNT(QIBM_QCA_CHG_COMMAND)
// FORMAT(chgc0100)
// PGMNBR(*HIGH)
// PGM(BUCK/CHG_CMD)
// TEXT('Testing for Buck')
// PGMDTA(*JOB 20 'RS BUCK ')
// *ENTRY PLIST
dcl-pi CHG_CMD extproc('CHG_CMD');
chgCmdExitInfo char(65535);
rplCmd char(32000);
rplCmdLen int(10);
end-pi ;
dcl-ds chgc0100 based(chgc0100Ptr) qualified;
exitName char(20);
exitFormat char(8);
cmdName char(10);
cmdLib char(10);
chgAllowed char(1);
prompt char(1);
reserved char(2);
cmdOffset int(10);
cmdLen int(10);
proxyOffset int(10);
proxyCount int(10);
// cmd
// list of proxyCmd
// proxyLib
end-ds;
dcl-s cmd char(32000) based(cmdPtr);
dcl-ds proxy based(proxyPtr) qualified;
cmd char(10);
lib char(10);
end-ds;
dcl-s i int(10);
dcl-s msg char(50);
// point the main DS at the input parm
chgc0100Ptr = %addr(chgCmdExitInfo);
// now look at the incoming command
cmdPtr = chgc0100Ptr + chgc0100.cmdOffset;
if cmd = *blanks;
dsply 'blank command';
else;
i = chgc0100.cmdLen;
if i > %size(msg);
i = %size(msg);
endif;
msg = %subst(cmd: 1: i);
dsply msg;
endif;
// for completeness, set the proxy chain pointer too
proxyPtr = chgc0100Ptr + chgc0100.proxyOffset;
dump(a);
*inlr = *on;
Dump:
CHGCMDEXITINFO CHAR(65535) NOT ADDRESSABLE
CHGC0100 DS
CHGALLOWED CHAR(1) '1'
CMDLEN INT(10) 37
CMDLIB CHAR(10) 'BUCK '
CMDNAME CHAR(10) 'RS '
CMDOFFSET INT(10) 76
EXITFORMAT CHAR(8) 'CHGC0100'
EXITNAME CHAR(20) 'QIBM_QCA_CHG_CO
VALUE IN HEX 'D8C9C2D46DD8C3C
PROMPT CHAR(1) '0'
PROXYCOUNT INT(10) 0
PROXYOFFSET INT(10) 113
RESERVED CHAR(2) ' '
CHGC0100PTR POINTER SPP:D50F8EF50300
CMD CHAR(32000) NOT ADDRESSABLE
CMDPTR POINTER SPP:D50F8EF50300
I INT(10) 37
MSG CHAR(50) 'RS SQLSTM('sele
As you can see, MSG is a substring of CMD. The dump shows the contents
of MSG, so clearly the code was able to access CMD, yet CMD is NOT
ADDRESSABLE. Neither are the input parameters. Strange.