Page 1 of 2

Previous month in header

PostPosted: Tue May 13, 2014 4:02 pm
by shankar_dh
Hi,

Generating report using DFSORT.
How to get the previous month in the format MM/YYYY in the HEADER.
I tried below code but its not working.
HEADER1=(1:C'PREVIOUS MONTH',DATE2(/)-1)

Re: Previous month in header

PostPosted: Tue May 13, 2014 4:23 pm
by Aki88
Hello,

Have a look at this page; this might help you; it has a DFSORT solution shared by Kolusu:

http://ibmmainframes.com/about58606.html

Re: Previous month in header

PostPosted: Tue May 13, 2014 6:10 pm
by shankar_dh
Thanks Aki88 for your reply..Given link has 2 steps..
Can't we directly use DATE2(/)-1 in the HEADER?
Can anybody explain ?

Re: Previous month in header

PostPosted: Tue May 13, 2014 7:24 pm
by Aki88
Hello,

If I have it correctly figured out, then no, we can not have DATE2 in HEADER1 (though an expert opinion would help here); you can use (DATE2-1) with OUTREC and write it conditionally; that should do as good a job as writing a HEADER1.

Re: Previous month in header

PostPosted: Tue May 13, 2014 8:43 pm
by BillyBoyo
shankar_dh

There is good documentation of HEADER1 which I suggest you locate and read.

You cannot invent your own syntax. Read what HEADER1 can do, and you'll know what you can do with HEADER1.

Now, what do you mean by "HEADER"? There is no "HEADER" function in DFSORT. Perhaps tell us what it is you are trying to do, rather than following the route you have chosen and refusing to turn back?

Re: Previous month in header

PostPosted: Wed May 14, 2014 11:40 am
by shankar_dh
Hi BillyBoyo..
Thanks for your kind reply and suggestion.
I meant HEADER1.
I am not refusing to turn back rather I am in a situation where I have chosen DFSORT to build the report and I have already built the report and Now I got the requirement to add the previous month field like 04/2014 in my report header.
As I already have HEADER1 statement in my SORT card so I thought of adding my new requirement field in the HEADER1.

Re: Previous month in header

PostPosted: Wed May 14, 2014 11:48 am
by BillyBoyo
OK, let's be a bit more explicit. Is your report working when there are 70 records? Are you using HEADER2?

Re: Previous month in header

PostPosted: Wed May 14, 2014 4:18 pm
by shankar_dh
I am not using HEADER2.
I have not talked about 70 records..80 records...etc..anywhere else...
My requirement is straight forward..
I need to add 2 fields in my report header
Current month & previous month..
if you use &DATE - I will get current month (its in DD/MM/YYYY format but I need it in MM/YYYY format)
Below is the sample of my report layout

***REPORT XYZ ****
CURRENT MONTH : 05/2014 PREVIOUS MONTH : 04/2014

Re: Previous month in header

PostPosted: Wed May 14, 2014 4:25 pm
by BillyBoyo
Use HEADER2.

Until you can show that you understand the difference between HEADER1 and HEADER2, that's my last on this topic.

Re: Previous month in header

PostPosted: Wed May 14, 2014 8:08 pm
by shankar_dh
Hi,

I understand the difference between HEADER1 (Report Header ) HEADER2 (Page Header)
But my issue is, I have needed the function in DFSORT which pulls system current month & previous month in the format MM/YYYY.