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
 
Syncsort extract date before two months of current date

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
seema_285

New User


Joined: 14 Oct 2010
Posts: 13
Location: pune

PostPosted: Thu Oct 14, 2010 5:27 pm    Post subject: Syncsort extract date before two months of current date
Reply with quote

Hi,
I want to do some manipulations on date which is in mm/dd/yyyy format in my input file.

I want to extract records which have date before two months of current date.

How to do this using sort.??
I have tried with following sort card but got an user abend.
Code:

  SORT FIELDS=COPY                           
  OUTFIL OUTREC=(01,10,ZD,LT,&DATE2P(MD4/)-2)
  OUTFIL OUTREC=(01,10,ZD,GT,&DATE2P(MD4/)-2)

Please suggest some solutions.
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: Thu Oct 14, 2010 8:59 pm    Post subject:
Reply with quote

Hello and welcome to the forum,

One easy thing to do is write a bit of code to generate the sort control statements.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2285
Location: @my desk

PostPosted: Fri Oct 15, 2010 10:29 am    Post subject:
Reply with quote

seema_285,

Welcome to the forums!

Are you just considering the month alone and not the date (dd) part?

Can you provide some sample input and expected output out of it?
Back to top
View user's profile Send private message
seema_285

New User


Joined: 14 Oct 2010
Posts: 13
Location: pune

PostPosted: Mon Oct 18, 2010 5:56 pm    Post subject: re:syncsort extract date before two months
Reply with quote

Hi Arun,

PFB the input output details:

Input: 08/05/2010
08/08/2010
10/05/2010
08/18/2010
09/18/2010
08/19/2010

Processing shud be: (input date {mm/dd/yyyy}) - (current date (10/18/2010){mm/dd/yyyy} >= 30 days OR 2 months

Output: 08/05/2010
08/08/2010
08/18/2010
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Tue Oct 19, 2010 9:36 pm    Post subject:
Reply with quote

Hello Seema.

Here is an example of a SyncSort for z/OS job that should help you:
Code:
//SORT1 EXEC PGM=SORT                                       
//SORTIN  DD *                                             
08/06/2010                                                 
08/09/2010                                                 
10/06/2010                                                 
08/19/2010                                                 
09/19/2010                                                 
08/20/2010                                                 
//SORTOUT DD SYSOUT=*                                       
//SYSOUT  DD SYSOUT=*                                       
//SYSIN   DD * 
 SORT FIELDS=COPY                                           
 OUTREC IFTHEN=(WHEN=INIT,                               
        OVERLAY=(20:7,4,1,2,4,2,40:&DATENS=(4MD))),       
        IFTHEN=(WHEN=(44,2,CH,EQ,C'01'),                 
        OVERLAY=(44:C'11',40:40,4,ZD,SUB,+1,EDIT=(TTTT))),
        IFTHEN=(WHEN=(44,2,CH,EQ,C'02'),                 
        OVERLAY=(44:C'12',40:40,4,ZD,SUB,+1,EDIT=(TTTT))),
        IFTHEN=(WHEN=NONE,                               
        OVERLAY=(44:44,2,ZD,SUB,+2,EDIT=(TT)))
 OUTFIL INCLUDE=(20,8,ZD,LE,40,8,ZD),BUILD=(1,10)         
/*     

Here is the output produced by the step above:
Code:
08/06/2010
08/09/2010
08/19/2010

Please let us know if you have any further questions.

Regards,
Back to top
View user's profile Send private message
seema_285

New User


Joined: 14 Oct 2010
Posts: 13
Location: pune

PostPosted: Wed Oct 20, 2010 5:21 pm    Post subject:
Reply with quote

Thanks Alissa.

This has worked.. icon_smile.gif

But my question is that Can we do the same with in built date functions in sort like &DATE,&DATE1 or &DATE2 ?

Please let me know if you could help me on this.

Thanking you in anticipation.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Wed Oct 20, 2010 7:50 pm    Post subject:
Reply with quote

Seema,

I don't understand your question. Can you please provide an example?

Thanks,
Back to top
View user's profile Send private message
seema_285

New User


Joined: 14 Oct 2010
Posts: 13
Location: pune

PostPosted: Thu Oct 21, 2010 5:21 pm    Post subject:
Reply with quote

Alissa,

Can we rewrite the same sort card with the help of &date or &date paramenters in SYNCSORT....
e.g.
SORT FIELDS=COPY
OUTFIL OUTREC=(01,10,ZD,LT,&DATE2P(MD4/)-2)
OUTFIL OUTREC=(01,10,ZD,GT,&DATE2P(MD4/)-2)

I tried but did not get the results.

Let me know if you could throw some light on it.

Thanks.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Thu Oct 21, 2010 9:34 pm    Post subject:
Reply with quote

You need to reformat your input date field for the comparison. You can code something like this for 60 days:
Code:
//SYSIN   DD *                                       
  SORT FIELDS=COPY                                   
  OUTREC OVERLAY=(12:7,4,1,2,4,2)                   
  OUTFIL INCLUDE=(12,7,CH,LT,&DATE1-60),OUTREC=(1,10)
/*       
Back to top
View user's profile Send private message
seema_285

New User


Joined: 14 Oct 2010
Posts: 13
Location: pune

PostPosted: Fri Oct 22, 2010 5:32 pm    Post subject: Reply to: Syncsort extract date before two months of current
Reply with quote

Thank you so much Alissa... icon_smile.gif
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 Spool Extract for Z /os 1.04 version Khadhar Basha CLIST & REXX 3 Thu Sep 28, 2017 3:14 pm
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am

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