Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
ADDMONS function
Goto page 1, 2  Next
 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
rnimmala

New User


Joined: 08 Nov 2019
Posts: 5
Location: INDIA

PostPosted: Fri Nov 08, 2019 8:55 pm    Post subject: ADDMONS function
Reply with quote

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
View user's profile Send private message

sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 603
Location: Maryland

PostPosted: Fri Nov 08, 2019 9:23 pm    Post subject: Re: ADDMONS function
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8496
Location: Dubuque, Iowa, USA

PostPosted: Fri Nov 08, 2019 9:29 pm    Post subject: Reply to: ADDMONS function
Reply with quote

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
View user's profile Send private message
rnimmala

New User


Joined: 08 Nov 2019
Posts: 5
Location: INDIA

PostPosted: Fri Nov 08, 2019 9:34 pm    Post subject: Reply to: ADDMONS function
Reply with quote

Apologies if I am wrong.I have posted this after testing.will provide source code on Monday.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1656
Location: Tirupur

PostPosted: Fri Nov 08, 2019 9:39 pm    Post subject:
Reply with quote

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
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1656
Location: Tirupur

PostPosted: Fri Nov 08, 2019 9:46 pm    Post subject:
Reply with quote

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
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 603
Location: Maryland

PostPosted: Fri Nov 08, 2019 10:17 pm    Post subject:
Reply with quote

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
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 603
Location: Maryland

PostPosted: Fri Nov 08, 2019 10:30 pm    Post subject:
Reply with quote

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
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1656
Location: Tirupur

PostPosted: Fri Nov 08, 2019 10:38 pm    Post subject:
Reply with quote

Now it makes sense, The function need not necessarily generate the last day of the month. Thank you.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2296
Location: NY,USA

PostPosted: Sat Nov 09, 2019 12:41 am    Post subject:
Reply with quote

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
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 603
Location: Maryland

PostPosted: Sat Nov 09, 2019 7:05 pm    Post subject:
Reply with quote

Do you plan to calculate
20190228 + 1month = 20190331 ?
20190228 + 13month = 20200331 ???

This is nonsense...
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2296
Location: NY,USA

PostPosted: Sat Nov 09, 2019 7:12 pm    Post subject:
Reply with quote

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
View user's profile Send private message
rnimmala

New User


Joined: 08 Nov 2019
Posts: 5
Location: INDIA

PostPosted: Sat Nov 09, 2019 7:20 pm    Post subject: Reply to: ADDMONS function
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2296
Location: NY,USA

PostPosted: Sat Nov 09, 2019 7:25 pm    Post subject:
Reply with quote

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
View user's profile Send private message
rnimmala

New User


Joined: 08 Nov 2019
Posts: 5
Location: INDIA

PostPosted: Sat Nov 09, 2019 7:28 pm    Post subject:
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10631
Location: italy

PostPosted: Sat Nov 09, 2019 7:28 pm    Post subject: Reply to: ADDMONS function
Reply with quote

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
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 603
Location: Maryland

PostPosted: Sat Nov 09, 2019 8:02 pm    Post subject:
Reply with quote

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
View user's profile Send private message
rnimmala

New User


Joined: 08 Nov 2019
Posts: 5
Location: INDIA

PostPosted: Sat Nov 09, 2019 8:09 pm    Post subject:
Reply with quote

I am decided go with LASTDAYM after adding the term.Thank you all for your help.
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 603
Location: Maryland

PostPosted: Sat Nov 09, 2019 8:15 pm    Post subject:
Reply with quote

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
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 603
Location: Maryland

PostPosted: Sat Nov 09, 2019 8:21 pm    Post subject: Re: Reply to: ADDMONS function
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Call DB2 user defined function from C... Ziko13 DB2 5 Thu Mar 14, 2019 4:46 pm
No new posts IEFSJREQ or SWBREQTU following SSI Fu... sidinpsl PL/I & Assembler 0 Tue Jan 08, 2019 1:20 am
No new posts What is the Extract Function in JCL dharmaraok JCL & VSAM 3 Wed Jun 14, 2017 9:12 am
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am

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