You have to be careful with the size of the output from that API, as it can be rather large. The API will run any choice programs specified on the parameters and return the results as part of the string. I've had it return well over 32K for some commands. I ended up supporting up to 600k in my utility wrapper for that API just to be sure it wouldn't fail. Unlike other APIs, if you don't provide enough room for the entire string, it won't return anything.
The version of Dave's RTVCMDSRC that I have that came from NEWS400 in 1996. It uses MI to pull the command definition directly from the command object, which means that it requires system state on security level 40 or above.
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Vern Hamberg
Sent: Thursday, July 19, 2012 12:22
To: Midrange Systems Technical Discussion
Subject: Re: How To Create A Command With Different Options
I think I have that one - it uses the QCDRCMDD (Retrieve command
definition) API. It generates XML with all the keywords and settings from the source. There's a DTD file that is on everyone's system that defines the tag language - it's at /QIBM/XML/DTD/QcdCLCmd.dtd
I think Dave did some transform to make a nice display of the parameters
- it is not complete, or it wasn't the last I looked.
The XML can be viewed in any browser, and it's a tree that is readable enough to see what you need to see.
It's really useful to use the second output format - CMDD0200 - this will include hidden fields, etc. IBM commands use those a lot, and it can be a surprise to try to duplicate the command structure of IBM commands and get a real surprise with hidden parameters.
Anyway, it's pretty easy to use - you can put the output in a stream file or a receiver variable - here is the result for DSPPFM -
<QcdCLCmd DTDVersion="2.0"><Cmd CmdName="DSPPFM" CmdLib="__LIBL"
CCSID="37" Prompt="Display Physical File Member" PromptMsgID="TXT3842"
HlpPnlGrp="QHNFCMD1" HlpPnlGrpLib="__LIBL" HlpID="DSPPFM" MaxPos="2"
MsgF="QCPFMSG" MsgFLib="__LIBL" PmtFile="QCPFPMT" PmtFileLib="QDEVELOP"
ExecBatch="NO" ChgCmdExit="NO" RtvCmdExit="NO"><Parm Kwd="WHERE"
KeyParm="NO" Type="CHAR" Min="1" Len="2" Vary="NO" PassAtr="NO"
Constant="DB" ></Parm><Parm Kwd="FILE" PosNbr="1" KeyParm="NO"
ListDspl="INT2" RtnVal="NO" PassVal="DFT" Type="QUAL" Min="1" Max="1"
Prompt="File" PromptMsgID="TXT0463" Rstd="NO" AlwUnprt="YES"
AlwVar="YES" Expr="YES" Full="NO" DspInput="YES" IsDtaAra="NO"
IsFile="IN" IsPgm="NO" ><Qual Type="NAME" Min="1" Max="1" Len="10"
Rstd="NO" AlwUnprt="YES" AlwVar="YES" Expr="YES" Full="NO"
DspInput="YES" Vary="NO" PassAtr="NO" Case="MONO" InlPmtLen="10"
Choice="Name" ></Qual><Qual Type="NAME" Min="0" Max="1" Prompt="Library"
PromptMsgID="TXT0909" Len="10" Rstd="NO" Dft="*LIBL" AlwUnprt="YES"
AlwVar="YES" Expr="YES" Full="NO" DspInput="YES" Vary="NO" PassAtr="NO"
Case="MONO" InlPmtLen="10" Choice="Name, *LIBL, *CURLIB" ><SpcVal><Value Val="*LIBL" MapTo="*LIBL"/><Value Val="*CURLIB" MapTo="*CURLIB "/></SpcVal></Qual></Parm><Parm Kwd="MBR" PosNbr="2" KeyParm="NO"
RtnVal="NO" PassVal="DFT" Type="NAME" Min="0" Max="1" Prompt="Member"
PromptMsgID="TXT0594" Len="10" Rstd="NO" Dft="*FIRST" AlwUnprt="YES"
AlwVar="YES" Expr="YES" Full="NO" DspInput="YES" Vary="NO" PassAtr="NO"
Case="MONO" InlPmtLen="10" IsDtaAra="NO" IsFile="NO" IsPgm="NO"
Choice="Name, *FIRST, *LAST" ><SpcVal><Value Val="*FIRST"
MapTo="*FIRST"/><Value Val="*LAST" MapTo="*LAST"/></SpcVal></Parm><Parm
Kwd="FROMRCD" PosNbr="3" KeyParm="NO" RtnVal="NO" PassVal="DFT"
Type="UINT4" Min="0" Max="1" Prompt="From record" PromptMsgID="TXT6191"
Rstd="NO" Dft="1" Rel="GT" RelVal="0" AlwUnprt="YES" AlwVar="YES"
Expr="YES" Full="NO" DspInput="YES" Vary="NO" PassAtr="NO" Case="MONO"
IsDtaAra="NO" IsFile="NO" IsPgm="NO" Choice="Number, *END, *ALLDATA"
<SpcVal><Value Val="*END" MapTo="4294967295"/><Value Val="*ALLDATA"
MapTo="4294967294"/></SpcVal></Parm></Cmd></QcdCLCmd>
Paste that into a text editor, save it with an XML extension, then open it in Firefox or IE.
HTH
Vern
On 7/19/2012 10:06 AM, sjl wrote:
Dave McKenzie wrote an excellent RTVCMDSRC utility which can retrieve
the command source for any user-written or IBM command, so that you
can see the source code for any existing command on your system.
At one time it was available for download from the System iNetwork
site (now www.iprodeveloper.com), but I cannot seem to find it now.
- sjl
"w 4038" wrote in message
news:mailman.10386.1342670632.2513.midrange-l@xxxxxxxxxxxx...
Hi
How would you create a command that has different options?
For example, consider the SAVOBJ command. If *SAVF is entered in the
Device option, then the "Save File" option is displayed when you press ENTER.
I want to create a command that has 2 choices in an "Activity" option.
The user can enter either DELETE or UPDATE in the "Activity" option.
When ENTER is pressed, the command should display different options.
The DELETE option would display an option requesting a password.
The UPDATE option would display options related to the columns/fields
to update.
Thank you
=
As an Amazon Associate we earn from qualifying purchases.