Use of TIME2 on header/trailer



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Use of TIME2 on header/trailer

Postby tony2nd » Mon Sep 29, 2014 7:55 pm

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
tony2nd
 
Posts: 4
Joined: Wed Jun 22, 2011 12:19 am
Has thanked: 0 time
Been thanked: 0 time

Re: Use of TIME2 on header/trailer

 

Re: Use of TIME2 on header/trailer

Postby BillyBoyo » Mon Sep 29, 2014 9:11 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Use of TIME2 on header/trailer

Postby tony2nd » Tue Sep 30, 2014 12:38 am

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?
tony2nd
 
Posts: 4
Joined: Wed Jun 22, 2011 12:19 am
Has thanked: 0 time
Been thanked: 0 time

Re: Use of TIME2 on header/trailer

Postby BillyBoyo » Wed Oct 01, 2014 3:20 am

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))
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Use of TIME2 on header/trailer

Postby tony2nd » Wed Oct 01, 2014 11:24 pm

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.
tony2nd
 
Posts: 4
Joined: Wed Jun 22, 2011 12:19 am
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post