Jump to page titleUNITED STATES
hp.com home products and services support and drivers solutions how to buy
» contact hp

:

more options
 

hp.com home
End of Jump to page title
Example-PLI How To Request A Lock On a Resource Name
Jump to content



» 

business support center

Home & Home Office Support:
» HP branded products
» Presario branded products
» Services & Warranties
Small & Medium Business Support:
» Small & Medium Business products
» Small & Medium Business services
Support for IT Professionals:
» Enterprise products (IT Resource Center)
» NonStop enterprise products
» Business & IT Services
Content starts here
Copyright (c) Digital Equipment Corporation 1988. All rights reserved
LAYERED PRODUCT or COMPONENT: PLI, VERSION 3.1     OP/SYS: VMS, VERSION 5.0

SOURCE:     Digital Customer Support Center


OVERVIEW:

This program shows how to call SYS$ENQW to request a lock on a
resource name.  SYS$DEQ is then called to release the lock on the resource.


CAUTION:  This sample program has been tested using:
PRODUCT: PLI, VERSION 3.1 on OPERATING SYSTEM: VMS, VERSION 5.0
However, we cannot guarantee its effectiveness because of the possibility of
errors in transmitting or implementing it.  It is meant to be used as a
template for writing your own program, and it may require modification for use
on your system.


PROGRAM SAMPLE:

enqdeq: proc options(main);

%include SYS$ENQ;
%include SYS$DEQ;
%include $STSDEF;
%include $LCKDEF;

dcl 1 statblk,
      2 lock_status fixed bin(31),
      2 lock_id     fixed bin(31);
/*  The lock status block may optionally contain an extension of 16 bytes
    called the 'lock value block' whose contents are user defined.
    This could be used as a method of communicating between processes.
    See System Service Ref. Manual (SSRM) for more details. */

dcl share_item char(8) init('DATABASE');

Put skip list('Enqueueing the lock...');

sts$value = sys$enqw(,
    lck$k_prmode,   /* lkmode - lock mode. prmode is 'protected read' */
                    /*    caller and others have only read access to the */
                    /*    named resource.  write access is denied to all. */
                    /*    This is the traditional 'share lock'. */
    statblk,        /* lksb - lock status block. see comment above. */
    ,               /* flags - ref SSRM doc for usage.  not needed here */
    share_item,     /* resnam - whatever Resource Name desired. */
    ,,,,,);

IF ^sts$success
    then do;
         put skip list('Problems with ENQW');
         signal vaxcondition(sts$value);
    end;

put skip list('Lock has been granted');

sts$value = sys$deq(lock_id,,,);

IF ^sts$success
    then do;
         put skip list('Problems with deq');
         signal vaxcondition(sts$value);
    end;

put skip list('Lock has been dequeued');
end enqdeq;




buy online or call 1.800.AT.COMPAQ
privacy statementusing this site means you accept its terms