173 lines
7.9 KiB
HTML
173 lines
7.9 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 iSeries Objects APIs for iSeries Access for Windows" />
|
|||
|
<meta name="abstract" content="The following example shows a typical calling sequence for retrieving a list of spooled files." />
|
|||
|
<meta name="description" content="The following example shows a typical calling sequence for retrieving a list of spooled files." />
|
|||
|
<meta name="DC.Relation" scheme="URI" content="rzaikappobj.htm" />
|
|||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|||
|
<meta name="DC.Format" content="XHTML" />
|
|||
|
<meta name="DC.Identifier" content="objapiex" />
|
|||
|
<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 iSeries Objects APIs for iSeries Access for Windows</title>
|
|||
|
</head>
|
|||
|
<body id="objapiex"><a name="objapiex"><!-- --></a>
|
|||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|||
|
<h1 class="topictitle1">Example: Using iSeries™ Objects APIs for iSeries Access for Windows<sup>®</sup></h1>
|
|||
|
<div><p>The following example shows a typical calling sequence for retrieving
|
|||
|
a list of spooled files.</p>
|
|||
|
<div class="section"><pre>/********************************************************/
|
|||
|
/* List all spooled files for the current user and */
|
|||
|
/* display them to the user. */
|
|||
|
/********************************************************/
|
|||
|
|
|||
|
#ifdef UNICODE
|
|||
|
#define _UNICODE
|
|||
|
#endif
|
|||
|
#include <windows.h>
|
|||
|
|
|||
|
#include <stdio.h>
|
|||
|
#include "CWBOBJ.H"
|
|||
|
main(int argc, char *argv[ ], char *envp[ ])
|
|||
|
{
|
|||
|
cwbOBJ_ListHandle listHandle;
|
|||
|
cwbOBJ_ObjHandle splFHandle;
|
|||
|
unsigned int ulRC;
|
|||
|
unsigned long ulListSize, ulObjPosition, ulBytesNeeded;
|
|||
|
cwbOBJ_KeyID keysWanted[] = { CWBOBJ_KEY_SPOOLFILE,
|
|||
|
CWBOBJ_KEY_USER };
|
|||
|
unsigned long ulNumKeysWanted = sizeof(keysWanted)/sizeof(*keysWanted);
|
|||
|
char szSplFName[11];
|
|||
|
char szUser[11];
|
|||
|
|
|||
|
ulRC = cwbOBJ_CreateListHandle(_TEXT("ANYAS400"),
|
|||
|
CWBOBJ_LIST_SPLF,
|
|||
|
&listHandle,
|
|||
|
0);
|
|||
|
if (ulRC == CWB_OK)
|
|||
|
{
|
|||
|
|
|||
|
/* Set up the filter for the list to be opened with */
|
|||
|
/* NOTE: this is just for example, the user defaults */
|
|||
|
/* to *CURRENT, so this isn't really needed. */
|
|||
|
|
|||
|
cwbOBJ_SetListFilter(listHandle, CWBOBJ_KEY_USER,
|
|||
|
_TEXT("*CURRENT"), 0);
|
|||
|
|
|||
|
/* Optionally call to cwbOBJ_SetListAttrsToRetrieve to*/
|
|||
|
/* make walking the list faster */
|
|||
|
ulRC = cwbOBJ_SetListAttrsToRetrieve(listHandle,
|
|||
|
ulNumKeysWanted,
|
|||
|
keysWanted,
|
|||
|
0);
|
|||
|
|
|||
|
/* open the list - this will build the list of spooled*/
|
|||
|
/* files. */
|
|||
|
ulRC = cwbOBJ_OpenList(listHandle,
|
|||
|
CWBOBJ_LIST_OPEN_SYNCH,
|
|||
|
0);
|
|||
|
if (ulRC == CWB_OK)
|
|||
|
{
|
|||
|
/* Get the number of items that are in the list */
|
|||
|
ulRC = cwbOBJ_GetListSize(listHandle,
|
|||
|
&ulListSize,
|
|||
|
(cwbOBJ_List_Status *)0,
|
|||
|
0);
|
|||
|
if (ulRC == CWB_OK)
|
|||
|
{
|
|||
|
|
|||
|
/* walk through the list of items, displaying */
|
|||
|
/* each item to the user */
|
|||
|
|
|||
|
ulObjPosition = 0;
|
|||
|
while (ulObjPosition < ulListSize)
|
|||
|
{
|
|||
|
/*******************************************/
|
|||
|
/* Get a handle to the next spooled file in*/
|
|||
|
/* the list. This handle is valid while */
|
|||
|
/* the list is open. If you want to */
|
|||
|
/* maintain a handle to the spooled file */
|
|||
|
/* after the list is closed, you could call*/
|
|||
|
/* cwbOBJ_CopyObjHandle() after this call. */
|
|||
|
/*******************************************/
|
|||
|
ulRC = cwbOBJ_GetObjHandle(listHandle,
|
|||
|
ulObjPosition,
|
|||
|
&splFHandle,
|
|||
|
0);
|
|||
|
if (ulRC == CWB_OK)
|
|||
|
{
|
|||
|
|
|||
|
/****************************************/
|
|||
|
/* call cwbOBJ_GetObjAttr() to get info */
|
|||
|
/* about this spooled file. May also */
|
|||
|
/* call spooled file specific APIs */
|
|||
|
/* with this handle, such as */
|
|||
|
/* cwbOBJ_HoldSplF(). */
|
|||
|
/****************************************/
|
|||
|
|
|||
|
ulRC = cwbOBJ_GetObjAttr(splFHandle,
|
|||
|
CWBOBJ_KEY_SPOOLFILE,
|
|||
|
(void *)szSplFName,
|
|||
|
sizeof(szSplFName),
|
|||
|
&ulBytesNeeded,
|
|||
|
NULL,
|
|||
|
0);
|
|||
|
if (ulRC == CWB_OK)
|
|||
|
{
|
|||
|
ulRC = cwbOBJ_GetObjAttr(splFHandle,
|
|||
|
CWBOBJ_KEY_USER,
|
|||
|
(void *)szUser,
|
|||
|
sizeof(szUser),
|
|||
|
&ulBytesNeeded,
|
|||
|
NULL,
|
|||
|
0);
|
|||
|
if (ulRC == CWB_OK)
|
|||
|
{
|
|||
|
printf("%3u: %11s %s\n",
|
|||
|
ulObjPosition, szSplFName, szUser);
|
|||
|
} else {
|
|||
|
/* ERROR on GetObjAttr! */
|
|||
|
}
|
|||
|
} else {
|
|||
|
/* ERROR on GetObjAttr! */
|
|||
|
}
|
|||
|
/* free this object handle */
|
|||
|
cwbOBJ_DeleteObjHandle(splFHandle, 0);
|
|||
|
} else {
|
|||
|
/* ERROR on GetObjHandle! */
|
|||
|
}
|
|||
|
ulObjPosition++;
|
|||
|
}
|
|||
|
} else {
|
|||
|
/* ERROR on GetListSize! */
|
|||
|
}
|
|||
|
cwbOBJ_CloseList(listHandle, 0);
|
|||
|
} else {
|
|||
|
/* ERROR on OpenList! */
|
|||
|
}
|
|||
|
|
|||
|
cwbOBJ_DeleteListHandle(listHandle, 0);
|
|||
|
}</pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div>
|
|||
|
<div class="familylinks">
|
|||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzaikappobj.htm" title="iSeries Objects for iSeries Access for Windows application programming interfaces (APIs) allow you to work with iSeries print-related objects. These APIs make it possible to work with iSeries spooled files, writer jobs, output queues, printers, and more.">iSeries Objects APIs for iSeries Access for Windows</a></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</body>
|
|||
|
</html>
|