Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 1868
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: 10310
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 Compare yesterday's date to the one o... migusd SYNCSORT 4 Fri Sep 22, 2017 11:35 pm
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 4 Fri Sep 22, 2017 4:56 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us