ibm-information-center/dist/eclipse/plugins/i5OS.ic.apiref_5.4.0.1/apiexushand.htm

144 lines
7.4 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="reference" />
<meta name="DC.Title" content="Example: Using profile handles" />
<meta name="abstract" content="This example illustrates how to generate, change, and release profile handles in a CL program." />
<meta name="description" content="This example illustrates how to generate, change, and release profile handles in a CL program." />
<meta name="DC.Relation" scheme="URI" content="apiexmp.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="apiexushand" />
<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: Using profile handles</title>
</head>
<body id="apiexushand"><a name="apiexushand"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example: Using profile handles</h1>
<div><p>This example illustrates how to generate, change,
and release profile handles in a CL program.</p>
<div class="section"><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>
<pre>/*******************************************************************/
/*******************************************************************/
/* */
/* FUNCTION: Illustrates how to generate, change, and release */
/* profile handles in a CL program. */
/* */
/* LANGUAGE: CL */
/* */
/* APIs USED: QSYGETPH - Get Profile Handle */
/* QWTSETP - Set Profile */
/* QSYRLSPH - Release Profile Handle */
/* */
/*******************************************************************/
/*******************************************************************/
PGM (&amp;USERID &amp;PWD &amp;PWDLEN)
/*----------------------------------------------------------*/
/* Parameters: */
/*----------------------------------------------------------*/
/* 10 Character user ID */
DCL VAR(&amp;USERID) TYPE(*CHAR) LEN(10)
/* Password (up to 50 bytes) */
/* This password is case sensitive */
DCL VAR(&amp;PWD) TYPE(*CHAR) LEN(50)
/* Length of the password in binary(4) form (example-- a */
/* 5 byte password length would be X'00000005) */
DCL VAR(&amp;PWDLEN) TYPE(*CHAR) LEN(4)
/*----------------------------------------------------------*/
/* Variables needed by this program: */
/*----------------------------------------------------------*/
/* Password CCSID value of -1. The current password level */
/* for the system is used to determine the CCSID of the */
/* password. */
DCL VAR(&amp;PWDCCSID) TYPE(*CHAR) LEN(4) +
VALUE( X'FFFFFFFF')
/* Exceptions will be signalled */
DCL VAR(&amp;ERRCODE) TYPE(*CHAR) LEN(8) +
VALUE( X'0000000000000000')
/* Password for *CURRENT user ID. When *CURRENT is */
/* specified for the user ID, the password field will be */
/* ignored. */
DCL VAR(&amp;CURPWD) TYPE(*CHAR) LEN(10) +
VALUE(' ')
/* Profile handles returned */
DCL VAR(&amp;PRFHNDL1) TYPE(*CHAR) LEN(12)
DCL VAR(&amp;PRFHNDL2) TYPE(*CHAR) LEN(12)
/*----------------------------------------------------------*/
/* Generate profile handles for the user ID this program */
/* is currently running under and for the user ID passed */
/* to this program: */
/*----------------------------------------------------------*/
CALL PGM(QSYGETPH) PARM('*CURRENT ' +
&amp;CURPWD /* Password ignored +
when *CURRENT is +
specified */+
&amp;PRFHNDL1)
CALL PGM(QSYGETPH) PARM(&amp;USERID +
&amp;PWD +
&amp;PRFHNDL2 +
&amp;ERRCODE /* Exceptions will +
be signalled */ +
&amp;PWDLEN /* Length of pwd */ +
&amp;PWDCCSID) /* Password CCSID */
/*----------------------------------------------------------*/
/* Change the user for this job to the user ID passed to */
/* this program: */
/*----------------------------------------------------------*/
CALL PGM(QWTSETP) PARM(&amp;PRFHNDL2)
/*----------------------------------------------------------*/
/* This program is now running under the user ID passed to */
/* this program. */
/*----------------------------------------------------------*/
/*----------------------------------------------------------*/
/* Now change the user ID for this job back to the user ID */
/* it was originally running under */
/*----------------------------------------------------------*/
CALL PGM(QWTSETP) PARM(&amp;PRFHNDL1)
/*----------------------------------------------------------*/
/* The profile handles generated in this program can now */
/* be released: */
/*----------------------------------------------------------*/
CALL PGM(QSYRLSPH) PARM(&amp;PRFHNDL1)
CALL PGM(QSYRLSPH) PARM(&amp;PRFHNDL2)
ENDPGM</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="apiexmp.htm" title="Contains example programs that use APIs and exit programs.">Examples: APIs</a></div>
</div>
</div>
</body>
</html>