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
 

 

Date Comparison thru Syncsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
thesumitk

Active User


Joined: 24 May 2013
Posts: 129
Location: INDIA

PostPosted: Wed Jul 03, 2013 1:44 pm    Post subject: Date Comparison thru Syncsort
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: 8593
Location: Back in jolly old England

PostPosted: Wed Jul 03, 2013 2:17 pm    Post subject:
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

Moderator


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

PostPosted: Wed Jul 03, 2013 2:22 pm    Post subject:
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    Post subject:
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: 129
Location: INDIA

PostPosted: Wed Jul 03, 2013 8:46 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL 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 add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm
No new posts SUBSTR for Date functions Shaheen Shaik DB2 4 Thu Apr 06, 2017 2:14 pm
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm


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