View Full Version : Variablen in QCMDCHK zulassen
Hallo zusammen,
kennt jemand eine Möglichkeit Variablen im QCMDCHK zuzulassen, ohne dass die Nachricht CPD0103 ausgegeben wird. Die Werte &xy werden nämlich vom Programm später vorm QCMDEXC mit anderen Werten ersetzt.
/free
p_cmd = 'CPYF FROMFILE(&FROMLIB/&FILE) ' +
'TOFILE(&TOLIB/&FILE) FROMMBR(*ALL) TOMBR(*FROMMBR) ' +
'FROMRCD(1) COMPRESS(*YES)';
p_cmd = '?' + p_cmd;
callp(e) qcmdchk(p_cmd: 250);
/end-free
Merci...
Dirk
Hierfür ist folgendes API besser geeignet:
Process Commands (QCAPCMD) API (http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/apis/qcapcmd.htm)
Mit Type of command=4 und Promt=0 könnte das Ergebnis das gewünschte sein.
QCMDCHK ist die vereinfachte Form und unterstützt eben keine Variablen.
@Fuerchau: Danke für den Tip!
So tuts:
*** externe Prozeduren ***
D qcapcmd pr extpgm('QCAPCMD') Befehl prüfen
D 200 Command
D 10i 0 const Len
D 20 const Options
D 10i 0 const Len
D 8 const Options format
D 200 Changed Command
D 10i 0 const Len avail
D 10i 0 const Len returned
D 515 API-Error
*** Datenstrukturen ***
D cpop0100 ds qualified CPOP0100-Format
D cmdType 10i 0 inz(4) Comand type
D dbcsHandling 1 inz('0') DBCS data handling
D promptAction 1 inz('1') Prompt action
D cmdSyntax 1 inz('0') Comand syntax
D msgRtvKey 4 inz(*allx'00') Messange rtv. Key
D ccsid 10i 0 inz(0) CCSID of Command
D res1 5 inz(*allx'00') Reserviert
D apiError ds qualified API-Error
D bytesProv 10i 0 inz(%len(apiError)) Länge erw.
D bytesAvail 10i 0 Länge verf.
D msgId 7 MsgId
D res1 1 reserved
D msgData 500 MsgData
*** Felder ***
D p_cmd s 200
D p_cmdLen s 10i 0
/free
// Anfangswerte setzen
// ===================
p_cmd = 'CPYF FROMFILE(&TSYSSLIB/&FILE) ' +
'TOFILE(&TSYSTLIB/&FILE) FROMMBR(*ALL) TOMBR(*FROMMBR) ' +
'FROMRCD(1) COMPRESS(*YES)';
// Befehl prüfen
// =============
callp(e) qcapcmd(p_cmd: %len(p_cmd): cpop0100: %len(cpop0100):
'CPOP0100': p_cmd: %len(p_cmd): p_cmdLen: apiError);
if apiError.bytesAvail > 0;
...