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
 

 

CURRENT TIMESTAMP upto milliseconds using sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: CURRENT TIMESTAMP upto milliseconds using sort
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    Post subject: Reply to: CURRENT TIMESTAMP upto milliseconds using sort
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

Senior Member


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

PostPosted: Mon Jun 21, 2010 4:45 pm    Post subject:
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    Post subject: Reply to: CURRENT TIMESTAMP upto milliseconds using sort
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

Senior Member


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

PostPosted: Mon Jun 21, 2010 8:18 pm    Post subject: Re: Reply to: CURRENT TIMESTAMP upto milliseconds using sort
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: 2150
Location: At my coffee table

PostPosted: Mon Jun 21, 2010 8:31 pm    Post subject:
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    Post subject:
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    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 Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm


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