Page 1 of 1

Use of TIME2 on header/trailer

PostPosted: Mon Sep 29, 2014 7:55 pm
by tony2nd
Hello,

I need to create this file with the time on the header and trailer as HHMM; it seems TIME2 is not allowed on HEADER1/TRAILER1 so I made it work with TIMENS. How can I remove the seconds (SS)?
Also, is 100:C' ' on OUTREC and TRAILER1 the correct way to set the output file to length 100?
//STEP03   EXEC PGM=ICEMAN,COND=(0,NE)   
//SORTIN   DD  *                         
 0000000000001 001                       
 0000000000002 002                       
 0000000000003 001                       
 0000000000005 001                       
//SORTOUT  DD  SYSOUT=*                   
//SYSOUT   DD  SYSOUT=*                   
//SYSOU0   DD  SYSOUT=*                   
//SYSPRINT DD  SYSOUT=*                   
//SYSUDUMP DD  SYSOUT=*                   
//SYSIN    DD  *                         
  SORT FIELDS=(016,003,CH,A,002,013,CH,A)
  OUTFIL REMOVECC,                       
  HEADER1=(001:C'HEADER',                 
           010:DATENS=(4MD),             
           018:TIMENS=(24),               
           025:C'SOME HEADER HERE'),     
  OUTREC=(001:C'D11',                     
          004:016,003,                   
          007:C'01',                   
          009:C'00000',               
          014:002,013,                 
          027:C'9999',                 
          031:C'00000000000000001',   
          048:DATENS=(4MD),           
          100:C' '),                   
  TRAILER1=(001:C'TRAILER',           
            010:DATENS=(4MD),         
            018:TIMENS=(24),           
            025:COUNT=(TO=ZD,LENGTH=6),
            100:C' ')                 
//                                     


Results:
HEADER   20140929101031 SOME HEADER HERE               
D110010100000000000000000199990000000000000000120140929
D110010100000000000000000399990000000000000000120140929
D110010100000000000000000599990000000000000000120140929
D110020100000000000000000299990000000000000000120140929
TRAILER  20140929101031 000004                         


Thank you,
Tony

Re: Use of TIME2 on header/trailer

PostPosted: Mon Sep 29, 2014 9:11 pm
by BillyBoyo
Try to prefer OUTFIL BUILD not OUTFIL OUTREC. I don't think I need to explain that two completely different OUTRECs is confusing. So avoid the confusion. It exists for backwards-compatability.

100:X would often be used instead of 100:C' ' - . Another way, if you have used an IFTHEN, is to use IFOUTLEN=100.

If you have to amend things on TRAILERn, it is tricky. Easiest is to not to, and go with the flow. If that is not possible, you need to get data from the last record before the trailer, at start-position,4.

Re: Use of TIME2 on header/trailer

PostPosted: Tue Sep 30, 2014 12:38 am
by tony2nd
I was able to remove the seconds with an extra step:
//SYSIN    DD *                             
  SORT FIELDS=COPY                           
  OUTFIL IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),
          BUILD=(1,21,C'  ',24,76)),         
         IFTHEN=(WHEN=(1,7,CH,EQ,C'TRAILER'),
          BUILD=(1,21,C'  ',24,76))         


Does anyone have any other options?

Re: Use of TIME2 on header/trailer

PostPosted: Wed Oct 01, 2014 3:20 am
by BillyBoyo
To avoid the second step, this is what I was mentioning earlier:

  INREC OVERLAY=(101:TIMENS=(24))
  OUTFIL REMOVECC,
         HEADER1=(001:C'HEADER',
                  010:DATENS=(4MD),
                  018:TIMENS=(24),
                  025:C'SOME HEADER HERE'),
         BUILD=(1,100),
         TRAILER1=(001:C'TRAILER',
                   010:DATENS=(4MD),
                   018:81,4,
                   025:COUNT=(TO=ZD,LENGTH=6))

Re: Use of TIME2 on header/trailer

PostPosted: Wed Oct 01, 2014 11:24 pm
by tony2nd
Thank you Billy, it worked perfectly.

I will open another topic - I have another question about the same code. This time how the improve it.