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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Sort a file based on a field whose position is not fixed
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: 1787
Location: UK

PostPosted: Wed Sep 26, 2012 3:56 pm    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10254
Location: italy

PostPosted: Wed Sep 26, 2012 4:42 pm    Post subject: Reply to: Sort a file based on a field whose position is not
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

Site Director


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

PostPosted: Wed Sep 26, 2012 7:44 pm    Post subject:
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    Post subject: Reply to: Sort a file based on a field whose position is not
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


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