Vous êtes sur la page 1sur 16

Advanced Command

Facilities
Part 25

Presentation Copyright 2008, Bryan Meyers, www.bmeyers.net


Adding Help to Your Commands

User Interface Manager (UIM) facility provides


help windows for commands
Panel group (*PNLGRP) object contains help
displays
Automatically manages window size, position,
scrolling
Extended help describes entire command
General description, all parameters, function keys
Includes all contextual help
Contextual Help

Sensitive to cursor location


Help for specific command parameter
Extended Help

General command description


Includes all contextual help
GENCMDDOC Command

Generate Command Documentation


(GENCMDDOC) command generates skeleton
help source
Edit to reflect detailed help
GENCMDDOC CMD(MYLIB/EXCCMD) +
GENOPT(*UIM) +
TODIR('/QSYS.LIB/MYLIB.LIB/QPNLSRC.FILE') +
TOSTMF(EXCCMDH.MBR)

Source file: MYLIB/QPNLSRC


Source member: EXCCMDH
Generated UIM Tag Language
:pnlgrp.
.************************************************************************
.* Help for command EXCCMD
.************************************************************************
:help name='EXCCMD'.
Execute Commands from Source - Help
:p.The Execute Commands from Source (EXCCMD) command <...>
.* Describe the function provided by the command.
:ehelp.
.*******************************************
.* Help for parameter MBR
.*******************************************
:help name='EXCCMD/MBR'.
Member (MBR) - Help
:xh3.Member (MBR)
:p.Specifies <...>
.* Describe the function provided by the parameter.
:p.This is a required parameter.
:ehelp.
.*******************************************
.* Help for parameter SRCFILE
.*******************************************
:help name='EXCCMD/SRCFILE'.
Source file name (SRCFILE) - Help
:xh3.Source file name (SRCFILE)
:p.Specifies <...>
.* Describe the function provided by the parameter.
:p.:hp2.Qualifier 1: Source file name:ehp2.
:parml.:pt.:pk def.QCLSRC:epk.

Edited UIM Tag Language


:pnlgrp.
.************************************************************************
.* Help for command EXCCMD
.************************************************************************
:help name='EXCCMD'.Execute Commands from Source - Help
:p.The Execute Commands from Source (EXCCMD) command allows you to execute
commands stored in a source file member, without compiling the member into
a CL program. Using this command, you can easily set up procedures to run
commands sequentially, and change the commands that are executed as your
needs change.
:ehelp.
.*******************************************
.* Help for parameter MBR
.*******************************************
:help name='EXCCMD/MBR'.Member (MBR) - Help
:xh3.Member (MBR)
:p.Specifies the name of the member that contains the commands to be
executed.
:p.This is a required parameter.
:ehelp.
.*******************************************
.* Help for parameter SRCFILE
.*******************************************
:help name='EXCCMD/SRCFILE'.Source file name (SRCFILE) - Help
:xh3.Source file name (SRCFILE)
:p.Specifies the qualified name of the source file that contains the commands
to be executed.
:p.:hp2.Qualifier 1: Source file name:ehp2.
:parml.:pt.:pk def.QCLSRC:epk.

Creating the Panel Group

Create Panel Group (CRTPNLGRP) command


compiles PNLGRP source
CRTPNLGRP PNLGRP(MYLIB/EXCCMDH) +
SRCFILE(MYLIB/MYSRC) +
SRCMBR(EXCCMDH)
Adding Help to Command

*PNLGRP object must be associated with


command
CRTCMD command
CHGCMD command
CRTCMD CMD(EXCCMD) +
PGM(EXCCMDC) +
ALLOW(*INTERACT *BPGM *IPGM) +
HLPPNLGRP(EXCCMDH) +
HLPID(EXCCMD) +
TEXT(Execute commands from source)
Creating HTML Documentation

GENCMDDOC command can also be used to


generate HTML documentation
GENCMDDOC CMD(MYLIB/EXCCMD) +
GENOPT(*HTML) +
TODIR('/home/mydir') +
TOSTMF(EXCCMD.HTML)

IFS file: /home/mydir/EXCCMD.HTML


HTML Tag Language
<!doctype html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Execute Commands from Source (EXCCMD)</title>
</head>
<body bgcolor="white">
<a name="EXCCMD.Top_Of_Page"></a>
<h2>Execute Commands from Source (EXCCMD)</h2>
<table width="100%">
<tr>
<td align="left" valign="top"><b>Where allowed to run: </b>
<ul><li>Interactive job (*INTERACT)</li>
<li>Batch program (*BPGM)</li>
<li>Interactive program (*IPGM)</li>
</ul><b>Threadsafe: </b>No
</td>
<td align="right" valign="top">
<a href="#EXCCMD.PARAMETERS.TABLE">Parameters</a><br>
<a href="#EXCCMD.COMMAND.EXAMPLES">Examples</a><br>
<a href="#EXCCMD.ERROR.MESSAGES">Error messages</a></td>
</tr>
</table>
<div> <a name="EXCCMD"></a>
<p>The Execute Commands from Source (EXCCMD) command allows you to execute commands
stored in a source file member, without compiling the member into a CL program. Using
this command, you can easily set up procedures to run commands sequentially, and change
the commands that are executed as your needs change.
</p>
</div>

HTML Documentation
Validity Checking Program

VCP checks validity of parameter values before


command executes
Allows changes during command prompting
Avoids execution errors
Optional program
Receives command parameters before CPP
CRTCMD VLDCKR(MYLIB/EXCCMDV)
Validity Checking Program

Must receive parameters in order


Must send *DIAG (diagnostic) message
CPD0006 to command prompter if error is
detected
Specify 0000 as first four characters of message
text
Reserved for system use
After all *DIAG messages have been sent, VCP
must send *ESCAPE message CPF0002
Validity Checking Program
/* **************************************************************** */
/* Program name - EXCCMDV Validity checker for EXCCMD command */
/* **************************************************************** */
PGM PARM(&mbr &qualfile &iferror)
/* ************************************************* Declarations */
/* Parameter variables */
DCL &mbr *CHAR 10
DCL &qualfile *CHAR 20
DCL &file *CHAR 10 STG(*DEFINED) DEFVAR(&qualfile)
DCL &lib *CHAR 10 STG(*DEFINED) DEFVAR(&qualfile 11)
DCL &iferror *CHAR 7
/* Work variables */
DCL &msg *CHAR 80
MONMSG CPF0000 EXEC(GOTO ERRORS) /* Global monitor */

/* ******************************************** Procedure section */


/* Check existence of source file */
CHKOBJ OBJ(&lib/&file) OBJTYPE(*FILE) MBR(&mbr)
RETURN

/* *********************************** VCP error-handling routine */


ERRORS:
RCVMSG MSGTYPE(*LAST) MSG(&msg)
MONMSG CPF0000
CHGVAR &msg ('0000' *CAT &msg)
SNDPGMMSG MSGID(CPD0006) MSGF(QCPFMSG) MSGDTA(&msg) MSGTYPE(*DIAG)
MONMSG CPF0000
SNDPGMMSG MSGID(CPF0002) MSGF(QCPFMSG) MSGTYPE(*ESCAPE)
MONMSG CPF0000
ENDPGM
Other Optional Command Programs

Prompt override program


Lets prompter display current parameter values
instead of defaults
Prompt choice program
Allows prompt choices display to be determined
by program instead of hard-coding in CMD source
Prompt control program
Allows conditional parameter prompting, inter-
parameter dependencies

Vous aimerez peut-être aussi