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

Sorting a file based on timestamp


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

New User


Joined: 20 Jul 2006
Posts: 48
Location: Chennai

PostPosted: Tue Oct 09, 2007 2:44 pm
Reply with quote

I have a file with several fields along with a timestamp. I want to sort this file based on time stamp. How can I code the sort card for this?

Also another requirement for me is I want to copy only one field in the above file based on the timestamp. ie If the file has the record for one month I want only the first 5 bytes to be copied to another file which are written in the file in the last seven days. How can I put the sort card to check the time stamp for this.

Sakthivel
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Oct 09, 2007 2:48 pm
Reply with quote

Sakthivel,

Could you post your sample IP and OP?

Quote:
Does sort card understands the LT and GT for date

It does understand LT/GT conditions.
Back to top
View user's profile Send private message
sakthi_ksv

New User


Joined: 20 Jul 2006
Posts: 48
Location: Chennai

PostPosted: Tue Oct 09, 2007 3:09 pm
Reply with quote

Ok leave all the things, Just have this question. I have file with a sample record as follows

12345<SPACE>2007-10-09-10.02.59.220587


I want to copy first 5 bytes of the records from this file to another file based on date between oct-02-2007 to oct-09-2007.

can I put the sort card as GT 2007-10-02 AND LT 2007-10-09.
will it work?

Sakthivel.
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: Tue Oct 09, 2007 3:20 pm
Reply with quote

Do you need a a pointer to a sort manual?
Back to top
View user's profile Send private message
sakthi_ksv

New User


Joined: 20 Jul 2006
Posts: 48
Location: Chennai

PostPosted: Tue Oct 09, 2007 3:22 pm
Reply with quote

Could you please give me the actual sort card for this?
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Oct 09, 2007 3:38 pm
Reply with quote

Sakthi,

Use the topic INCLUDE RECORDS USING RELATIVE DATES topic from the sorttrck pdf available under the link -

www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Oct 09, 2007 3:45 pm
Reply with quote

Sakthi,

Ignore my prev post. Here is the sosrtcard for your req -

Code:
//SORTIN DD *                                     
12345 2007-10-10                                 
12345 2007-10-09                                 
34345 2007-10-08                                 
12556 2007-10-02                                 
12AB6 2007-10-01                                 
/*                                               
//SORTOUT DD SYSOUT=*                             
//SYSIN DD *                                     
  OPTION COPY                                     
  INCLUDE COND=(7,10,CH,LE,C'2007-10-09',AND,     
                7,10,CH,GE,C'2007-10-02')         
  OUTREC FIELDS=(1,5)                             
/*                                               


OP:

Code:
12345   
34345   
12556   
Back to top
View user's profile Send private message
sakthi_ksv

New User


Joined: 20 Jul 2006
Posts: 48
Location: Chennai

PostPosted: Tue Oct 09, 2007 5:59 pm
Reply with quote

Thanks a lot Murali.

Thanks for the timely help.
Back to top
View user's profile Send private message
sakthi_ksv

New User


Joined: 20 Jul 2006
Posts: 48
Location: Chennai

PostPosted: Thu Oct 11, 2007 10:11 am
Reply with quote

Hi I used the sort card as follows to remove the record that are older than 7 seven days. But it is giving an error
Code:

OPTION DYNALLOC=(SYSDA,9),FILSZ=E100000
SORT FIELDS=COPY                       
INCLUDE COND=(18,10,CH,GT,DATE1(-)-7)   

ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                                 
ICE000I 1 - CONTROL STATEMENTS FOR 5740-SM1, DFSORT REL 14.0 - 05:24 ON THU OCT
             OPTION DYNALLOC=(SYSDA,9),FILSZ=E100000                           
             SORT FIELDS=COPY                                                   
             INCLUDE COND=(18,10,CH,GT,DATE1(-)-7)                             
                                               $                               
ICE007A E SYNTAX ERROR                                                         


I used this as said the DFS sort tricks PDF. But it is giving an error. Please help me on this. Is there anything to be done with the sort technique selected or is there any other way to accomplish this requirement??


Thanks and Regards,
Sakthi
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu Oct 11, 2007 11:13 am
Reply with quote

Sakthivel,

I tried your sortcard. Its working fine for me.
Back to top
View user's profile Send private message
sakthi_ksv

New User


Joined: 20 Jul 2006
Posts: 48
Location: Chennai

PostPosted: Thu Oct 11, 2007 11:36 am
Reply with quote

Do you know why it is giving error for me??? Is anything has to be done with the setting
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Oct 11, 2007 9:28 pm
Reply with quote

Sakthi,

Your control statements are ok. However, the syntax error indicates that you don't have DFSORT R14 PTF UK90006 (April, 2006) installed. You need that PTF to use relative dates. Ask your System Programmer to install that PTF (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

Use [URL] BBCode for External Links
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top