I have used ENQ and DEQ commands in an CICS environment and I can understand the concept from the below definitions, how the ENQ/DEQ command works
"The resource to be enqueued on must be identified by one of the following methods:
Specifying a data area that is the resource. It is the location (address) of the data area in storage that matters, not its contents.
Specifying a data area that contains a unique argument (for example, an employee name) that represents the resource. It is the contents of the data value that matters, not its location. LENGTH is required; the presence of the LENGTH option tells CICS to enqueue on the contents of the data value."
but I am trying to achieve an ENQ/DEQ sysplex-wide or we can say I am trying to achieve serialized access on the same resource from different CICS environments. From below information I can understand that there is a concept of ENQMODEL for the same
However I am not able to find any example for the same.
Below information I gathered while searching:-
When an EXEC CICS ENQ (or DEQ) command is issued for a resource whose name matches that of an installed ENQMODEL resource definition, CICS checks the value of the ENQSCOPE attribute to determine whether the scope is local or sysplex-wide. If the ENQSCOPE attribute is left blank (the default value), CICS treats the ENQ as local to the issuing CICS region. If no ENQMODEL matches the resource name, the scope of the ENQ command is local. See the CICS Resource Definition Guide for more information about the ENQMODEL resource definition.
Also can you please help me understand the above concept.
1 "When an EXEC CICS ENQ (or DEQ) command is issued for a resource whose name matches that of an installed ENQMODEL resource definition"
Does this mean that the resource name was pre-supplied while installing the ENQMODEL ? and before that I am confused on what installed ENQMODEL stands here for ?
2. ENQSCOPE is by default left black and provided some value (which I am assuming as of any name for example A) which can be provided while issuing an enque command. Please correct me as I am not sure on this.
3. I also read on the concept of GRS but I am not clear on the same as well.
Joined: 06 Jun 2008 Posts: 8280 Location: Dubuque, Iowa, USA
ENQMODEL is defined and installed through RDO (the CEDA transaction). If you want to use a SYSPLEX ENQMODEL, you MUST define the ENQMODEL with a non-blank ENQSCOPE. You do not have an option to do this at run time. And this definition must exist in EACH region you want to control the ENQ for. If you do not have access to the CEDA transaction, you must work with your site support group CICS system programmer to do the definition and installation. The manual does not list any restrictions on the ENQSCOPE name (other than length).
When you use EXEC CICS ENQ, you provide the ENQMODEL name (that was defined by the CEDA transaction) in the RESOURCE name if you want the scope to be SYSPLEX instead of LOCAL. From the RDO manual:
Combined with an ENQMODEL resource, CICS® uses MVS™ global resource serialization to provide sysplex-wide protection of application resources.
Local enqueues within a single CICS region are managed within the CICS address space. Sysplex-wide enqueues that affect more than one CICS region are managed by GRS.
The ENQSCOPE attribute of an ENQMODEL resource, defines the set of regions that share the same enqueue scope. If the ENQSCOPE attribute is left blank (the default value), CICS treats any matching ENQ or DEQ as local to the issuing CICS region. If the ENQSCOPE is non-blank, CICS treats the ENQ or DEQ as sysplex-wide and passes a queue name and the resource name to GRS to manage the enqueue.
The CICS regions that need to use sysplex-wide enqueue or dequeue function must all have the required ENQMODELs defined and installed. The recommended way to ensure this is for the CICS regions to share a CSD, and for the initialization group lists to include the same ENQMODEL groups.
GRS (global resource serialization) is the z/OS mechanism for providing controlled access to resources that cannot be shared (serialization). It can be very complex and there are manuals and Redbooks that you can consult for more information. If you are doing ENQ / DEQ in CICS, you need to spend some time reading up on GRS to understand at least at a high level what GRS does.
Joined: 06 Jun 2008 Posts: 8280 Location: Dubuque, Iowa, USA
You REALLY need to spend a LOT of time reading manuals. From the CICS TS 5.1 RDO manual:
ENQMODEL(name)specifies the name of this ENQMODEL definition. The name can be up to eight characters in length.
So unless your record key is 8 bytes or less, you CANNOT use it as the ENQMODEL name. The ENQMODEL name is arbitrary but must be the same in each CICS region that shares the enqueue. The resource name is allowed to be up to 255 bytes but GRS limits it to 44 bytes so don't use more than 44 bytes in your ENQMODEL definition. ENQSCOPE is again any arbitrary 4-byte value; if it is not spaces then CICS passes GRS the name DFHE???? (where ???? is your 4-byte ENQSCOPE) and the resource name defined by ENQNAME in the ENQMODEL definition.
If I am trying serialize access to a particular record from a VSAM file
The ONLY way to achieve this is through RLS (record level sharing); in general an ENQ will be serialized at the cluster level.
Why are you not talking to your site support group? Very few, if any, sites allow an application programmer to use the CEDA transaction to define resources. CEDA is generally done by the site support group, so your asking all sorts of questions about it on a forum won't really help you that much.
"The ENQMODEL name is arbitrarybut must be the same in each CICS region that shares the enqueue. The resource name is allowed to be up to 255 bytes but GRS limits it to 44 bytes so don't use more than 44 bytes in your ENQMODEL definition. ENQSCOPE is again any arbitrary 4-byte value"
Yes we do have site support group which performs this activity. But I wanted to understand the concept, which I am able to now.
As we have same name defined using RDO entries and issuing an ENQ for the same name this will eventually help in serialization.