Posted: Wed Feb 13, 2008 8:09 am Post subject: converting from S9(20)V9(2) comp-3 to S9(14)V9(3) comp-3
Hi,
I have one field in my file which is defined as Decimal(22,2) in the table. So it is showing 12 dots(packed decimal format) in the file. I need to load another table using this file but the corresponding field in target table is defined as Decimal(17,3).
Can I use sort utility to convert it? Please help me and also give me pointer to some useful document on sort.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Feb 13, 2008 12:13 pm Post subject:
An S9(20)V9(2) value has 20 digits to the left of the decimal point and 2 digits to the right of the decimal point. An S9(14)V9(3) value has 14 digits to the left of the decimal point and 3 digits to the right of the decimal point. (Of course, the decimal point is not actually carried internally for comp-3 = PD values.)
So you're asking to convert a value like:
12345678901234567890.12
to a value with 14 digits to the left of the decimal point and 3 digits to the right of the decimal point. How exactly would you want to do that conversion? What would you want the value above to look like with 14 digits to the left of the decimal point and 3 digits to the right of the decimal point? Would you just truncate the rightmost 6 digits and add a 0 at the end to get:
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Thanks for ur reply.....
yes the value would get truncated. Actually the maximum significant digits in source field are only 14 left to the decimal. But i need to increase one digit right to the decimal and the would be ZERO of course.
For example source field has values: 00000012345678901234.25 then i need to convert it to 12345678901234.250.
Problem is that in the file the value is in PD format.....
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Feb 14, 2008 11:31 am Post subject:
Here's a DFSORT job that will do what you asked for. I assumed that your 12-byte input PD field is in positions 1-12 and you want the 9-byte output PD field in positions 1-9. Adjust as needed.
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Thanks. Sort card is working fine.
Can you plz explain this Sort card....what's the use of MUL and what's +10 for?
Second BUILD is also no clear to me.
please help me understanding this so that I can use it appropriately in my job.
truncation of bytes (12 to 9 in above example) can be done using OUTREC also but if need to truncate odd numbers of nibble then how can do using above sortcard?
for ex: we have number written as following using hex on-
024680246802
13579135791C
and I want to keep the output as below-
____0246802
___9135791C
means I need to convert 01234567890123456789012C to 90123456789012C then how can modify my sort card please tell me.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri Feb 15, 2008 12:36 pm Post subject:
Quote:
what's the use of MUL and what's +10 for?
MUL,+10 means multiply by 10. This give us the extra 0 at the end for three digits after the decimal point rather than 2 (e.g. from .12 to .120).
Quote:
Second BUILD is also no clear to me.
The first BUILD multiplies the PD value by 10 to a 12-byte PD value. The second BUILD takes the last 9 bytes of that value to get the 9-byte PD value you want.
Quote:
to convert 01234567890123456789012C to 90123456789012C then how can modify my sort card
If the PD value is always positive, you can use these DFSORT control statements:
Code:
OPTION COPY
INREC BUILD=(5,8,PD0,TO=PD,LENGTH=8)
If the PD values can be positive or negative, you can use these DFSORT control statements:
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum