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

Date Comparison thru Syncsort


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

Active User


Joined: 24 May 2013
Posts: 156
Location: INDIA

PostPosted: Wed Jul 03, 2013 1:44 pm
Reply with quote

Guys,

I have below requirement


Input

Code:
107/02/2013 02:37:10                     CA View Output Archival and Viewing (11
 SARBCT                                   Batch Processing Utility - Sysout Arch
0ID                               Jobname  Jobid      Gen   Seq  Arc Date  Arc T
 -------------------------------- -------- -------- ----- ----- ---------- -----
0DMP901BT                         DMP901BT JOB14090  2240     1 07/03/2013 23:47
 DMP901BT                         DMP901BT JOB58695  2239     1 06/28/2013 23:50
0DMP901BT                         DMP901BT JOB49624  2181     1 05/02/2013 03:56
0DMP901BT                         DMP901BT JOB49624  2181     1 05/02/2013 03:56
I need to pickup the record having 0DMP901BT and the date as current date or current date-1

For example in above input My sort step should pick the first record since it is having 0DMP901BT and have current date .. I only need first record satisfying my condition and leave rest.

I was thinking of sort card soemthing like below but I am not sure how I would compare the date portion of it which starts from 65th column and is of 10 digit.. Challange for me is to compare the date which is having "/" as saperator

Code:
SORT FIELDS=COPY                                               
INCLUDE COND=(1,9,CH,EQ,C'0DMP901BT',AND,65,10,CH,EQ,&DATE ,OR,
              65,10,CH,EQ,&DATE-1)     


My Desired output from above input is

Code:
0DMP901BT                         DMP901BT JOB14090  2240     1 07/03/2013 23:47
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Jul 03, 2013 2:17 pm
Reply with quote

I had some work to do with dates, but using DFSORT rather than SYNCSORT, and the solution was to reformat the dates before processing them.

Do a search in the DFSORT forum, with expat as author and they should be easy enough to find as they were quite recent. It may help you with your problem.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Jul 03, 2013 2:22 pm
Reply with quote

Do the overlay of date and then compare to output of &DATE1
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Wed Jul 03, 2013 3:12 pm
Reply with quote

Hello,

Sample snippet

Code:
//STEP01 EXEC PGM=SORT                                                 
//SYSOUT    DD SYSOUT=*                                                 
//SORTIN    DD *                                                       
0DMP901BT                         DMP901BT JOB14090  2240     1 07/03/2013
0DMP901BT                         DMP901BT JOB14090  2240     1 07/02/2013
0DMP901BT                         DMP901BT JOB14090  2240     1 07/01/2013
//SORTOUT   DD SYSOUT=*,                                               
//             RECFM=FB,LRECL=80                                       
//SYSIN     DD *                                                       
  SORT FIELDS=COPY                                                     
  INREC  OVERLAY=(101:71,4,105:65,2,107:68,2)                           
  OUTFIL BUILD=(1,80),                                                 
  INCLUDE=(1,9,CH,EQ,C'0DMP901BT',AND,101,8,CH,EQ,DATE1,OR,             
                101,8,CH,EQ,DATE1-1)                                   
/


Output
Code:
********************************* TOP OF DATA **********************************
0DMP901BT                         DMP901BT JOB14090  2240     1 07/03/2013     
0DMP901BT                         DMP901BT JOB14090  2240     1 07/02/2013     
******************************** BOTTOM OF DATA ********************************
Back to top
View user's profile Send private message
thesumitk

Active User


Joined: 24 May 2013
Posts: 156
Location: INDIA

PostPosted: Wed Jul 03, 2013 8:46 pm
Reply with quote

Thanks a Lot for the solutions!!!
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
Search our Forums:

Back to Top