Hi All,
I need to populate the 1st date of previous month in the header section of my output file.
The job is scheduled to run on first friday of every month.
Example, today's date is 23rd April 2017.
The date in header needs to be 1st March 2017 (20170301 - CCYYMMDD)
I have taken two different approaches to overcome this, however not able to achieve desired results:
1. Subtracting 30 days from &DATENS in HEADER1, below sort card:
- This gives me the required Year and Month i.e. previous.
- However the date needs to be the 1st.
- As date of job execution varies, cannot subtract a precise count from date.
- In case I try to overlap the date in header with '01' is gives an error.
Thank you Arun for sharing your approach.
Using the above sort card the required date is populated in the Header section of output file.
However the OVERLAY function populates the required date on the 81st position of all the detail records read from INPUT file.
Any method to populate required date in header section without altering the detail records from input.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
It is only required in that position prior to you using it. Once you have used it, it is no longer required, so you get rid of it. BUILD=(1,80) or IFOUTLEN=80 (if you have at least one IFTHEN already).
I'd go with John Del's suggestion. Both solutions work.