Add value to outrec field



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

Add value to outrec field

Postby richagoyal » Fri May 28, 2010 7:00 pm

hi ,
i am trying to add value to my field. It is a CSV file and while converting to non csv i am using parse and using add . but in my o/p it is appending that many digits to input value rather than adding value.

input file :
1,2,3.4567,3
1,2,4.1274,4
1,2,5.5628,5

required o/p
1,2,3.457,3
1,2,4.127,4
1,2,5.563,5

I want to add x.xxxa = x.xxxa +.0001 if a >= 5
can any body help me in this ?
richagoyal
 
Posts: 20
Joined: Thu May 27, 2010 11:45 am
Has thanked: 0 time
Been thanked: 0 time

Re: Add value to outrec field

Postby Frank Yaeger » Fri May 28, 2010 10:12 pm

Your file appears to have each field in the same position in each record. Is that always the case? Are fields 1, 3 and 4 always 1 character? is field2 always x.xxxx? Or can you have other variations (e.g. xx.xxxx). If you can have other variations, indicate what variations you can have and show an example.

What is the RECFM and LRECL of your input file?

It looks like you're just trying to round up field 3 - is that correct?
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

Re: Add value to outrec field

Postby richagoyal » Mon Jun 14, 2010 3:02 pm

hi ,

Fields 1 , 3,4 are not always 1 character . field2 is of length 10 byte comp with v999 so it is always xx.xxx . record format of input is VB .

INREC IFTHEN=(WHEN=(5,3,CH,EQ,C'001'),
PARSE=(%01=(ENDBEFR=C',',FIXLEN=3),
%02=(ENDBEFR=C'-',FIXLEN=4),
%03=(ENDBEFR=C'-',FIXLEN=2),
%04=(ENDBEFR=C',',FIXLEN=2),
%05=(ENDBEFR=C',',FIXLEN=19)),
BUILD=(1,4,%01,%02,%03,%04,%05,1336C' ')),
IFTHEN=(WHEN=(5,3,CH,EQ,C'002'),
PARSE=(%10=(ENDBEFR=C',',FIXLEN=3),
%11=(ENDBEFR=C',',FIXLEN=8),
%70=(ENDBEFR=C',',FIXLEN=10),
%12=(ENDBEFR=C',',FIXLEN=10),
%13=(ENDBEFR=C',',FIXLEN=10),
%14=(ENDBEFR=C',',FIXLEN=19),
%15=(ENDBEFR=C',',FIXLEN=19),
%16=(ENDBEFR=C',',FIXLEN=40),
%17=(ENDBEFR=C',',FIXLEN=19),
%18=(ENDBEFR=C',',FIXLEN=19),
%19=(ENDBEFR=C',',FIXLEN=10)),
BUILD=(1,4,%10,%11,%12,%13,
%14,SFF,TO=PD,LENGTH=10,
%15,SFF,TO=PD,LENGTH=10,
%16,
%17,SFF,TO=PD,LENGTH=10,
%18,SFF,TO=PD,LENGTH=10,
%19,SFF,TO=PD,LENGTH=5))

even if 1 , 2,3 field is of more than 1 character i am able to manage by defining its length , but not able to round off field2 (%19).
richagoyal
 
Posts: 20
Joined: Thu May 27, 2010 11:45 am
Has thanked: 0 time
Been thanked: 0 time

Re: Add value to outrec field

Postby Frank Yaeger » Wed Jun 16, 2010 2:05 am

What does field2 have to do with %19?

DFSORT only does integer arithmetic, so to round up a x.xxxx value, you would use UFF to remove the decimal point, then add 5, then divide by 10, and reformat the result as x.xxx

For example:

3.4567 -> (34567 + 5) / 10 = 3457 -> 3.457
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

Re: Add value to outrec field

Postby richagoyal » Wed Jun 16, 2010 9:49 am

Thanx Frank it worked !

%19 was for fields 3 not for field2 . Sorry it was typo !
richagoyal
 
Posts: 20
Joined: Thu May 27, 2010 11:45 am
Has thanked: 0 time
Been thanked: 0 time

Re: Add value to outrec field

Postby Frank Yaeger » Wed Jun 16, 2010 10:33 pm

Ok. Glad I could help.
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