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

Calculate the count of records between one minute time frame


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
pdighade

New User


Joined: 21 Jul 2008
Posts: 40
Location: pune

PostPosted: Thu Jul 08, 2010 8:47 pm
Reply with quote

Hi Skolusu,

Job is working fine and now giving expected result
Actually I did mistake in below line

C'.',81,8,ZD,MOD,+60,M11,LENGTH=2,1020:X))

As my input file is having date in format with ':' in between HR:MM
I have replaced c'.' with c':' and its working.

Answers for your questions.

What am I supposed to do with the previous day transactions?
Ans:For all the transactions of previous day, all the resultant rows of time and count should come just before start of whatever date next to it.

Generate another 1440 records for previous day also?
Ans: No of transactions of previous day to be captured for perticular time slot depends upon our requirement .Whenever requied we set some parameter and capture transaction of previous day for perticular time slot along with
current days trans. One more thing the time slot of previous day is always in continuation with current day.

e.g previous day's 22:00 PM to 24:00 hrs of current date

So whaever trans of previous day. the count should just come before start of date next to it

Note: The current date is not always system date. we can extract transaction of any date and the date just previous to it. But the limit is
max two days data we can extract and We are generally never extracting previous day's complete data.

Your date field is 6 character
long and how did you fit a 8 byte format in it?

Ans:This is mistake from my side. The data is having 8 characters.
and start position is 13th and format is yyyymmdd

So generating 1440 records for previous day may not work here as file may not have complete day's trans. No of records to be generated depends upon time slot captured of previous day.

Can you please help me on this?
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jul 09, 2010 5:16 am
Reply with quote

pdighade wrote:
So whaever trans of previous day. the count should just come before start of date next to it


pdighade,

The following DFSORT JCL will give you the desired results. The report now shows as date field next to the time. The report will generate the time report from the beginning time frame of any date and generate any default values for the missing time slots till 23:59 of each day.


Code:

//****************************************************************
//* GENERATES 1440 RECORDS WITH TIME FROM 00:00 TO 23:59         *
//****************************************************************
//STEP0100 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                   
A                                                                 
//SORTOUT  DD DSN=&&DF,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)       
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                               
  OUTFIL REPEAT=1440,FTOV,VLTRIM=C' ',                           
  IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,START=0)),           
  IFTHEN=(WHEN=INIT,OVERLAY=(30:81,8,ZD,DIV,+60,M11,LENGTH=2,     
          C':',81,8,ZD,MOD,+60,M11,LENGTH=2,1020:X))             
//*                                                   
//****************************************************************     
//* GENERATE SUMMARY REPORT FOR TRANSACTIONS 'PAY' 'ATM' 'CHQ'   *     
//****************************************************************     
//STEP0200 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=your input VB file,DISP=SHR
//         DD DSN=&&DF,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT 
//         DD DSN=&&DF,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT 
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                                         
  INREC IFTHEN=(WHEN=INIT,                                             
  PARSE=(%=(ENDBEFR=C'ATM',ENDBEFR=C'CHQ',ENDBEFR=C'PAY',ABSPOS=137),   
        %1=(SUBPOS=3,FIXLEN=3)),                                       
  BUILD=(1,4,34,5,X,13,8,X,%1,X,3C'00000000 ',SEQNUM,8,ZD)),           
  IFTHEN=(WHEN=GROUP,BEGIN=(51,8,ZD,EQ,1),PUSH=(60:11,8)),             
  IFTHEN=(WHEN=GROUP,BEGIN=((60,8,CH,NE,11,8,CH),AND,11,8,CH,GT,C' '), 
  PUSH=(69:11,8)),                                                     
  IFTHEN=(WHEN=(20,3,CH,EQ,C'PAY'),OVERLAY=(31:C'1')),                 
  IFTHEN=(WHEN=(20,3,CH,EQ,C'ATM'),OVERLAY=(40:C'1')),                 
  IFTHEN=(WHEN=(20,3,CH,EQ,C'CHQ'),OVERLAY=(49:C'1')),                 
  IFTHEN=(WHEN=(11,8,CH,EQ,C' '),OVERLAY=(78:SEQNUM,4,ZD),HIT=NEXT),   
  IFTHEN=(WHEN=(78,4,ZD,LE,1440),OVERLAY=(11:60,8)),                   
  IFTHEN=(WHEN=(78,4,ZD,GT,1440),OVERLAY=(11:69,8))                     
                                                                       
  SORT FIELDS=(11,8,CH,A,5,5,CH,A),EQUALS                               
  SUM FIELDS=(24,8,ZD,33,8,ZD,42,8,ZD)                                 
                                                                       
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(20,3,CH,GT,C' '),PUSH=(20:20,3))     
                                                                       
  OUTFIL VTOF,OMIT=(20,3,CH,EQ,C' '),                                   
  BUILD=(03:5,5,                                                       
         10:11,8,ZD,EDIT=(TTTT/TT/TT),                                 
         22:24,8,ZD,M10,LENGTH=8,                                       
         32:33,8,ZD,M10,LENGTH=8,                                       
         42:42,8,ZD,M10,LENGTH=8,                                       
         80:X),                                                         
  HEADER2=('  TIME ',2X,'  TRANS ',4X,                                 
           'PAY TRAN',2X,'ATM TRAN',2X,'CHQ TRAN',/,                   
           ' FRAME ',2X,'   DATE ',4X,                                 
           '   COUNT ',2X,'  COUNT ',2X,'  COUNT ',/,                   
           '=======',2X,'==========',2X,                               
           '========',2X,'========',2X,'========')                     
//*


The output of this job would be as follows

Code:

  TIME     TRANS     PAY TRAN  ATM TRAN  CHQ TRAN
 FRAME      DATE        COUNT     COUNT     COUNT
=======  ==========  ========  ========  ========
  20:23  2010/07/04         0         1         0
  20:24  2010/07/04         0         0         0
  20:25  2010/07/04         0         1         0
  20:26  2010/07/04         0         0         0
...
  23:58  2010/07/04         0         0         0 
  23:59  2010/07/04         0         0         2 
  00:00  2010/07/05         0         0         0 
  00:01  2010/07/05         0         4         0 
....
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts To get the the current time DFSORT/ICETOOL 13
Search our Forums:

Back to Top