View previous topic :: View next topic
|
Author |
Message |
chillmo
New User
Joined: 31 Aug 2017 Posts: 39 Location: USA
|
|
|
|
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! |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1341 Location: Bamberg, Germany
|
|
|
|
Code: |
OUTREC OVERLAY=(5:DATE1,5:5,8,Y4T,LASTDAYM,TOGREG=Y4T(-),15:TIME2(:)) |
Output:
Code: |
****** ********************
000001 2020-12-3118:37
****** ******************** |
|
|
Back to top |
|
|
chillmo
New User
Joined: 31 Aug 2017 Posts: 39 Location: USA
|
|
|
|
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 |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1341 Location: Bamberg, Germany
|
|
|
|
This will do:
Code: |
OPTION COPY
OUTREC OVERLAY=(1:DATE1,1:1,8,Y4T,SUBDAYS,7,2,ZD,TOGREG=Y4T(-),
TIME2(:)) |
|
|
Back to top |
|
|
chillmo
New User
Joined: 31 Aug 2017 Posts: 39 Location: USA
|
|
|
|
Joerg.Findeisen, you're the best!
Thanks!
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 |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1341 Location: Bamberg, Germany
|
|
|
|
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 |
|
|
|
|