IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Last day of the month via SYNCSORT.


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
chillmo

New User


Joined: 31 Aug 2017
Posts: 18
Location: USA

PostPosted: Sat Dec 12, 2020 9:24 pm
Reply with quote

Is it feasible to insert the last day of the month in the output file?

Code:

//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1:4X,5:&DATE1,5,8,Y4T,LASTDAYM,TOGREG=Y4T(-),15:&TIME2(:))
/*


I received the error overlapping fields, but I need the date in position 5 and would like to accomplish this, if possible, in one pass thru.

Any assistance would be greatly appreciated! icon_biggrin.gif icon_smile.gif
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 394
Location: Bamberg, Germany

PostPosted: Sat Dec 12, 2020 11:08 pm
Reply with quote

Code:
OUTREC OVERLAY=(5:DATE1,5:5,8,Y4T,LASTDAYM,TOGREG=Y4T(-),15:TIME2(:))

Output:
Code:
****** ********************
000001     2020-12-3118:37
****** ********************
Back to top
View user's profile Send private message
chillmo

New User


Joined: 31 Aug 2017
Posts: 18
Location: USA

PostPosted: Sun Dec 13, 2020 12:38 am
Reply with quote

Thanks, Joerg.Findeisen!

Is it possible to get the last day for the previous month as well? I tried to subtract 1 but it did days, so I changed to DATE2 and it didn't work.

Code:

5:DATE2-1,5:5,6,Y4T,LASTDAYM,TOGREG=Y4T(-),
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 394
Location: Bamberg, Germany

PostPosted: Sun Dec 13, 2020 4:44 am
Reply with quote

This will do:
Code:
OPTION COPY                                                   
OUTREC OVERLAY=(1:DATE1,1:1,8,Y4T,SUBDAYS,7,2,ZD,TOGREG=Y4T(-),
                TIME2(:))
Back to top
View user's profile Send private message
chillmo

New User


Joined: 31 Aug 2017
Posts: 18
Location: USA

PostPosted: Sun Dec 13, 2020 5:22 am
Reply with quote

Joerg.Findeisen, you're the best!

Thanks! icon_biggrin.gif icon_biggrin.gif icon_biggrin.gif icon_biggrin.gif icon_biggrin.gif icon_biggrin.gif icon_biggrin.gif

Also, I found out that this works as well (in case the business wants different month end dates).
Code:

OPTION COPY
OUTREC OVERLAY=(1:DATE2-2,C'01',1:1,8,Y4T,LASTDAYM,TOGREG=Y4T(-),TIME2(:))
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 394
Location: Bamberg, Germany

PostPosted: Sun Dec 13, 2020 1:33 pm
Reply with quote

I would have used the following code snippet for different months back or forth:
Code:
OPTION COPY                                               
OUTREC OVERLAY=(1:DATE1,1:1,8,Y4T,SUBMONS,+2,TOGREG=Y4T, 
                1:1,8,Y4T,LASTDAYM,TOGREG=Y4T(-),TIME2(:))
END
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Numeric check w/SyncSort. SYNCSORT 1
No new posts SYNCSORT Error - CONTROL FIELD BEYOND... SYNCSORT 10
No new posts Populating Date and Sequence numer in... SYNCSORT 11
No new posts Insert System Runtime in HEADER In SY... SYNCSORT 9
No new posts SYNCSORT in Z/VSE SYNCSORT 24
Search our Forums:

Back to Top