Posted: Sun Dec 08, 2002 2:18 am Post subject: Delay of less than a second
Hi,
The CICS Delay function does not support a DELAY INTERVAL of less than a second. I have a requirement in one of the application programs to put in a delay interval of 0.5 seconds. Can I do this using the CICS DELAY function ? Please let me know if I can do it by using any other function.
Joined: 26 Nov 2002 Posts: 12406 Topics: 75 Location: San Jose
Posted: Sun Dec 08, 2002 3:34 am Post subject:
abhayasahoo,
A delay of 0.5 secs?? I wonder what is the requirement for such tiny interval. Even if you are able to incorporate somehow(I can't think of any options) , how are you going to know ??. Half a second is much quicker than a blink of an eye. Do you really need such tiny interval??
Please explain your "need" for such tiny delay and may be someone can shed light on it
We are having a CICS-DB2 program where we try to fetch a record INSERTed by another application which happens simulataneously. But for some cases, there is a slight delay in putting the record. When you put a DELAY of 1 second, it is basically slowing down the application. When we don't put a DELAY, we get an SQLCODE +100 (Record not found).
Most of the time (more than 95 %), the application puts records at the right time. However, in some cases there is a slight delay (less than a second). Hence we put the DELAY of 1 second. Since it is an Interactive Voice Response (IVR) system, a DELAY of 1 second is significant. We would like to put a DELAY of say 0.2 or 0.3 seconds if CICS functions support that.
Joined: 02 Dec 2002 Posts: 706 Topics: 65 Location: MD, USA
Posted: Mon Dec 09, 2002 5:24 am Post subject:
Let me get your question/problem:
1 What I understand is that while inserting a record, say RECORDA, in INSERT program, sometimes the insert command is taking time and if you do fetch RECORDA during that interval through your FETCH program then you are in trouble.
2 But if you fetch RECORDA after completion of insert command then you won't have problem.
3 So you will wan't to wait till insert command is over.
If answer to 1-3 are yes then -
In INSERT program - Enqueue RECORDA (which will vary for diffrent records) with NOQUEUE option before insert and DEQUEUE after insert. This will tell the CICS that RECORDA is being inserted.
In FETCH program - Enq RECORDA without NOQUEUE option before fetch and Deq after fetch. This will make FETCH program wait till insert is over.
This will be faster than fixed delay as it will delay only for required interval.
Kolusu: Why 5 sec?
I once neeed such small interval when we were trying to synchronize about 50 thousand transactions at one go. So every fraction of interval saved mattered a lot.
Joined: 29 Nov 2002 Posts: 382 Topics: 27 Location: Chennai, India
Posted: Mon Dec 09, 2002 6:36 am Post subject:
Hi Dibakar,
Can you please give me the syntax of doing a ENQ and DEQ on a record while inserting it or reading it to and from a DB2 database. Let us not consider CURSORS but singleton INSERT and SELECT statement.
Till now, I have only done ENQ on TSQs and TDQs.
Joined: 02 Dec 2002 Posts: 706 Topics: 65 Location: MD, USA
Posted: Mon Dec 09, 2002 8:20 am Post subject:
Manas,
As far as my understanding of ENQ goes, you don't ENQ a TSQ, TDQ etc but just a name. Now its upto you how to use this information in your program. So same syntax will work only that the name you would like to change, otherwise you will be passing false information. I don't know DB2 but I guess you will like to ENQ ws-record-identifier in both programs as follows
Joined: 29 Nov 2002 Posts: 382 Topics: 27 Location: Chennai, India
Posted: Mon Dec 09, 2002 9:28 am Post subject:
Ok Dibakar,
Now I understand what you mean. But you can do ENQ on a resource and not on a WS record. Now, when the insert has not yet been done on the table, how can you ENQ it. The data is still present in the WS. How can you ENQ that?. Your approach suggests that before doing the insert, you ENQ the row in the table but before the insert there is no row that exists. How can you ENQ something which is not there in the tabe. You probably cannot ENQ something which is still there in the WS.
For the approach that you are suggesting, you have to do an ENQ on the whole table simply for the fact that you don't know where you are going to insert the new record. And to ENQ a whole table is not a good idea.
Joined: 02 Dec 2002 Posts: 20 Topics: 0 Location: Yorkshire, England
Posted: Mon Dec 09, 2002 10:43 am Post subject:
I don't think you can delay for less than 1 second.
What about just attempting the read, and if a code 100 is returned then trying again (allow 1 re-read, 5 re-reads, or whatever you feel is necessary). _________________ Cheers - Mike
Joined: 02 Dec 2002 Posts: 706 Topics: 65 Location: MD, USA
Posted: Tue Dec 10, 2002 1:57 am Post subject:
Hi Manas,
You are getting idea of ENQ totally wrong. You can ENQ anything, whether it exist or not because ENQ command will only ENQ a name, not any corresponding physical file or anything. So the solution provided will still work even if you have the record or not. It is for programmer to interpret the ENQ information that something is being done to the record. ENQ command itself will not place any restriction on accesiing the table or record or TSQ etc. It will only reserve the name. So if some other program wants to directly access the record without using ENQ command then CICS will not prohibit it from doing so.
Try the solution suggested, it will work. I had similar doubts earlier but once you test it the concept will be clearer.
I think when CICS mannual talks about RESOURCE with ENQ command people get confused. But if you replace the word by SOMETHING it will be easier to understand.
Joined: 29 Nov 2002 Posts: 382 Topics: 27 Location: Chennai, India
Posted: Tue Dec 10, 2002 3:05 am Post subject:
Hi Dibakar,
Please excuse me for being persistent but I am still not able to comprehend how ENQ will work in this case. In one program you have a set of WS variables which contain the record to be inserted. Something like the following -
The above mentioned WS in one program contains the data for the record to be inserted. You code a SQL like the following to insert the data to a table
Code:
EXEC SQL
INSERT INTO TABT1
(ID,NAME,TELNO)
VALUES
(:ws-id,:ws-name,:ws-tel-no)
END-EXEC.
The above code will insert the record into the table.
Now, at the same time another program is trying to select the same record.
Code:
EXEC SQL
SELECT ID,NAME,TELNO FROM TABT1
INTO :ws-id-pgm2,:ws-name-pgm2,:ws-telno-pgm2
WHERE ID=:ws-id-pgm2
END-EXEC.
Please note here that in the 2nd program the name of the WS variable that we are using in the WHERE clause is different from the name of the WS variable (ws-name) that was there in the first program which is inserting the record.(Although the data contained in both ws-id and ws-id-pgm2 is the same).
Now, how do you propose that we do the ENQ. In program 1, we need to a do a ENQ on the record before it is inserted into the table. And in Program 2 we again need to do a ENQ on a record which is not present in the table but in the WS of program 1.
Can you please provide me with the exact syntax of the ENQ/DEQ commands in this case considering the above mentioned WS and Table definitions.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum