Print Page as PDF
LOCK MANAGER APIs ICR (5832)

LOCK MANAGER APIs    ICR (5832)

Name Value
NUMBER 5832
IA # 5832
DATE CREATED 2012/08/14
CUSTODIAL PACKAGE KERNEL
USAGE Supported
TYPE Routine
DBIC APPROVAL STATUS APPROVED
ROUTINE XULMU
NAME LOCK MANAGER APIs
STATUS Active
DURATION Till Otherwise Agreed
ID XULMU
COMPONENT/ENTRY POINT
COMPONENT/ENTRY POINT COMPONENT DESCRIPTION VARIABLES
SETCLEAN
Description:  The purpose of this API is to register
a cleanup
routine that should be executed when the process is terminated
by the Kernel Lock Manager.  An entry is created on a stack kept
for the process.  The location is ^XTMP("XULM CLEANUP_"_$J) where
$J uniquely identifies the process.  A process may call
SETCLEAN^XULMU repeatedly, and each time a new entry is placed on
the stack.

*Important*: Once an application calls SETCLEAN, upon exiting it must
either execute its housecleaning stack or delete it, using
the APIs CLEAN or UNCLEAN.


Example:  Suppose the application has a cleanup routine
CLEANUP^XXAPP, and it needs to be executed with DFN defined
with its present valued.  The application would use this API
as follows:
N VAR,CLEANUP
S VAR("DFN")=DFN
S CLEANUP=$$SETCLEAN^XULMU("CLEANUP^XXAPP",.VAR)

The application's housekeeping stack would look like this:

^XTMP("XULM CLEANUP",$J,1,"ROUTINE")="CLEANUP^XXAPP"
^XTMP("XULM CLEANUP",$J,1,"VARIABLES","DFN")=1000061
VARIABLES TYPE VARIABLES DESCRIPTION
RTN Input
The routine to be executed when the process is
terminated.

VAR Input
A list of variables that should be defined when the
routine is executed.  It is up to the application to insure that all the
required variables are defined.

FUNCTION VALUE Output
An integer is returned that identifies the entry
created on the stack.

UNCLEAN
Description - this removes entries from the
housecleaning stack set by
calling SETCLEAN^XULMU. Entries are removed in FIFO order.  If LAST is
not passed in, then the entire stack is deleted, otherwise just the
entries back to LAST are removed.

Example: This would remove the entire housecleaning stack:

DO UNCLEAN^XULMU

Example: If an application is called by another application, then the
the first application may have already placed entries of its
own on the stack.   So the parameter LAST needs to be passed,
with LAST being the first entry placed on the stack.  It will
be the last entry deleted, since that stack is executed in
FIFO order.


DO UNCLEAN^XULMU(LAST)
VARIABLES TYPE VARIABLES DESCRIPTION
LAST Input
Identifies the last entry on the housekeeping stack
to remove.  Entries are removed in FIFO order, so the first entry removed is
the last entry that was added, and the last entry removed is LAST. If not
passed in, the entire housecleaning stack is deleted.
CLEANUP
Description:  This API will execute the housecleaning
stack set by the
process identified by DOLLARJ. Entries are executed in the FIFO order,
with the last entry added being the first to be executed, and LAST
being the last entry executed. If LAST is not passed in,
then the entire stack is executed.


Example:  An application may execute the entire housecleaning stack
with the following code:

DO CLEANUP^XULMU

Example:  If an application is called by another application, then the
the first application may have already placed entries of its
own on the stack.   So the parameter LAST needs to be passed,
with LAST being the first entry placed on the stack.  It will
be the last entry executed, since that stack is executed in
FIFO order.

DO CLEANUP^XULM(LAST)




VARIABLES TYPE VARIABLES DESCRIPTION
XULAST Input
(optional) This is the last entry that will be
executed.  If not passed in, then the entire housecleaning stack is executed.

PAT
Description: This is for use within the MUMPS code
for a computable file reference to the PATIENT file (#2).  It returns a
standard set of patient identifiers.



Example of Use: Assuming that DFN is a variable defined within the lock
template, then the MUMPS code for a computable file reference to the Patient
file (#2) would consist of the following:

DO PAT^XULMU(DFN)




VARIABLES TYPE VARIABLES DESCRIPTION
DFN Input
the IEN of a record in the PATIENT file (#2)

ID Output
Returns the following:
ID("IEN")=DFN
ID(0)=4
ID(1)=<patient name>
ID(2)=<patient sex>
ID(3)=<patient date of birth>
ID(4)=<patient Social Security Number>

ADDPAT
Description: This API is very similar to PAT^XULMU,
except that it is used to add the patient identifiers for a computable file
reference for a file that is not the PATIENT file (#2).  The computable file
references may include additional identifiers.  For example, a computable file
reference for a billing file may contain the bill number as an identifier as
well as the patient identifiers returned by ADDPAT^XULMU.
VARIABLES TYPE VARIABLES DESCRIPTION
DFN Input
the IEN of a record in the PATIENT file (#2)

ID Output
ID(0) - If not defined at the point ADDPAT^XULMU is
called, it will be initially set to 0.  When ADDPAT^XULMU returns, ID(0) will
have been incremented by 4.

ID(ID(0)+1)=<patient name>
ID(ID(0)+2)=<patient sex>
ID(ID(0)+3)=<patient date of birth>
ID(ID(0)+4)=<patient Social Security Number>

DATE ACTIVATED 2012/09/10