Purpose
Opens an AFP™ Resource object for reading for a spooled
file that is already opened for reading. The API is useful if you are reading
an AFP Spooled
file and run into an external AFP Resource that you need to read. By using
this API you can open that resource for reading without having to first list
the resource.
Syntax
unsigned int CWB_ENTRY cwbOBJ_OpenResourceForSplF(
cwbOBJ_ObjHandle splFHandle,
const char *resourceName,
const char *resourceLibrary,
unsigned long resourceType,
const char *reserved,
cwbOBJ_ObjHandle *resourceHandle,
cwbSV_ErrHandle errorHandle);
Parameters
- cwbOBJ_ObjHandle splFHandle - input
- Handle of the spooled file that is already opened for reading and that
the resource will be opened against. The same conversation (and same instance
of the network print server program on the iSeries™ server) will be used for reading
the resource and spooled file.
- const char *resourceName - input
- Pointer to the name of the AFP Resource in an ASCIIZ string.
- const char *resourceLibrary - input
- Optional, may be NULL. Pointer to the iSeries library of the AFP Resource in
an ASCIIZ string. If no library is specified, the library list of the spooled
file is used to search for the resource.
- unsigned long resourceType - input
- An unsigned long integer with one of the following bits on:
- CWBOBJ_AFPRSC_FONT
- CWBOBJ_AFPRSC_FORMDEF
- CWBOBJ_AFPRSC_OVERLAY
- CWBOBJ_AFPRSC_PAGESEG
- CWBOBJ_AFPRSC_PAGEDEF
Specifies what type of resource to open.
- const char *reserved -
- Reserved, must be NULL.
- cwbOBJ_OBJHandle *resourceHandle - output
- Pointer to an OBJHandle that on successful return will contain the dynamically
allocated resource handle that can be used to read, seek and eventually close
the resource.
- cwbSV_ErrHandle errorHandle - output
- Optional, may be 0. Any returned messages will be written to this object.
It is created with the cwbSV_CreateErrHandle() API. The
messages may be retrieved through the cwbSV_GetErrText() API.
If the parameter is set to zero, no messages will be retrievable.
Return Codes
The following list shows common return
values.
- CWB_NO_ERROR
- Successful completion.
- CWB_FILE_NOT_FOUND
- The resource wasn't found.
- CWB_NOT_ENOUGH_MEMORY
- Insufficient memory; may have failed to allocate temporary buffer.
- CWB_INVALID_HANDLE
- Handle is not valid resource handle.
- CWB_INVALID_PARAMETER
- Invalid parameter specified.
- CWBOBJ_RC_HOST_ERROR
- Host error occurred. Text may be in errorHandle.
- CWBOBJ_RC_SPLFNOTOPEN
- The spooled file is not opened.
- CWBOBJ_RC_NOHOSTSUPPORT
- Host doesn't support working with resources.
- CWB_NON_REPRESENTABLE_UNICODE_CHAR
- One or more input Unicode characters have no representation in the code
page being used.
- CWB_API_ERROR
- General API failure.
Usage
This call, if successful, will generate a
temporary resource handle and return it in the resourceHandle parameter.
This handle will be deleted automatically when the caller calls the cwbOBJ_CloseResource() API
with it.
The resource should be closed with the cwbOBJ_CloseResource())
API when done reading from it.