Eliminating spaces in Date field



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

Eliminating spaces in Date field

Postby dhurai » Mon Dec 22, 2008 11:53 am

Hi

I am sorting records based on the first field and also i need sum of third field.At a point of time i got some records in input as follows.


12345 20081210 4500
12345 spaces 1500
12345 20081010 2000


I need a output like this
12345 20081010 8000.

I need to get the non space minimum date and also sum for the last fields.can anyone help me to resolve this?
Thanks in advance..
dhurai
 
Posts: 1
Joined: Mon Dec 22, 2008 11:31 am
Has thanked: 0 time
Been thanked: 0 time

Re: Eliminating spaces in Date field

Postby Frank Yaeger » Mon Dec 22, 2008 10:40 pm

Here's a DFSORT job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

//S1    EXEC  PGM=ICEMAN                                       
//SYSOUT    DD  SYSOUT=*                                       
//SORTIN DD *                                                 
12345  20081210  4500                                         
12345            1500                                         
12345  20081010  2000                                         
22345  20081210  4000                                         
22345            1200                                         
22345  20080905  3000                                         
//SORTOUT DD DSN=...  output file (FB/80)                                         
//SYSIN    DD    *                                             
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:8,8)),                   
        IFTHEN=(WHEN=(8,1,CH,EQ,C' '),OVERLAY=(81:8C'9'))     
  SORT FIELDS=(1,5,CH,A)                                       
  OUTFIL REMOVECC,NODETAIL,BUILD=(1,80),                       
    SECTIONS=(1,5,                                             
      TRAILER3=(1,5,                                           
         8:MIN=(81,8,ZD,TO=ZD,LENGTH=8),                       
        17:TOT=(18,4,ZD,M10,LENGTH=5)))                       
/*


SORTOUT would have:

12345  20081010  8000   
22345  20080905  8200   
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post