![]() Chapter Contents |
![]() Previous |
![]() Next |
| osgttok |
| Portability: | SASC |
| SYNOPSIS | |
| DESCRIPTION | |
| RETURN VALUE | |
| IMPLEMENTATION | |
| EXAMPLE | |
| RELATED FUNCTIONS |
| SYNOPSIS |
#include <osnamtok.h> int osgttok(char _ _near *name, char _ _near *token);
| DESCRIPTION |
The osgttok function uses
a name (up to 16 characters) to retrieve a token
(16 bytes binary) using the IEANTRT service.
Although IEANTRT 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 IEANTRT 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 cannot create a name beginning with the null character.)
The token parameter should be the address of an array of 16 bytes. This array
will be overlaid by the call to osgttok with the token retrieved. The level
of the name/token will be 2 (home).
| RETURN VALUE |
osgttok returns either
-1 if the service cannot be called or the return value from the service.
| IMPLEMENTATION |
The osgttok function is
implemented by the source module L$UNMTK.
| EXAMPLE |
This SPE example retrieves the address of storage that had previously been allocated in another task and then frees it.
#include <osnametok.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 = osgttok(name, token)) != 0)
{
WTP("osgttok failed.");
return;
}
memcpy(&pGlobal, token, 4); // only the first 4 bytes of
// the token are used.
if (strcmp(pGlobal->eye, "Z Global EYE")
{
WTP("Global storage corrupt.");
return;
}
// now delete the token
if ((rc = osdltok(name)) != 0)
{
WTP("osdltok failed.");
return;
}
// and free the common storage
FREEMAIN(pGlobal, sizeof(GLOBAL), 131, UNCOND);
}
| RELATED FUNCTIONS |
ossttok, osdltok
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 2004 by SAS Institute Inc., Cary, NC, USA. All rights reserved.