Quantcast
Channel: IBM Mainframe Computers Forums
Viewing all articles
Browse latest Browse all 8500

DFSORT/ICETOOL :: Alter &DATENS field in HEADER1

$
0
0
Author: Angad
Subject: Alter &DATENS field in HEADER1
Posted: Mon Apr 24, 2017 11:49 am (GMT 5.5)

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:

SORT FIELDS=COPY
OUTFIL HEADER1=('H',1' ',&DATENS=(4MD)-30)

- 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.

2. Using SYMNAMES with SORT:

//SYMNAMES DD *
MDT,S'&YR4.&LMON'

SORT FIELDS=COPY
OUTFIL HEADER1=('H',1' ',MDT,'01')

- This gives me the required Year and date.
- However the current month is populated.
- No subtraction can be performed here in SORT card.

Kindly share in case desired results can be achieved using any of the above method.
Any new approach is also welcome.


Viewing all articles
Browse latest Browse all 8500

Trending Articles