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
 

 

JCL SORT - Subtract 2 Months from Current Date

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
srinathds83

New User


Joined: 17 Jul 2007
Posts: 41
Location: pune

PostPosted: Mon May 12, 2014 12:57 pm    Post subject: JCL SORT - Subtract 2 Months from Current Date
Reply with quote

Hi,

I have requirement to subtract the two months from Current Date and print it in YYMMDD format.

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

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon May 12, 2014 1:21 pm    Post subject: Reply to: JCL SORT - Subtract 2 Months from Current Date
Reply with quote

Quote:
I have requirement to subtract the two months from Current Date and print it in YYMMDD format.


did anybody consider what should happen when the current date will be APRIL, 30

usually this kind of task is carried on by the DATE handling function/subroutines normally available in any decent organization
( such functions are usually tailored to the business/legal standards/rules in place )
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1713
Location: UK

PostPosted: Mon May 12, 2014 1:46 pm    Post subject: Reply to: JCL SORT - Subtract 2 Months from Current Date
Reply with quote

Is it safe to assume that you are using Syncsort?
Back to top
View user's profile Send private message
srinathds83

New User


Joined: 17 Jul 2007
Posts: 41
Location: pune

PostPosted: Mon May 12, 2014 2:02 pm    Post subject: Re: Reply to: JCL SORT - Subtract 2 Months from Current Date
Reply with quote

Nic Clouston wrote:
Is it safe to assume that you are using Syncsort?


Yes we are using the Syncsort Utility only.
Back to top
View user's profile Send private message
srinathds83

New User


Joined: 17 Jul 2007
Posts: 41
Location: pune

PostPosted: Mon May 12, 2014 2:52 pm    Post subject: Reply to: JCL SORT - Subtract 2 Months from Current Date
Reply with quote

Hi,

Below sort card works with the number of Days.
Code:

//SYSIN DD *                                   
   OPTION COPY                                 
   INCLUDE COND=(1,6,Y2T,EQ,Y'DATE1'-61)       
/*                                             


But i want to subtract 2 months directly. Above sort card is not correct for the Feb Month calculation and for July and August calculation.

I am looking for solution where it can take leap year in to account as well during month subtraction.

Thanks
Sri
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon May 12, 2014 3:05 pm    Post subject: Reply to: JCL SORT - Subtract 2 Months from Current Date
Reply with quote

where are You facing problems ?
the algorithm/logic
the coding
Back to top
View user's profile Send private message
srinathds83

New User


Joined: 17 Jul 2007
Posts: 41
Location: pune

PostPosted: Tue May 13, 2014 10:20 am    Post subject: Reply to: JCL SORT - Subtract 2 Months from Current Date
Reply with quote

Hi,

I was trying to use SUBMONS but it can't be used with Y'DATE1'. Can anyone help me to subtract the Months directly from the current date.

Code:

//SYSIN DD *                                   
   OPTION COPY                                 
   INCLUDE COND=(1,6,Y2T,EQ,Y'DATE1'-61)       
/*                                     


As Above card subtract the number of days but that is not the smarter way as i have to subtract two months. suppose it is 1st april then the number of days should be subtracted 59 or 60(if leap year).

Can anyone provide the solution where sort manages own its own and subtract the exact 2 months from Current date.

Thanks.
Sri
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Tue May 13, 2014 12:03 pm    Post subject: Reply to: JCL SORT - Subtract 2 Months from Current Date
Reply with quote

Does your SORT product allow you Julian to Gregorian conversion? If so, convert it (which auto-magically know about leap-years) and then just test on the month.
Back to top
View user's profile Send private message
srinathds83

New User


Joined: 17 Jul 2007
Posts: 41
Location: pune

PostPosted: Tue May 13, 2014 2:29 pm    Post subject: Re: Reply to: JCL SORT - Subtract 2 Months from Current Date
Reply with quote

Bill Woodger wrote:
Does your SORT product allow you Julian to Gregorian conversion? If so, convert it (which auto-magically know about leap-years) and then just test on the month.


i want the Current date in YYMMDD format from which i have to deduct 2 months and then compare it with my Input date field in file (which is also in YYMMDD) format.
Back to top
View user's profile Send private message
srinathds83

New User


Joined: 17 Jul 2007
Posts: 41
Location: pune

PostPosted: Tue May 13, 2014 3:47 pm    Post subject: Reply to: JCL SORT - Subtract 2 Months from Current Date
Reply with quote

Hi,

I tried using the below sort card where i am trying to subtract from date in file.

Code:

SYSIN :                                         
   OPTION COPY                                 
   OUTREC BUILD=(1,8,Y4T,SUBMONS,+3,TOGREG=Y4T)
                     *                         
WER161B  ALTERNATE PARM USED                   
WER268A  OUTREC STATEMENT  : SYNTAX ERROR       
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000   


Could anyone help on this. If this work then i can try to subtract it from current date instead of using the date from input file.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Tue May 13, 2014 4:11 pm    Post subject: Reply to: JCL SORT - Subtract 2 Months from Current Date
Reply with quote

Can you paste from your SyncSort documentation where SUBMONS is supported?
Back to top
View user's profile Send private message
srinathds83

New User


Joined: 17 Jul 2007
Posts: 41
Location: pune

PostPosted: Tue May 13, 2014 5:26 pm    Post subject: Re: Reply to: JCL SORT - Subtract 2 Months from Current Date
Reply with quote

Bill Woodger wrote:
Can you paste from your SyncSort documentation where SUBMONS is supported?


Below is the refrence i took it from the IBM Site:

SUBDAYS, SUBMONS or SUBYEARS can be used to subtract days,
months or years from a date field. As a simple example, you could use the
following to subtract 3 months from a P'dddyy' date and produce the
resulting P'ccyyddd' date:
OUTREC BUILD=(1,8,Y4T,SUBMONS,+3,TOGREG=Y4T)

Site suggests that it will work whereas i am getting syntax error for same sort card.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue May 13, 2014 5:42 pm    Post subject: Reply to: JCL SORT - Subtract 2 Months from Current Date
Reply with quote

Quote:
Yes we are using the Syncsort Utility only.


Quote:
Below is the refrence i took it from the IBM Site:
...
...
...


Code:
WER161B  ALTERNATE PARM USED   


since You are using SYNCSORT You should read SYNCSORT manuals not the DFSORT manuals.
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 -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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