View previous topic :: View next topic
|
Author |
Message |
akodakka
New User
Joined: 20 May 2010 Posts: 75 Location: India
|
|
|
|
Hi All
I have checked manuals and previous to get the answer but didn't clear still.
Regarding the resource that we mention in ENQ. As per my understanding the RESOURCE in an ENQ can be a VSAM file , a storage , etc.
The resource that is 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 is important, not its contents. Two tasks, enqueuing on the same resource and using this method, must refer to the same location in storage. They could both, for example, refer to the same location in the Common Work Area (CWA).
EXEC CICS ENQ
RESOURCE(RESNAME)
Specifying a data area that contains a unique character string argument (for example, an employee name) that represents the resource. It is the contents of the data area that is important, not its location. Two tasks, enqueuing on the same resource and using this method, can refer to the same location or different locations, but the contents of the locations must be the same. The length must be supplied in the LENGTH option and can be up to 255 bytes long.
EXEC CICS ENQ
RESOURCE(SOCSECNO)
LENGTH(8)
here my query is ENQ a data area which contains a character string. I have program where i ENQ a resource like
01 WS-RESOURCE PIC X 10 VALUE 'ABCDEFG'
and in my program i am ENQ uing the same
EXEC CICS ENQ
RESOURCE (WS-RESOURCE)
LENGTH(LENGTH OF WS-RESOURCE)
END-EXEC
What will be the relevance of ENQ uing a data string here.? Any thoughts? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
From the description of ENQ in the CICS Application Programming Reference manual, 1.75, with emphasis added by me:
Quote: |
ENQ causes further execution of the task issuing the ENQ command to be synchronized with the availability of the specified resource; control is returned to the task when the resource is available.
A resource in the context of this command is any string of 1-255 bytes, established by in-house standards, to protect against conflicting actions between tasks, or to cause single threading within a program. |
I suspect you mis-understand the resource in the ENQ command: if it is a VSAM file name, it does NOT represent the actual VSAM file that CICS has defined -- it is an 8-byte variable that happens to be the same bytes used by CICS to reference a file. |
|
Back to top |
|
|
Peter cobolskolan
Active User
Joined: 06 Feb 2012 Posts: 104 Location: Sweden
|
|
|
|
Normally you dont have use END/DEQ. The END/DEQ can be used when you want to ensure "something" isnt referenced/changed by more than one task at a time e.g. values in CWA, as the CWA is not a "protected resource" in CICS. For files etc the "protection" is handled by CICS without any special programming. This is one of the objectives of a "Transation Processing" system. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Why does someone believe you need to implement your own enque? |
|
Back to top |
|
|
akodakka
New User
Joined: 20 May 2010 Posts: 75 Location: India
|
|
|
|
Hi all,
Thanks everyone..yes i missed the context highlighted by Robert.
I was doing some research on the CICS API commands by digging through the programs that has been using in my shop.Thanks again..really helped me to understand the ENQ.
I hope i will be able to answer these type of questions in near future:) |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
If you do need to use an ENQ/DEQ Resource, it would be in your best interest to define the resource-name, using a combination of upper/lower case letters, numeric values, along with special characters in an attempt to make it as unique as possible. EG:
'$@My-Resource-Name-001@$'
Doing this will reduce other creative minds in your shop from duplicating the name.
One last thought; Once you're done with accessing the resource and you're not at task termination, issue a DEQ. |
|
Back to top |
|
|
|