View previous topic :: View next topic
|
Author |
Message |
senthils
Active User
Joined: 15 Nov 2005 Posts: 117 Location: Chennai, India
|
|
|
|
Hi,
I want to know the exact use of INTERVAL parameter used in START TRANSID command.
My requirement is for a transaction to be triggered at regular time interval.
So to start transaction 'AAAA' every 2 minutes if i give the following command will it suffice?
Code: |
EXEC CICS START
INTERVAL (000200)
TRANSID ('AAAA')
FROM (DFHCOMMAREA)
LENGTH (LENGTH OF DFHCOMMAREA)
END-EXEC |
|
|
Back to top |
|
|
Prasanthhere
Active User
Joined: 03 Aug 2005 Posts: 306
|
|
Back to top |
|
|
senthils
Active User
Joined: 15 Nov 2005 Posts: 117 Location: Chennai, India
|
|
|
|
Thanks for the link Prasanth.
According to the info from the link I can say,
INTERVAL basically says how much time which must elapse before the transaction is started. But it wont repeatedly start the transaction after that.
Is the above statement correct? |
|
Back to top |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
If you want to write a program, you can use the below psuedo code.
Code: |
01 sleep-time pic 999.
01 begin-time pic 9(06) value zeroes.
01 filler redefines begin-time.
05 begin-hours pic 99.
05 begin-minutes pic 99.
05 begin-seconds pic 99.
01 end-time pic 9(06) value zeroes.
01 filler redefines end-time.
05 end-hours pic 99.
05 end-minutes pic 99.
05 end-seconds pic 99.
01 elapsed-time pic 9(6).
procedure division.
ctr = 0.
read indicator.
perform sleep-it until cntr = 5 or indicator = 'y'.
IF IND = 'Y'
RUN PROGRAMME
ELSE
stop run
end-if.
sleep-it.
accept begin-time from time
move 0 to elapsed-time
sleep-time = 120
perform until elapsed-time >= sleep-time
accept end-time from time
compute elapsed-time rounded =
( end-hours - begin-hours ) * 3600
+ ( end-minutes - begin-minutes ) * 60
+ ( end-seconds - begin-seconds )
end-perform.
add 1 to cntr.
read indicator.
|
If you want to use CICS command, you can try with the following format.
Code: |
IF YES--STRT-ABCD
EXEC CICS START
TRANSID ('ABCD')
INTERVAL (0030)
END-EXEC
END-IF
|
Declare the flag in 88 level and assign the flag value depending on condition or as many times as you want, depending on your requirement. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
instead of a cpu wasting perform (rookie garbage), suggest you use the CICS DELAY API command. |
|
Back to top |
|
|
senthils
Active User
Joined: 15 Nov 2005 Posts: 117 Location: Chennai, India
|
|
|
|
Thanks for all your replies. I think got what I needed. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
The INTERVAL START only runs once; if you want to repeated trigger a transaction every 2 minutes you need each transaction to do an INTERVAL START on the next one. I've done several of these so if you have more questions please post them. |
|
Back to top |
|
|
senthils
Active User
Joined: 15 Nov 2005 Posts: 117 Location: Chennai, India
|
|
|
|
Thanks Robert. I came up with the same logic and it is working now. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If no one objects (and maybe even if they do), i plan on deleting the cpu-wasting code to "kill time" for some interval.
None of the systems i've ever supported would allow this in a cics region (or batch application for that matter).
I would suggest that a far better approach is the one Robert posted. Easy to understand, easy to maintain, and easy on the system resources |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
To make it a very solid design, use two transactions, both interval-controlled, and a record in a VSAM file. The VSAM record has the timestamp for the last start for each transaction. The first transaction when started reads the VSAM record for update, verifies that the other transaction has a timestamp within the specified interval (determined by you -- probably should be 1.5 to 2 times the interval being used), updates its timestamp, rewrites the record, and does an interval start on itself. The second transaction when started reads the VSAM record for update, verifies that the first transaction has a timestamp within the specified interval, updates its timestamp, rewrites the record, does what work it needs to, and then does an interval start on itself. As long as you don't hit MAXTASK, this design is pretty much fool-proof. It also allows for extensions, such as a flag in the record to shut down the transactions (which can be set by CECI even). |
|
Back to top |
|
|
|