Chapter Contents |
Previous |
Next |
ossttok |
Portability: | SASC |
SYNOPSIS | |
DESCRIPTION | |
RETURN VALUE | |
IMPLEMENTATION | |
EXAMPLE | |
RELATED FUNCTIONS |
SYNOPSIS |
#include <osnamtok.h> int ossttok(char __near *name, char __near *token);
DESCRIPTION |
The ossttok
function associates
a name (up to 16 characters) with a token (16 bytes binary) using the IEANTCR
service. Although IEANTCR
can be called in assembler with the bytes of the name consisting of any value,
this function expects the name to be a null-terminated character string. The
actual name passed to the IEANTCR
service will
consist of the character string truncated to 16 bytes, or padded with blanks.
IBM has reserved names starting with the letters A through I (uppercase) and
the null character (even though this function can not create a name beginning
with the null character.) The token parameter should be the address of an
array of 16 bytes. The level of the name/token will be 2 (home) and the persistence
will be 0 (IEANT_NOPERSIST).
RETURN VALUE |
ossttok
returns either
-1 if the service cannot be called or the return value from the service.
IMPLEMENTATION |
The ossttok
function is
implemented by the source module L$UNMTK
.
EXAMPLE |
This SPE example gets some memory from subpool 131
and creates a name/token pair for use in other
tasks accessing the memory.
#include <osnamtok.h> #include <getmain.h> #include <oswto.h> char *name = "Z Global"; typedef struct { char eye[16]; // eyecatcher long long lock; // lockword char *data; // data chain } GLOBAL, *PGLOBAL; void osmain() { PGLOBAL pGlobal; char token[16]; int rc; if ((rc = GETMAIN_U(sizeof(GLOBAL), 131, LOC_ANY, &pGlobal)) != 0) { WTP("Getmain error."); return; } memset(pGlobal, 0, sizeof(GLOBAL); strcpy(pGlobal->eye, "Z Global EYE"); memset(token, 0, 16); memcpy(token, &pGlobal, 4); // copy address as token // remaining 12 bytes of token // are currently unused. if ((rc = ossttok(name, token)) != 0) { WTP("ossttok failed."); return; } }
RELATED FUNCTIONS |
osgttok
, osdltok
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2004 by SAS Institute Inc., Cary, NC, USA. All rights reserved.