View previous topic :: View next topic
|
Author |
Message |
rnimmala
New User
Joined: 08 Nov 2019 Posts: 10 Location: INDIA
|
|
|
|
Hi All,
We are using SYNCSORT and ADDMONS function is not working if term(months) is 12 and result falls in leap year. But it is working fine if months(term) is 1 to 11 months.
e.g 20190331 + 11= 20200229 (as expected).
20190228+ 12 = 20200228 ( expecting 29)
20180228+24 = 20200228 (expecting 29)
20180331 +23 = 20200229 (as expected)
Please help me to fix the issue. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2019 Location: USA
|
|
|
|
rnimmala wrote: |
Hi All,
We are using SYNCSORT and ADDMONS function is not working if term(months) is 12 and result falls in leap year. But it is working fine if months(term) is 1 to 11 months.
e.g 20190331 + 11= 20200229 (as expected).
20190228+ 12 = 20200228 ( expecting 29)
20180228+24 = 20200228 (expecting 29)
20180331 +23 = 20200229 (as expected)
Please help me to fix the issue. |
It is successfully working for anyone except yourself...
Any source code, please!!!! |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Have you contacted the vendor? If not, get started contacting them! It is their product, and if you think it is not working correctly, they need to know that. |
|
Back to top |
|
|
rnimmala
New User
Joined: 08 Nov 2019 Posts: 10 Location: INDIA
|
|
|
|
Apologies if I am wrong.I have posted this after testing.will provide source code on Monday. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Interesting problem, I too get the same error as TS with below JCL
Code: |
//SORT EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=WELLS.SORTIN
//SORTOUT DD DISP=OLD,DSN=WELLS.SORTOUT
//SYSIN DD *
SORT FIELDS=COPY
INREC BUILD=(1,8,Y4T,ADDMONS,+12,TOGREG=Y4T)
/* |
Input:
20190228
Output:
20200228
We are on Syncsort/MFX 2.1 - TPF 6.
Syncsort support would be able to help you with it. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hi sergeyken, what version of Syncsort are you on?
Knowing that would let us know, if it has been fixed in a later release. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2019 Location: USA
|
|
|
|
20190228 + 12 month = 20200228
This is absolutely correct!
Exactly as it is
20190201 + 12 month = 20200201
20190210 + 12 month = 20200210
20190330 + 12 month = 20200330
To get 20200229 you would need to apply extra function, like this example
Code: |
//*==========================================================
//SORT EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
20190228
20190201
20190210
20190330
20190331
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,
BUILD=(1,8,
X,1,8,Y4T,ADDMONS,+12,TOGREG=Y4T)),
IFTHEN=(WHEN=INIT,
OVERLAY=(19:10,8,Y4T,LASTDAYM,TOGREG=Y4T))
//*========================================================== |
Code: |
********************************* TOP OF DATA *******
20190228 20200228 20200229
20190201 20200201 20200229
20190210 20200210 20200229
20190330 20200330 20200331
20190331 20200331 20200331
******************************** BOTTOM OF DATA ***** |
|
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2019 Location: USA
|
|
|
|
P.S.
ADDMONS doesn't need to touch the DAY-part at all, whatever it was. It may either verify the date correctness, or not - but it cannot affect the way of adding pure months.
It only converts "long month day" to "short month day", and reduces the excessive day number for any short month. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Now it makes sense, The function need not necessarily generate the last day of the month. Thank you. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
This looks to a bug and should be reported to SYNCSORT.
If you try to add it in the same year ( of the leap year) then it works but when it is other than the leap year and when ADDMONS falls into leap year it don't work.
If you refer the manual it is clearly stated it will consider leap year when ADDMONS or SUBMONS used with an example.
Code: |
//*
//SORT EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
20200131
//SORTOUT DD SYSOUT=*
//SORTLIST DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,
BUILD=(1,8,
X,1,8,Y4T,ADDMONS,+1,TOGREG=Y4T)),
IFTHEN=(WHEN=INIT,
OVERLAY=(19:10,8,Y4T,LASTDAYM,TOGREG=Y4T)) |
output
Code: |
20200131 20200229 20200229 |
SYNCSORT Documentation ( May not be the latest one). Refer page# 201 |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2019 Location: USA
|
|
|
|
Do you plan to calculate
20190228 + 1month = 20190331 ?
20190228 + 13month = 20200331 ???
This is nonsense... |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
Your are free to try and convince yourself and create your own manual and discard what Syncsort has to say about their products. |
|
Back to top |
|
|
rnimmala
New User
Joined: 08 Nov 2019 Posts: 10 Location: INDIA
|
|
|
|
HI,
All I am saying A⁸DDMONS has issue with12months.My requirement is set the month end date. E.g if I add 1 month 20200131 the function returns me 20200229..so function works perfectly for 01 to 11 months |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
You need to discuss that with Syncsort and give them a chance to help on that and meanwhile use LASTDAYM when it is 12 M. The manual that I shared say's it will consider Leap year but unfortunately it don't when its ONLY and ONLY 12 months. Lesser or greater than 12 will work correctly.
You can send an email to support@syncsort.com. |
|
Back to top |
|
|
rnimmala
New User
Joined: 08 Nov 2019 Posts: 10 Location: INDIA
|
|
|
|
Hi,
I don't know whom to contact from Syncsort team.Before opening this post I have written email to Alissa if it known issue then I can use LASYDAYM.I am waiting for the response. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
My requirement is set the month end date |
unfortunately then, ADDMONS is not the way ...
the change in the day part will occur only when the source day is greater that the number of days in the destination month ,
in which case the day will be the last day of the destination month |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2019 Location: USA
|
|
|
|
After reading the manual, and applying some common sense, it’s getting clear that:
20200131 + 1month = 20200229
20200129 + 1month = 20200229
20200128 + 1month = 20200228
20190131 + 1month = 20190228
20190129 + 1month = 20190228
20190128 + 1month = 20190228
20190127 + 1month = 20190227
20190131 + 13month = 20200229
20190128 + 13month = 20200228
20190228 + 12month = 20200228
Etc.
Just apply common sense... |
|
Back to top |
|
|
rnimmala
New User
Joined: 08 Nov 2019 Posts: 10 Location: INDIA
|
|
|
|
I am decided go with LASTDAYM after adding the term.Thank you all for your help. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2019 Location: USA
|
|
|
|
Rohit Umarjikar wrote: |
Your are free to try and convince yourself and create your own manual and discard what Syncsort has to say about their products. |
I have carefully re-read the manual. There is nothing about adding extra day after adding any months. Only short months are truncated to the last day of that month!!!
Again: try to apply common sense. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2019 Location: USA
|
|
|
|
rnimmala wrote: |
HI,
All I am saying A⁸DDMONS has issue with12months.My requirement is set the month end date. E.g if I add 1 month 20200131 the function returns me 20200229..so function works perfectly for 01 to 11 months |
Try this:
20200128 + 1month = 20200228, but not 20200229 |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2019 Location: USA
|
|
|
|
Right now I don’t have access to the system, but I suppose that maybe
20190228 + 1year = 20200229 ?
Try this, please... |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
20190228 + 1year = 20200229 ? |
NOPE ...
20200228 is a valid date, no reason to adjust anything
but on the other side
20200229 + 12 months ==> 20210228
as You already pointed out
time to lock the topic ... |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
sergeyken wrote: |
Rohit Umarjikar wrote: |
Your are free to try and convince yourself and create your own manual and discard what Syncsort has to say about their products. |
I have carefully re-read the manual. There is nothing about adding extra day after adding any months. Only short months are truncated to the last day of that month!!!
Again: try to apply common sense. |
They mentioned about Leap year handled in these functions and you keep adding exceptions to that and calling it as Common Sense, Good Luck with that Common Sense.. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2019 Location: USA
|
|
|
|
Rohit Umarjikar wrote: |
sergeyken wrote: |
Rohit Umarjikar wrote: |
Your are free to try and convince yourself and create your own manual and discard what Syncsort has to say about their products. |
I have carefully re-read the manual. There is nothing about adding extra day after adding any months. Only short months are truncated to the last day of that month!!!
Again: try to apply common sense. |
They mentioned about Leap year handled in these functions and you keep adding exceptions to that and calling it as Common Sense, Good Luck with that Common Sense.. |
Please, read the manual carefully.
Good luck to you as well. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2019 Location: USA
|
|
|
|
BTW, according to both the utility manual, and common sense:
20190228 + 1month = 20190328, but not 20190331
20200228 + 1month = 20200328
20200229 + 1month = 20200329
20200430 + 1month = 20200530, but not 20200531
Etc. etc. etc.
It’s all absolutely clear, and logical. |
|
Back to top |
|
|
|