Monday, September 10, 2007

Creating Help for AS/400 Commands:

A simpler method to create help for AS/400 Commands is to use the command ‘Generate Command Documentation’ (GENCMDDOC).

This command can be used to create a UIM (User Interface Manager) source that acts as a template for the command’s help.

The command is shown below.

GENCMDDOC CMD(MYLIB/MYCMD)
TODIR('/QSYS.LIB/MYLIB.LIB/QPNLSRC.FILE')
TOSTMF(*CMD) GENOPT(*UIM)

In the example, the command retrieves information from the command object named MYCMD in library MYLIB and generates UIM source into member MYCMD of source file QPNLSRC in library MYLIB.

After the template UIM source has been generated, the UIM source needs to be edited. <...> marker in the UIM source needs to be replaced with the appropriate text. The parameter descriptions can also be edited. List of messages to contain the actual message identifiers of messages signaled from the command, along with the message file that contains the message descriptions can also be provided.

Once the UIM source has been edited to tailor to the command, the help panel group can be created by using the Create Panel Group (CRTPNLGRP) command. The following is an example of using the Create Panel Group (CRTPNLGRP) command:

CRTPNLGRP PNLGRP(MYLIB/MYCMD)
SRCFILE(MYLIB/QPNLSRC) SRCMBR(MYCMD)

This command attempts to create a panel group from the UIM source in member MYCMD in source physical file QPNLSRC in library MYLIB. If there are no severe errors found when compiling the UIM source, a panel group (*PNLGRP) object named MYCMD is created in library MYCMD. The command generates a spooled file, which can be viewed to see informational, warning, and severe errors found by the UIM compiler.

Once the Panel group is created, it can be associated to the command while creating the command.

CRTCMD CMD(MYLIB/MYCMD) PGM(MYLIB/MYPGM) SRCFILE(MYLIB/QPNLSRC)
HLPPNLGRP(MYLIB/MYCMD) HLPID(*CMD)

No comments: