Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need Logic to calculate specific timestmap difference
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
pdighade

New User


Joined: 21 Jul 2008
Posts: 40
Location: pune

PostPosted: Mon Mar 29, 2010 9:52 pm    Post subject: Need Logic to calculate specific timestmap difference
Reply with quote

I have transactions in file as below

transid intime outime trantype
t1 22.23.12.9 22.23.14.4 pay1
t2 22.23.20.5 22.23.23.8 pay1
t3 23.24.12.6 22.25.13.7 pay1
t4 23.25.22.9 22.26.15.6 pay1

.. ... ... ...

In this way I have lakhs of transactions in file and
format of intime and outime are hh:mm:ss:ms

Now using rexx program i want to calculate below two figures

Start of time period avg no of transaction per 10 second
(sec) ( no)
10 ----
20 ----
30 ----
40 ---
50 ---
1.0 ---
1.10(min.sec) ---
1.20 ---


start of time period is incremented to 10 sec each time and i want to calculate the its avg no of transaction per 10 sec value .i.e ---value

By subtracting intime from outtime i will get the time taken by particular transaction for processing

Can anyone tell me logic to archive this?

Thanks
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Mar 29, 2010 10:23 pm    Post subject:
Reply with quote

is this thread related to http://ibmmainframes.com/viewtopic.php?t=43895
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Tue Mar 30, 2010 2:12 am    Post subject: Reply to: Need Logic to calculate specific timestmap differ
Reply with quote

You get the average by counting the records per interval, summing all of the counts, and dividing by the total number of intervals.

Perhaps you should post in the math help forum
Back to top
View user's profile Send private message
pdighade

New User


Joined: 21 Jul 2008
Posts: 40
Location: pune

PostPosted: Tue Mar 30, 2010 7:27 pm    Post subject: Reply to: Need Logic to calculate specific timestmap differ
Reply with quote

I have tried with logic but it is giving me incorrect data

Code:
"execio * diskr inreptr (finis stem in_rept."                       
                                                                     
do i=1 to in_rept.0                                                 
   parse var in_rept.i l1 ',' l2 ',' l3 ',' l4 ',' l5 ',' l6 ',' l7 ','
  paytype=strip(l12) 
                                               
If pos('XXXXX',paytype) = 0 then do                           
  intime=strip(l2)                                                   
  outime=strip(l3)                                                   
  parse var intime hh ':' mm ':' ss '.' ms                           
  Ihh = hh*3600                                                     
  Imm = mm*60                                                       
  Iss = ss                                                           
  Ims = ms/100                                                       
  tot_intime = Ihh + Imm + Iss + Ims                                 
  parse var outime hh ':' mm ':' ss '.' ms                           
  Ohh = hh*3600                                                     
  Omm = mm*60                                                       
  Oss = ss                                                           
  Oms = ms/100                                                       
  tot_outime = Ohh + Omm + Oss + Oms                 
  tot_tran_time = tot_outime - tot_intime             
  prv_tran_time.i = tot_tran_time     
               
  if tot_tran_time >= 10.00 then do                     
     if prv_tran_time.i-1 < 10.00 then do               
       tran_cnt = tran_cnt + 1                           
       tot_tran_time = tot_tran_time + prv_tran_time.i-1
       tran_cnt = 10*tran_cnt/tot_tran_time             
       say 'no of trans in 10 sec interval:'tran_cnt   
     end                                               
     else do                                           
       tran_cnt = tran_cnt + 1                           
       say 'no of trans in 10 sec interval:'tran_cnt     
     end;                                               
     tran_cnt =0                                       
  end;                                                 
  else do                                               
     if exceeds_flag ='yes' then do                       
        sum_time = sum_time + tot_tran_time + pen_tran_time
        exceeds_flag ='no'                                 
     end                                                 
     else do                                             
       sum_time = sum_time + tot_tran_time               
     end                                                 
                                                     
   if sum_time <= 10.00 then do                         
      tran_cnt = tran_cnt + 1                           
   end;                                                 
   if sum_time > 10.00 then do                         
     sum_time = sum_time - tot_tran_time               
   if sum_time  <= 10.00 then do                     
      pen_tran_time = tot_tran_time                 
      exceeds_flag ='yes'                           
   end                                               
                                                       
                                                         
  if sum_time = 10.00 | exceeds_flag ='yes' then do         
     if exceeds_flag ='yes' then do                         
       tran_cnt = tran_cnt - 1                             
     end                                                   
     fil_cnt = fil_cnt + 1                                 
     fil_rec.fil_cnt = tran_cnt                             
                                                         
     say 'no of trans in 10 sec interval:'tran_cnt         
     if exceeds_flag ='yes'  then tran_cnt  = 1             
                                                         
     tran_cnt  = 0                                         
     sum_time  = 0                                         
  end;   
   end; 
     end;
 end; 
Code'd

The file is having transaction as i mentioed earlier .The logic became to much complicated and it is giving me incorrect data. can You please help
Can you please suggest any simpler logic or try to correct above

thanks,
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Tue Mar 30, 2010 10:28 pm    Post subject: Reply to: Need Logic to calculate specific timestmap differ
Reply with quote

your code is missing some comments.

What do your results look like?

Your initial question is somewhat complex, so the logic to implement has to be somewhat complex also.
Back to top
View user's profile Send private message
pdighade

New User


Joined: 21 Jul 2008
Posts: 40
Location: pune

PostPosted: Wed Mar 31, 2010 12:13 pm    Post subject: Reply to: Need Logic to calculate specific timestmap differ
Reply with quote

I am trying to calculate as belwo

say 1st trans took .79 sec
2nd took 2.3 sec
3 take 2.5 sec
4 th take 5 sec for processing

i am tring to add those value and compare with 10 sec and counting no of transaction in that 10 sec but issue is coming as their summasion must not be equal to 10 alltime it might be 10.2 it mighnt be 12,5

so how to take care of that and suppose only single transaction take more than 10 sec say 22 sec for processing then how to take care of this scenarios

Please suggest ...with some beautiful logic
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Wed Mar 31, 2010 7:25 pm    Post subject:
Reply with quote

Hello,

Quote:
am tring to add those value and compare with 10 sec and counting no of transaction in that 10 sec but issue is coming as their summasion must not be equal to 10 alltime it might be 10.2 it mighnt be 12,5
Please clarify. . .

I (for one) do not understand what this is is telling me. . . icon_confused.gif
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Wed Mar 31, 2010 7:45 pm    Post subject: Reply to: Need Logic to calculate specific timestmap differ
Reply with quote

I also am not sure what you are trying to do... you have not stated it well.

But I get the impression you are worried about completion of transactions but I think it would be much simpler if you only worried about arrival rates.
Back to top
View user's profile Send private message
pdighade

New User


Joined: 21 Jul 2008
Posts: 40
Location: pune

PostPosted: Wed Mar 31, 2010 8:59 pm    Post subject: Reply to: Need Logic to calculate specific timestmap differ
Reply with quote

As I mentioned i have transaction file as belwo

ransid intime outime trantype
t1 22.23.12.9 22.23.14.4 pay1
t2 22.23.20.5 22.23.23.8 pay1
t3 23.24.12.6 22.25.13.7 pay1
t4 23.25.22.9 22.26.15.6 pay1

There are aroud 50000 records in file . What I need to do is
Calculate number of transactions completed per 10 sec
and transaction completion time is nothing but outtime-intime

say first traansaction took 2 sec(i.e outime -intime = 2sec) ,second took 3 sec and third took 5 sec

that means for first 10 sec, no of transaction are 3 (b'cz time 2sec+3 sec+5 sec =10sec) so this 3 will be my first output

Now sameway for next 10 sec we need to calculate no of transaction performed

then again for next 10 sec this will continue till end of file

The issue is time taken by transaction might be in decimal like 0.79,0.20
so when I tried to sum all these to match whether it is equal to 10 sec then
it never get satisfied and in some case time taken by transaction may be grater than 10 sec.. This needs to be taken care somehow..
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Wed Mar 31, 2010 9:28 pm    Post subject:
Reply with quote

Hello,

Is there some business reason to do this in rexx?

It is a fairly trivial bit of cobol code. . .

Quote:
This needs to be taken care somehow..
This needs specific rules on how to handle. . . You have to make/post the rules. I suspect that there will be many "overruns" / "overlaps" . . .
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Wed Mar 31, 2010 9:38 pm    Post subject: Reply to: Need Logic to calculate specific timestmap differ
Reply with quote

You want:
Quote:
What I need to do is Calculate number of transactions completed per 10 sec

but the issue you raise has to do with both started and completed in the same interval. If that is really what you want, then you have to ignore transactions that took longer than 10 seconds (they cannot be categorized using the rule you have stated).

If you cannot ignore records, then perhaps try to determine in which 10 second interval the majority of the time was used. Given this:

t5 23.25.25.9 22.26.30.6 pay1

I would say 4.1 seconds occurred in the 20's interval and 0.6 seconds in the 30's interval, so this particular transaction would be added to the 20's count.

Note: the table of records you provided does not match your written description of the time intervals. Please be consistent within your examples.

Part of your description wants to sum up the times, but I do not think you need a sum of the times. You are ignoring gaps of empty time. You only need to know which interval a transaction completed in and add 1 to the total for that interval.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Wed Mar 31, 2010 9:56 pm    Post subject:
Reply with quote

It appears to me you are making this far more complicated than it needs to be.

Since the only purpose the time serves is to caluculate elapsed time per transaction, try this.

Add up the number of transactions and the total elapsed time.

Avgtime = tot_time / tot_trans

Avg_per_10sec = 10 / avgtime

Trying to break it into 10 second intervals as you go is a total wasted effort.

Lets try an example:

t1 5 sec
t2 2
t3 2
t4 1
First 10 seconds = 4 transactions

t5 6
t6 4
Next 10 seconds = 2 transactions

Average of the 2 sets of 10 seconds = 3 transactions

The average as a whole:
20 seconds / 6 transactions = 3.33 seconds per trans
10 / 3.33 = 3 transactions per 10 seconds

Exactly the same and a lot easier.
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Thu Apr 01, 2010 2:35 am    Post subject: Reply to: Need Logic to calculate specific timestmap differ
Reply with quote

Dave, you have a different understanding of the problem than I do. I think the OP needs to clarify more what he is trying to do.

My understanding is that it not about adding the elapsed times until they add up to ten seconds, but rather about how many transactions fall within a certain interval.

I guess I am thinking about real world situations where there can be several transactions running at the same time with overlapping start and stop times. And also gaps when nothing is running.

btw, I think the interval is too short. You will see performance measurements in trx/minute or trx/hour but I have never seen it in trx/10secs.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Thu Apr 01, 2010 3:18 am    Post subject:
Reply with quote

Hello,

And it may be that the SLA for that set of transactions is 10 seconds and the goal is to determine what % of the transactions meet the SLA. . .

I not seen anyone yet try to calculate these kinds of numbers "serially" (which would not be very difficult). Most/all of the systems i work with have dozens to thousands of transactions running concurrently and most overlap making for a differenc kind of calculation.

Possibly we'll receive additional info we can use to help. . .
Back to top
View user's profile Send private message
pdighade

New User


Joined: 21 Jul 2008
Posts: 40
Location: pune

PostPosted: Sun Apr 04, 2010 8:15 pm    Post subject: Reply to: Need Logic to calculate specific timestmap differ
Reply with quote

You are right Dick we need to plot graphs based on figures that we receive by doing above calculation. and based on graph we will measure performance and everything

Now to make it more simpler we need to calculate below thing

Need to calculate no of transaction performed in 1 min time period
so start will be from 1 min as belwo

1 min tpm(transaction per min)

2 min tpm

3 min tpm

4 min tpm

5 min tpm

6 min tpm

etc


that tpm value I need to calculate .. Please help me with logic as soon as possible

note.. transaction completion time is nothing but out time-in time as i mentioned earlier


Thanks in advance
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Sun Apr 04, 2010 9:26 pm    Post subject:
Reply with quote

Hello,

Suggest you create an array of the time intervals you want to track (i.e. 1 min, 2 min. . . n min and > max).

Determine the elapsed time of each transaction (outtime - intime) and add to the appropriate array entry. If the elapsed time is > max, add to the "over max" entry. These "over max" transactons may need additional investigation to determine why they took an inordinate amount of time.
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 401
Location: Mumbai

PostPosted: Sun Apr 04, 2010 10:41 pm    Post subject:
Reply with quote

I don't get the problem either.

you are assuming some definition of 'transactions per minute' but we don't know what that means by your description.

Is 'per minute' defined as per minute of elapsed run time? or is it time of day, say between 18:59 and 19:00?

Is 'transactions' the number of transactions completed or the number of transactions actually running during the interval including those that span intervals?

I don't understand how the time it takes to run a transaction (outtime-intime) has any effect on transactions per minute in a multi-tasking system where you will have many transactions running at the same time.

Forget about the implementation for a while: What is the exact problem you are trying to solve?

(also, a word of etiquette: Please review your posts for basic things like spelling and don't use chat shortcuts... People will not put more effort into the finding the answer than the effort you put into posing the question).
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1219
Location: Israel

PostPosted: Sun Apr 04, 2010 11:02 pm    Post subject:
Reply with quote

pdighade,
I have read this thread 3 times, and I still don't understand what your request is...

pdighade wrote:
say 1st trans took .79 sec
2nd took 2.3 sec
3 take 2.5 sec
4 th take 5 sec for processing

i am tring to add those value and compare with 10 sec and counting no of transaction in that 10 sec


pdighade wrote:
say first traansaction took 2 sec(i.e outime -intime = 2sec) ,second took 3 sec and third took 5 sec

that means for first 10 sec, no of transaction are 3 (b'cz time 2sec+3 sec+5 sec =10sec) so this 3 will be my first output

Now sameway for next 10 sec we need to calculate no of transaction performed

then again for next 10 sec this will continue till end of file


How can you add these values, if you don't take into account the "intime".
Using your example, you will have 3 trans (t1+t2+t3) in 10 sec:.
You're counting 3 trans in less than 10 seconds when in fact more than 2 minutes elapsed between the beginning of t1 and the end of t3.


pdighade wrote:
start of time period is incremented to 10 sec each time and i want to calculate the its avg no of transaction per 10 sec value .i.e ---value
pdighade wrote:
Need to calculate no of transaction performed in 1 min time period
This request has nothing to do with the transaction duration, you need to use the "intime" only.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Sun Apr 04, 2010 11:18 pm    Post subject:
Reply with quote

pdighade,

Let me see if I understand this...

I have been charged for X number of seconds of time for a specific transaction.
I want to know what the average number of transactions were executed for each ten second interval of charged time.
I want to see how that number changes from the first 10 second interval until the last ten second interval.

Am I close?

I'd actually prefer the average elapsed time of the transaction for each 5 or 10 minute interval during the day....
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Mon Apr 05, 2010 1:20 am    Post subject: Reply to: Need Logic to calculate specific timestmap differ
Reply with quote

Pdighade,

Please give us 20 real records and show us the math you do on them manually to get TPM and show us the results that you get. Then maybe we can help you write a program does the same.

==========

A few people have said there is no reason to compute the outtime-intime... just use either the intime -or- the outtime.

Just truncate that time to give you which interval it falls in.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sticky: difference between ... DUMMY ... and ... enrico-sorichetti JCL & VSAM 0 Mon Oct 17, 2016 4:31 pm
No new posts how to split records based on specifi... Venkata Ramayya DFSORT/ICETOOL 6 Wed Sep 28, 2016 3:20 am
No new posts How to calculate an specific transact... lind sh CICS 2 Tue Sep 13, 2016 9:20 pm
No new posts Wildcard logic in COBOL dudenithy COBOL Programming 13 Thu Sep 01, 2016 7:36 pm
No new posts DFSORT sorting only specific records akodakka DFSORT/ICETOOL 4 Thu Aug 04, 2016 11:24 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us