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

Sort a file based on a field whose position is not fixed


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Mariraj

New User


Joined: 09 Jul 2007
Posts: 59
Location: Chennai

PostPosted: Wed Sep 26, 2012 3:30 pm
Reply with quote

Hi,

I need to sort a file which contains XML records using DFSORT. The record contains a tag like <CRTS>2012-09-26-01.01.01.000000</CRTS>. I need to sort and filter records based on this timestamp value. Being an XML, the position of this <CRTS> tag keeps varying.
Input file Specifications
RECFM=FB, LRECL=80

Sample data:

Code:
AAAAAAAAAAA<CRTS>2012-09-26-02.01.01.000000</CRTS>BBBBBBBBBBBB
XXXXXXXX<CRTS>2012-09-26-01.01.01.000000</CRTS>HHHHHHHHHHHHH
CCCCCCC<CRTS>2012-02-26-03.01.01.000000</CRTS>BBBBBBBBB


I need to include only records which are within 90 days from current date.

Please let me know how this can be done. If there is a similar post which has already been answered, please let me know.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Sep 26, 2012 3:56 pm
Reply with quote

Unlike the other forum SYNCSORT queries go into the JCL forum here. PLease familiarise yourself with the forum sections and rules before using.
Back to top
View user's profile Send private message
Mariraj

New User


Joined: 09 Jul 2007
Posts: 59
Location: Chennai

PostPosted: Wed Sep 26, 2012 4:40 pm
Reply with quote

How did you concluded that I am asking about SYNCSORT when I have clearly mentioned that I am looking for solution using DFSORT.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Sep 26, 2012 4:42 pm
Reply with quote

Quote:
How did you concluded that I am asking about SYNCSORT when I have clearly mentioned that I am looking for solution using DFSORT.


because You posted Your question in the JCL forum, where SYNCSORT questions are handled icon_evil.gif
and because most of the people asking <sort> questions confuse the two products
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Sep 26, 2012 7:44 pm
Reply with quote

Hello,

Quote:
How did you concluded that I am asking about SYNCSORT when I have clearly mentioned that I am looking for solution using DFSORT.
Many (most) of the sort questions begin life in the DFSORT part of the forum. Many Syncsort users do not even know they are Not using DFSORT. Others do know and try to sneak their question into the DFSORT part of the forum because we have an IBM developer who provides excellent solutions and often it is not obvious that a question is for one sort product or aonther.

As your topic was posted in the JCL part of the forum and you have been a member for more than 5 years, it was rather logical to believe the DFSORT might have been a typo. . .
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Sep 26, 2012 9:59 pm
Reply with quote

Mariraj,

Use the following DFSORT JCL which will give you the desired results.

Code:

//SYSIN    DD *                                                   
  INREC PARSE=(%01=(STARTAFT=C'<CRTS>',FIXLEN=10)),OVERLAY=(81:%01)
  SORT FIELDS=COPY
  OUTFIL BUILD=(1,80),INCLUDE=(81,10,CH,GT,DATE1(-)-90)           
//*
Back to top
View user's profile Send private message
Mariraj

New User


Joined: 09 Jul 2007
Posts: 59
Location: Chennai

PostPosted: Wed Oct 03, 2012 5:14 pm
Reply with quote

Kolusu, thanks for the posting the solution. I was able to do it myself with some direction from Enrico.

Thanks for the guidance everyone.
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 -> JCL & VSAM

 


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 Store the data for fixed length COBOL Programming 1
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
Search our Forums:

Back to Top