172 lines
10 KiB
HTML
172 lines
10 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE html
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html lang="en-us" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="security" content="public" />
|
|
<meta name="Robots" content="index,follow" />
|
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
|
<meta name="DC.Type" content="concept" />
|
|
<meta name="DC.Title" content="Example: Use a prompt override program" />
|
|
<meta name="abstract" content="This example shows the command source for a command and the prompt override program." />
|
|
<meta name="description" content="This example shows the command source for a command and the prompt override program." />
|
|
<meta name="DC.subject" content="example, prompt override program, CL sample, using" />
|
|
<meta name="keywords" content="example, prompt override program, CL sample, using" />
|
|
<meta name="DC.Relation" scheme="URI" content="pop.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="wrtpop.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="passinfo.htm" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="sampop" />
|
|
<meta name="DC.Language" content="en-us" />
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
|
<title>Example: Use a prompt override program</title>
|
|
</head>
|
|
<body id="sampop"><a name="sampop"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Example: Use a prompt override program</h1>
|
|
<div><p>This example shows the command source for a command and the prompt
|
|
override program.</p>
|
|
<p>The following command allows the ownership and text description of a library
|
|
to be changed. The prompt override program for this command receives the
|
|
name of the library; retrieves the current value of the library owner and
|
|
the text description; and then places these values into a command string and
|
|
returns it.</p>
|
|
<div class="note"><span class="notetitle">Note:</span> Read the <a href="codedisclaimer.htm">Code license and disclaimer information</a> for important legal
|
|
information.</div>
|
|
<div class="section"><h4 class="sectiontitle">Command source</h4><pre>CHGLIBATR: CMD PROMPT('Change Library Attributes')
|
|
PARM KWD(LIB) +
|
|
TYPE(*CHAR) MIN(1) MAX(1) LEN(10) +
|
|
KEYPARM(*YES) +
|
|
PROMPT('Library to be changed')
|
|
PARM KWD(OWNER) +
|
|
TYPE(*CHAR) LEN(10) MIN(0) MAX(1) +
|
|
KEYPARM(*NO) +
|
|
PROMPT('Library owner')
|
|
PARM KWD(TEXT) +
|
|
TYPE(*CHAR) MIN(0) MAX(1) LEN(50) +
|
|
KEYPARM(*NO) +
|
|
PROMPT('Text description')</pre>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Prompt override program</h4><p>The following prompt override
|
|
program uses the "?^" selective prompt characters.</p>
|
|
<pre> PGM PARM(&cmdname &keyparm1 &rtnstring)
|
|
/*********************************************************************/
|
|
/* */
|
|
/* Declarations of parameters passed to the prompt override program */
|
|
/* */
|
|
/*********************************************************************/
|
|
DCL VAR(&cmdname) TYPE(*CHAR) LEN(20)
|
|
DCL VAR(&keyparm1) TYPE(*CHAR) LEN(10)
|
|
DCL VAR(&rtnstring) TYPE(*CHAR) LEN(5700)
|
|
</pre>
|
|
<pre> /********************************************************************/
|
|
/* */
|
|
/* Return command string structure declaration */
|
|
/* */
|
|
/********************************************************************/
|
|
|
|
/* Length of command string generated */
|
|
DCL VAR(&stringlen) TYPE(*DEC) LEN(5 0) VALUE(131)
|
|
DCL VAR(&binlen) TYPE(*CHAR) LEN(2)
|
|
/* OWNER keyword */
|
|
DCL VAR(&ownerkwd) TYPE(*CHAR) LEN(8) VALUE('?<OWNER(')
|
|
DCL VAR(&name) TYPE(*CHAR) LEN(10)
|
|
/* TEXT keyword */
|
|
DCL VAR(&textkwd) TYPE(*CHAR) LEN(8) VALUE(' ?<TEXT(')
|
|
DCL VAR(&descript) TYPE(*CHAR) LEN(102)
|
|
</pre>
|
|
<pre> /********************************************************************/
|
|
/* */
|
|
/* Variables related to command string declarations */
|
|
/* */
|
|
/********************************************************************/
|
|
DCL VAR(&quote) TYPE(*CHAR) LEN(1) VALUE('''')
|
|
DCL VAR(&closparen) TYPE(*CHAR) LEN(1) VALUE(')')
|
|
</pre>
|
|
<pre> /********************************************************************/
|
|
/* */
|
|
/* Start of operable code */
|
|
/* */
|
|
/********************************************************************/
|
|
/********************************************************************/
|
|
/* */
|
|
/* Monitor for exceptions */
|
|
/* */
|
|
/********************************************************************/
|
|
MONMSG MSGID(CPF0000) +
|
|
EXEC(GOTO CMDLBL(error))
|
|
</pre>
|
|
<pre> /********************************************************************/
|
|
/* */
|
|
/* Retrieve the owner and text description for the library specified*/
|
|
/* on the LIB parameter. Note: This program assumes there are */
|
|
/* no apostrophes in the TEXT description, such as (Carol's) */
|
|
/* */
|
|
/********************************************************************/
|
|
RTVOBJD OBJ(&keyparm1) OBJTYPE(*LIB) OWNER(&name) TEXT(&descript)
|
|
|
|
CHGVAR VAR(%BIN(&binlen)) VALUE(&stringlen)
|
|
</pre>
|
|
<pre> /********************************************************************/
|
|
/* */
|
|
/* Build the command string */
|
|
/* */
|
|
/********************************************************************/
|
|
CHGVAR VAR(&rtnstring) VALUE(&binlen)
|
|
CHGVAR VAR(&rtnstring) VALUE(&rtnstring *TCAT &ownerkwd)
|
|
CHGVAR VAR(&rtnstring) VALUE(&rtnstring *TCAT &name)
|
|
CHGVAR VAR(&rtnstring) VALUE(&rtnstring *TCAT &closparen)
|
|
CHGVAR VAR(&rtnstring) VALUE(&rtnstring *TCAT &textkwd)
|
|
CHGVAR VAR(&rtnstring) VALUE(&rtnstring *TCAT &quote)
|
|
CHGVAR VAR(&rtnstring) VALUE(&rtnstring *TCAT &descript)
|
|
CHGVAR VAR(&rtnstring) VALUE(&rtnstring *TCAT &quote)
|
|
CHGVAR VAR(&rtnstring) VALUE(&rtnstring *TCAT &closparen)
|
|
|
|
GOTO CMDLBL(pgmend)
|
|
ERROR:
|
|
VALUE(0)
|
|
CHGVAR VAR(%BIN(&rtnstring 1 2)) VALUE(&stringlen)
|
|
VALUE(&binlen)
|
|
</pre>
|
|
<pre> /********************************************************************/
|
|
/* */
|
|
/* Send error message(s) */
|
|
/* */
|
|
/* NOTE: If you wish to send a diagnostic message as well as CPF0011*/
|
|
/* you will have to enter a valid error message ID in the */
|
|
/* MSGID parameter and a valid message file in the MSGF */
|
|
/* parameter for the first SNGPGMMSG command listed below. */
|
|
/* If you do not wish to send a diagnostic message, do not */
|
|
/* include the first SNDPGMMSG in your program. However, in */
|
|
/* error conditions, you must ALWAYS send CPF0011 so the */
|
|
/* second SNDPGMMSG command must be included in your program. */
|
|
/* */
|
|
/********************************************************************/
|
|
SNDPGMMSG MSGID(XXXXXXX) MSGF(MSGLIB/MSGFILE) MSGTYPE(*DIAG)
|
|
SNDPGMMSG MSGID(CPF0011) MSGF(QCPFMSG) MSGTYPE(*ESCAPE)
|
|
|
|
PGMEND:
|
|
ENDPGM</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="pop.htm" title="The prompt override program allows current values rather than defaults to be displayed when a command is prompted. Key parameters are parameters, such as the name of an object, that uniquely identify the object.">Key parameters and prompt override programs</a></div>
|
|
</div>
|
|
<div class="relconcepts"><strong>Related concepts</strong><br />
|
|
<div><a href="passinfo.htm" title="Based on the values passed, the prompt override program retrieves the current values for the parameters that are not key parameters.">Information returned from the prompt override program</a></div>
|
|
</div>
|
|
<div class="reltasks"><strong>Related tasks</strong><br />
|
|
<div><a href="wrtpop.htm" title="A prompt override program needs to be passed certain information to return current values when a command is prompted.">Write a prompt override program</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |