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

CURRENT TIMESTAMP upto milliseconds using sort


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

New User


Joined: 20 Aug 2006
Posts: 34
Location: chennai

PostPosted: Mon Jun 21, 2010 12:37 pm
Reply with quote

Can anybody please tell me how to get the CURRENT TIMESTAMP upto milliseconds using either SORT/DFSORT/ICETOOL.
If I use any of formats like TIME1/TIME2/TIME3 it gives only upto seconds.
Back to top
View user's profile Send private message
gabriel.ryoga

New User


Joined: 07 Jun 2007
Posts: 31
Location: Spain

PostPosted: Mon Jun 21, 2010 4:24 pm
Reply with quote

I think that DFSORT's TIME instruction, only will return you a seconds precision.
 
I think that if you only need to identify any output record in a unique way. You could use this job:
 

Code:

//STEP0100 EXEC PGM=ICETOOL                           
//TOOLMSG  DD SYSOUT=*                                
//DFSMSG   DD SYSOUT=*                                
//IN       DD *                                       
100 ABCAXY                                            
300 BCDASY                                            
200 DBFDSA                                            
100 ADBSAD                                            
150 DFGSFS                                            
//TOOLIN   DD *                                       
  SORT FROM(IN) TO(T1) USING(CTL1)                    
//T1       DD SYSOUT=*                                
//CTL1CNTL DD *                                       
 INREC OVERLAY=(12:DATE=(4MD-),C'-',TIME=(24.))       
 SORT FIELDS=COPY                                     
 OUTREC OVERLAY=(31:C'.',32:SEQNUM,6,ZD,RESTART=(30,2))
/*      

 
It will generate a timestamp format variable and number it from 000001 to 999999.
restarting everytime the seconds change.
 
It can give you duplicate timestamps when the seqnum arrives to 999999 and the seconds have not change. icon_sad.gif
But I hope this can be useful for you.
 
                                              
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Jun 21, 2010 4:45 pm
Reply with quote

AFAIK, DFSORT does NOT have any built-in functions for getting the microsecond part dynamically, however as you just said mili-seconds, try this:
Code:
//sort1 EXEC PGM=SORT               
//SYSOUT DD SYSOUT=*               
//SORTIN DD *                       
RECORD                             
//SORTOUT DD SYSOUT=*               
//SYSIN DD *                       
  SORT FIELDS=COPY                 
  OUTREC BUILD=(1:DATE4,C'.000000')
Back to top
View user's profile Send private message
shaktiprasad

New User


Joined: 20 Aug 2006
Posts: 34
Location: chennai

PostPosted: Mon Jun 21, 2010 7:34 pm
Reply with quote

Hi ,
Thanks for the reply. Actually I wanted to use it for a unique number generation only.But it seems it will give me duplicate records if the time doesn't change within a span.So I am going by Program to generate the unique number.

Anyway thanks for the quick reponse again.

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

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Jun 21, 2010 8:18 pm
Reply with quote

shaktiprasad wrote:
Thanks for the reply. Actually I wanted to use it for a unique number generation only.
Quote:
Can anybody please tell me how to get the CURRENT TIMESTAMP upto milliseconds using either SORT/DFSORT/ICETOOL.
Your first post, in this thread, and the latest post are by far in no relation! How would I know, what do yuou want - and for that matter, how the sort would know!?

Suggest you start over and tell us what exactly you are looking for...
Back to top
View user's profile Send private message
CICS Guy

Senior Member


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

PostPosted: Mon Jun 21, 2010 8:31 pm
Reply with quote

For uniqueness, consider seqnum...
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 22, 2010 3:34 am
Reply with quote

shaktiprasad,

As cicsguy pointed out you can use the seqnum to generate the microseconds portion unique. However note that the microseconds is only 6 digits so you can only generate a max of 999,999 unique values

Code:

//STEP0100 EXEC PGM=SORT               
//SYSOUT   DD SYSOUT=*               
//SORTIN   DD *                       
RECORD                             
//SORTOUT DD SYSOUT=*               
//SYSIN DD *                       
  SORT FIELDS=COPY                 
  OUTREC BUILD=(1:DATE4,C'.',SEQNUM,6,ZD)
//*
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts To get the count of rows for every 1 ... DB2 3
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts To get the the current time DFSORT/ICETOOL 13
Search our Forums:

Back to Top