need to convert csv into noncsv



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

need to convert csv into noncsv

Postby richagoyal » Tue Jun 29, 2010 11:34 am

hi ,

i have a i/p file that is CSV file i want to convert it into noncsv. i am facing a issue in one of the field.

i/p file :
999,222573,4829.94609700308

expected o/p :
999 222573 4829.94610

field3 = 4829.94609 is a S9(13)V9(5)

My JCl :
IFTHEN=(WHEN=(5,3,CH,EQ,C'999'),
PARSE=(%90=(ENDBEFR=C',',FIXLEN=3),
%91=(ENDBEFR=C',',FIXLEN=17),
%92=(ENDBEFR=C',',FIXLEN=19)),
BUILD=(1,4,%90,%91,SFF,TO=PD,LENGTH=9,
(%92,SFF,ADD,+500000),DIV,+1000000, X
TO=PD,LENGTH=10,1053C' '))

its working fine for the above i/p. but field3 format is not constant it can be
i/p file :
999,587378,10367.7517399912

expected o/p:
999 587378 10367.75174

but we are getting
999 587378 1036.77517

But i am not able to get the desired output as we are appling the standard rule for all format.
richagoyal
 
Posts: 20
Joined: Thu May 27, 2010 11:45 am
Has thanked: 0 time
Been thanked: 0 time

Re: need to convert csv into noncsv

Postby skolusu » Tue Jun 29, 2010 10:02 pm

richagoyal,

What is the purpose of the addition and dividing? Are you rounding the decimal? What is the rule for rounding?
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: need to convert csv into noncsv

Postby skolusu » Wed Jun 30, 2010 12:49 am

Richagoyal,


Based on the assumption that you need to round the decimal if the 6th decimal byte is greater than 5 , the following DFSORT control cards will give you the desired results.
//SYSIN    DD *                                       
  SORT FIELDS=COPY                                   
  INREC IFTHEN=(WHEN=(5,3,CH,EQ,C'999'),             
  PARSE=(%00=(ENDBEFR=C',',FIXLEN=3),                 
         %01=(ENDBEFR=C',',FIXLEN=17),               
         %02=(ENDBEFR=C'.',FIXLEN=13),               
         %03=(ENDBEFR=C',',FIXLEN=6)),               
  BUILD=(1,4,%00,%01,SFF,TO=PD,LENGTH=9,             
         %02,JFY=(SHIFT=RIGHT),C'.',%03),HIT=NEXT),   

  IFTHEN=(WHEN=(36,1,ZD,GT,5),                       
  OVERLAY=(34:34,2,ZD,ADD,+1,EDIT=(TT)),HIT=NEXT),   

  IFTHEN=(WHEN=ANY,                                   
  OVERLAY=(17:17,19,SFF,PD,LENGTH=10,1053C' '))       
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: need to convert csv into noncsv

Postby richagoyal » Wed Jun 30, 2010 5:57 pm

Thanks Skolusu , the solution worked !
richagoyal
 
Posts: 20
Joined: Thu May 27, 2010 11:45 am
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post