Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
maximum timestamp value

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Ambili S

Active User


Joined: 06 Sep 2007
Posts: 112
Location: India

PostPosted: Tue Jun 09, 2009 5:22 pm    Post subject: maximum timestamp value
Reply with quote

Hi

I've an input file with timestamps and bank names as shown below.

I/P file has 3 fields ( 1 to 8 is timestamps ) , ( 13 to 5 is acquired bank name) , ( 20 to 5 is issues bank names)

----+----1----+----2----+----3-
***************************** T
12:00:01 BANK1 BANK2
12:00:01 BANK1 BANK4
12:00:01 BANK2 BANK3
12:00:01 BANK2 BANK1
12:00:01 BANK2 BANK4
12:00:02 BANK1 BANK2
12:00:02 BANK1 BANK4
12:00:03 BANK2 BANK3
12:00:04 BANK1 BANK2
12:00:04 BANK1 BANK4
12:00:04 BANK2 BANK3
12:00:04 BANK2 BANK1
12:00:04 BANK2 BANK4
12:00:04 BANK1 BANK4
12:00:04 BANK2 BANK3
12:00:04 BANK2 BANK1
12:00:04 BANK2 BANK4

So my output should have the following:

The highest timestamp value :
The bank name which appears max times in that timestamp set :
The count of the same bank in acquired column :
The count of the same bank in issued column :

hence the output should be as follows :

MAX TS = 12:00:04
MAX BANK OCCURENCE IS = BANK2
ACQUIRED = 6
ISSUED = 1
TOTAL = 7

How can this be done using DFSORT ?
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Tue Jun 09, 2009 10:12 pm    Post subject:
Reply with quote

Ambili S,

The following DFSORT JCL will give you the desired results


Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*   
//SORTIN   DD DSN=your input file,DISP=SHR
//SORTOUT  DD DSN=&&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE) 
//SYSIN    DD *                                             
  SORT FIELDS=(1,8,CH,D,13,5,CH,A,20,5,CH,A)               
  OUTREC IFTHEN=(WHEN=INIT,                                 
  OVERLAY=(25:SEQNUM,8,ZD,RESTART=(01,8),X,                 
              SEQNUM,8,ZD,RESTART=(13,5),X,                 
              SEQNUM,8,ZD,RESTART=(20,5),X)),               
  IFTHEN=(WHEN=GROUP,BEGIN=(25,8,ZD,EQ,1),PUSH=(52:ID=8))   
                                                           
  OUTFIL INCLUDE=(52,8,ZD,EQ,1),                           
  REMOVECC,NODETAIL,BUILD=(80X),                           
  TRAILER1=('TCNT,C''',MAX=(34,8,ZD,M11,LENGTH=8),C'''',/, 
            'STMP,C''',1,8,C'''',/,                         
            'NAME,C''',13,5,C'''',80:X)                     
/*                                                         
//STEP0200 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SYMNAMES DD DSN=&&T1,DISP=SHR 
//SORTIN   DD DSN=your input file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                         
  INCLUDE COND=(1,8,CH,EQ,STMP,AND,20,5,CH,EQ,NAME)     
  SORT FIELDS=COPY                                     
  OUTREC OVERLAY=(TCNT,SEQNUM,8,ZD,                     
                  1,8,ZD,ADD,9,8,ZD,M11,LENGTH=8,80:X) 
  OUTFIL REMOVECC,NODETAIL,                             
  TRAILER1=('MAX TIME STAMP        = ',STMP,/,         
            'MAX BANK OCCURENCE IS = ',NAME,/,         
            'ACUIRED               = ',TCNT,/,         
            'ISSUED                = ',9,8,/,           
            'TOTAL                 = ',17,8)           
/*


The output from this job is :

Code:

MAX TIME STAMP        = 12:00:04   
MAX BANK OCCURENCE IS = BANK2     
ACUIRED               = 00000006   
ISSUED                = 00000001   
TOTAL                 = 00000007   
Back to top
View user's profile Send private message
Ambili S

Active User


Joined: 06 Sep 2007
Posts: 112
Location: India

PostPosted: Wed Jun 10, 2009 8:03 am    Post subject: Reply to: maximum timestamp value
Reply with quote

Hi Skolusu

Thanks for this. It would really be of great help if you could explain me the same , especially the OVERLAY and TRAILER in step0100 .
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Jun 10, 2009 11:09 pm    Post subject:
Reply with quote

Ambili S,

I forgot to remove some unnecessary stuff in step0100 as I was playing around to get everything done in a single step. But it is not possible to get everything done in single step, we can use the following job

Explanation of the control cards:

1.Sort the Timestamp field D and Bank name ascending

2.Now we have the max time stamp values at the top. we put a seqnum at pos 25 for every changing timestamp value using restart parm. We also put another seqnum at pos 33 for every changing bank name using the restart parm.

we use the seqnum at pos 25 to group the similar records of same timestamp with when=group statement. By doing this the max timestamp field records will have group id of 1 at pos 41 and these are the only records which we are interested in. so we write these records to another temp file named max rec which we will use in step0200 as input instead of spinning thru the entire file once again.

Now we create 3 symbols to get the records for the bank name in issued column. Pos33 which has the max seqnum will give you the bank name. So inorder to get the max record value we use reporting features and create 3 symbols.

TCNT will have the max value of a bank for that timestamp set.
STMP will have the max timestamp
Name will have the name of the bank that occurred max times in that set.

Now we use these symbols in step0200 which gives you the desired results

Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*   
//SORTIN   DD DSN=your input file,DISP=SHR
//SORTOUT  DD DSN=&&S1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)           
//MAXREC   DD DSN=&&I1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)           
//SYSIN    DD *                                                       
  SORT FIELDS=(1,8,CH,D,13,5,CH,A)                                   
  OUTREC IFTHEN=(WHEN=INIT,                                           
  OVERLAY=(25:SEQNUM,8,ZD,RESTART=(01,8),SEQNUM,8,ZD,RESTART=(13,5))),
  IFTHEN=(WHEN=GROUP,BEGIN=(25,8,ZD,EQ,1),PUSH=(41:ID=8))           

  OUTFIL FNAMES=MAXREC,INCLUDE=(41,8,ZD,EQ,1),BUILD=(1,24)             
                                                                     
  OUTFIL INCLUDE=(41,8,ZD,EQ,1),                                     
  REMOVECC,NODETAIL,BUILD=(80X),                                     
  TRAILER1=('TCNT,C''',MAX=(33,8,ZD,M11,LENGTH=8),C'''',/,           
            'STMP,C''',1,8,C'''',/,                                   
            'NAME,C''',13,5,C'''',80:X)                               
/* 
//STEP0200 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SYMNAMES DD DSN=&&S1,DISP=SHR                         
//SORTIN   DD DSN=&&I1,DISP=SHR                         
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  INCLUDE COND=(20,5,CH,EQ,NAME)     
  SORT FIELDS=COPY                                       
  OUTREC OVERLAY=(TCNT,SEQNUM,8,ZD,                     
                  1,8,ZD,ADD,9,8,ZD,M11,LENGTH=8,80:X)   
  OUTFIL REMOVECC,NODETAIL,                             
  TRAILER1=('MAX TIME STAMP        = ',STMP,/,           
            'MAX BANK OCCURENCE IS = ',NAME,/,           
            'ACUIRED               = ',TCNT,/,           
            'ISSUED                = ',9,8,/,           
            'TOTAL                 = ',17,8)             
//*
Back to top
View user's profile Send private message
Ambili S

Active User


Joined: 06 Sep 2007
Posts: 112
Location: India

PostPosted: Thu Jun 11, 2009 11:22 am    Post subject:
Reply with quote

Thank u .this gave me a clear picture now.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting EBCDIC to Unicode (TimeStamp) muralikrishnan_new COBOL Programming 2 Mon Jul 25, 2016 10:42 pm
No new posts Convert Timestamp Value mrdinesh DFSORT/ICETOOL 7 Thu May 05, 2016 6:01 pm
No new posts What is the maximum number of sort wo... Pravina M SYNCSORT 2 Mon Mar 14, 2016 4:51 pm
No new posts Comparing timestamp in Synscort l.nethaji SYNCSORT 13 Wed Jan 20, 2016 4:47 pm
No new posts pass numeric value of length 14 to ti... Ralph Zbrog Java & MQSeries 4 Fri Jan 15, 2016 3:20 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us