In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities
Moderators: Frank Yaeger , Moderator Group
mariraj
Member
Posts: 3 Joined: Wed Sep 26, 2012 11:19 am
Post
by mariraj » Wed Sep 26, 2012 12:57 pm
Hi,
I need to sort a file which contains XML records using SORT(either DFSORT/SYNCSORT). 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: Select all
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.
Last edited by
mariraj on Wed Sep 26, 2012 2:56 pm, edited 1 time in total.
NicC
Active Member
Posts: 650 Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm
Post
by NicC » Wed Sep 26, 2012 3:37 pm
If there is a similar post which has already been answered, please let me know
What is wrong with using the search facility and finding this out for yourself?
Regards
Nic
mariraj
Member
Posts: 3 Joined: Wed Sep 26, 2012 11:19 am
Post
by mariraj » Wed Sep 26, 2012 4:08 pm
I tried that Nic but couldn't find any similar question.
Anuj Dhawan
Moderator
Posts: 1625 Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India
Post
by Anuj Dhawan » Mon Oct 01, 2012 4:57 pm
I'm little late to the party, however, try this:
Code: Select all
//SORTIN DD *
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
//SORTOUT DD SYSOUT=*
//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)
//*
Regards,
Anuj
dbzTHEdinosauer
Moderator
Posts: 981 Joined: Mon Oct 02, 2006 8:31 pm
Post
by dbzTHEdinosauer » Mon Oct 01, 2012 5:40 pm
duplicate answer, also.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
Free tutorials from mainframegurukul
JCL Tutorial Covers all important JCL concepts.
Cobol Tutorial This tutorials covers all Cobol Topics from STRING to COMP-3.
DB2 Tutorial DB2 Tutorial focuses on DB2 COBOL Programming.
SORT Tutorial This Tutorial covers all important aspects of DFSORT with examples
CICS Tutorial This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Mainframe Interview questions
Mainframe Tools and others