IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

ENQ use in CICS


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
akodakka

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Fri Nov 30, 2012 9:26 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Fri Nov 30, 2012 9:39 pm
Reply with quote

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
View user's profile Send private message
Peter cobolskolan

Active User


Joined: 06 Feb 2012
Posts: 104
Location: Sweden

PostPosted: Fri Nov 30, 2012 11:19 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Dec 01, 2012 12:40 am
Reply with quote

Hello,

Why does someone believe you need to implement your own enque?
Back to top
View user's profile Send private message
akodakka

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Sat Dec 01, 2012 2:31 am
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Sat Dec 01, 2012 2:45 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts Calling an Open C library function in... CICS 1
No new posts How to 'Ping' a CICS region in JCL CICS 2
No new posts Parallelization in CICS to reduce res... CICS 4
No new posts How to avoid duplicating a CICS Web S... CICS 0
Search our Forums:

Back to Top