Page 1 of 2

How to include Year in Header1

PostPosted: Wed Aug 29, 2012 2:48 pm
by ankushgattani
I need to include Current year (only year, not complete date) in the header1 of my output file.
all the functions specified in the manual include DATE or MONTH also in the output.
i need only the year (ex : 2012).

Currently i am doing it like this to generate the header record alone

  OPTION COPY                                                           
  OUTFIL FNAMES=RPTHDR,                                                 
  OVERLAY=(&DATE2,5:2X)           


i generate rest of the report in another sort, then combine both the SORT output using IEBGENER.

How can i achieve it using one SORT step only.

Re: How to include Year in Header1

PostPosted: Wed Aug 29, 2012 3:30 pm
by NicC
Please do not double post. Are you using DFSORT or SYNCSORT? Just look at the messages from the sort product - not at which program you executed as this is often SORT which is aliased to the real program name.

Re: How to include Year in Header1

PostPosted: Wed Aug 29, 2012 3:34 pm
by ankushgattani
I am sorry, just checked the spool. I am using SyncSort.

Re: How to include Year in Header1

PostPosted: Wed Aug 29, 2012 5:02 pm
by BillyBoyo
Well, in DFSORT you can specify a coulmun: in HEADER1. Can you do that with Syncsort? Then do as you've done above.

Re: How to include Year in Header1

PostPosted: Wed Aug 29, 2012 5:25 pm
by ankushgattani
Already tried it. We cant use OVERLAY for HEADER1. It gives a Syntax error.
In my logic, i am overlapping the last two digits of YYYYDD by SPACES.Overlapping is not possible in HEDAER1 or OUTREC or BUILD.
So for my logic OVERLAY is a must, which sadly is not an option with HEADER1.

Re: How to include Year in Header1

PostPosted: Wed Aug 29, 2012 5:54 pm
by BillyBoyo
Can you show what you have tried, please?

Re: How to include Year in Header1

PostPosted: Thu Aug 30, 2012 3:24 pm
by ankushgattani
This is what i tried

//JS20    EXEC PGM=SORT                         
//SYSOUT    DD SYSOUT=*                         
//SYSPRINT  DD SYSOUT=*                         
//SORTMSG   DD SYSOUT=*                         
//SORTIN    DD DSN=TEST.SORT.OUT.RPT,DISP=SHR   
//RPT       DD DSN=TEST.SORT.OUT.RPT323B,       
//             SPACE=(CYL,(1,1),RLSE),           
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=0),
//             DISP=(NEW,CATLG,DELETE)           
//SYSIN DD *                                     
  OPTION COPY                                   
  OUTFIL FNAMES=RPT,                             
  HEADER1 OVERLAY=(DATE,5:2X)                   
/*                                               



It gives me Syntax error. Following is the Snapshot of the spool error
SYSIN :                                         
  OPTION COPY                                   
  OUTFIL FNAMES=RPT,                             
  HEADER1 OVERLAY=(DATE,5:2X)                   
         *                                       
WER268A  OUTFIL STATEMENT  : SYNTAX ERROR       
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000   

Re: How to include Year in Header1

PostPosted: Thu Aug 30, 2012 3:45 pm
by BillyBoyo
can you try?
  HEADER1=(DATE,5:2X)   

Re: How to include Year in Header1

PostPosted: Thu Aug 30, 2012 5:20 pm
by ankushgattani
I tried the code, getting the following error:

 WER118A  RPT      ILLEGAL OVERLAPPING FIELDS

Re: How to include Year in Header1

PostPosted: Thu Aug 30, 2012 5:33 pm
by BillyBoyo
OK. I was sort of worried you may get that result :-)

The HEADER1 is allowing columns (the : bit) but it is, unlike OVERLAY, not allowing them to be used to overwrite existing data - which, on a heading line, is much more often than not, what you want.

If you look at your manual, it will explain this to you.

Look at samples in the manual of using HEADER1.

It may be that you cannot do what you want.

I don't have time to do any research today, so you'll have to: can you get anything from a record into HEADER1?