Chapter Contents

Previous

Next
ENQ

ENQ



Wait for a Resource to Become Available

Portability: SAS/C extension


SYNOPSIS
DESCRIPTION
RETURN VALUE
EXAMPLE
RELATED FUNCTIONS


SYNOPSIS

#include <ostask.h>

int ENQ(char *qname, char *rname, excl, int rlen, scope, ret);


DESCRIPTION

The SAS/C ENQ macro implements the functionality of the OS/390 Assembler ENQ macro. The qname argument specifies the queue name and resource name and must be eight or more characters in length; only the first eight characters are used. The rname argument specifies the resource name. Both the qname and rname are passed to the ENQ SVC as is; that is, the library does not pad or translate the strings in any way.

The excl argument specifies whether this is an exclusive or shared request and must be specified as either E or S. The rlen argument specifies the length of rname . The scope argument specifies whether the scope of the name is the job step, the current system, or all systems in a complex. It must be specified as one of the keywords STEP, SYSTEM, or SYSTEMS. The ret argument specifies the same information as the assembler RET keyword and must be NONE, HAVE, CHNG, USE or TEST.


RETURN VALUE

The SAS/C ENQ macro returns the same value as the return code from the assembler ENQ macro.


EXAMPLE

Use the ENQ function to obtain shared control of the resource with qname MYQN and rname FRED.ACCTS.DATA. RET=HAVE is used to prevent ABEND if the resource is unavailable.

static char rname [] = "FRED.ACCTS.DATA";
int rc;

rc = ENQ("MYQN    ", rname, S, sizeof(rname)-1, SYSTEM, HAVE);
if (rc != 0)
   printf("ENQ failed!\n");
else {
   process();     /* utilize the resource */
   DEQ("MYQN    ", rname, sizeof(rname)-1, SYSTEM, NONE);
}


RELATED FUNCTIONS

DEQ


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.