|
Hi Scott,
Thanks for all the work you put in. Actually, you made me thinking. The fact
that the "Command" is able to place the vary bytes in front of the string
indicates that there is something working between the program using the
command and the command.
Here is the program that dumps with MCH5003. Notice when you debug,
everything runs okay until the return. It must be that the parameter from
the command is not passed by reference.
CMD name is CMD2
CMD
PARM KWD(QIFILE) TYPE(*PNAME) LEN(899) DFT('*') +
PROMPT('Queue information file')
PARM KWD(KEY) TYPE(*CHAR) LEN(32) PROMPT('QIF Key')
PARM KWD(RTNVAL) TYPE(*X) LEN(2400) +
RTNVAL(*YES) PROMPT('CL Var for RTNVAL')
PARM KWD(RTNVALLEN) TYPE(*INT2) PROMPT('Length of +
RTNVAL variable')
CPP, create a *module with debug(source) and then crtpgm. The rest is
default from the crtrpglemod and crtpgm commands. A bit long but I clipped
it from my program.
DW#QIFile S 899
DW#QIFKey S 32
DW#QIFRVal S *
DW#QIFRValLen S 5I 0 inz(0)
DA#QIFile S * inz(%addr(W#QIFile))
DA#QIFKey S * inz(%addr(W#QIFKey))
DA#QIFRVal S * inz(%addr(W#QIFRVal))
DA#QIFRValLen S * inz(%addr(W#QIFRValLen))
* ------------------------------------------
* Parameter field declarations
* ------------------------------------------
DP#QIFile S 899A
DP#QIFKey S 32A
DP#QIFRVal S 2048A
DP#QIFRValLen S 5I 0
* ------------------------------------------
* Field declarations
* ------------------------------------------
DW#RetLen S 5I 0
DW#Blanks S 2048A inz(*Blanks)
C *ENTRY Plist
C PARM P#QIFile
C PARM P#QIFKey
C PARM P#QIFRVal
C PARM P#QIFRValLen
/Free
// ----------------------------------------------------------
// Mainline
// ----------------------------------------------------------
// ------------------------------------------
// Setup parameters to call wallies retriever.
// ------------------------------------------
W#QIFile = %trimr(P#QIFile) + X'00';
W#QIFKey = %trimr(P#QIFKey) + X'00';
W#QIFRValLen = P#QIFRValLen + 1;
W#QIFRVal = %alloc(W#QIFRValLen);
// rc = GetQFKeyVal(A#QIFile:
// A#QIFKey:
// W#QIFRVal:
// W#QIFRValLen);
W#RetLen = P#QIFRValLen;
P#QIFRVal = %str(W#QIFRVal: P#QIFRValLen);
// ------------------------------------------
// Return.
// ------------------------------------------
*INLR = *ON;
Return;
/END-FREE
The command that activates it all is:
PGM &QIF
DCL VAR(&QUEF) TYPE(*CHAR) LEN(14) +
VALUE('xxxxxxxxxxxx')
DCL VAR(&SDIR) TYPE(*CHAR) LEN(48) +
VALUE('aaanzmxnzmxnzmxnzmxnzmnxzmnxmznxmznx+
zmn')
DCL VAR(&QIF) TYPE(*CHAR) LEN(899)
CHGVAR VAR(&QIF) +
VALUE(' sdsdsdsdsdsd -
sdfsdfsdf -
sd+lkfjsldfks +dkf+sldkf +sldk fs+ldkf +sldkfs -
sdfsdf -
sdfsdfsdfsdfsdfsdfsdf -
-
')
CMD2 QIFILE(&QIF) KEY(QUEF) RTNVAL(&QUEF) +
RTNVALLEN(14)
DMPCLPGM
CMD2 QIFILE(&QIF) KEY(SDIR) RTNVAL(&SDIR) +
RTNVALLEN(45)
DMPCLPGM
ENDPGM
do a call thispgm '/does/not/matter'
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.