View previous topic :: View next topic
|
Author |
Message |
spoorni
New User
Joined: 29 Nov 2007 Posts: 20 Location: india
|
|
|
|
I am trying to move a field which is of PD and length 6 bytes to a field which is also a PD and a length of 9 bytes. If i do a straight move, the field is getting populated with junk values. If i move, zeroes to the first 3 bytes of the output and then the field, it still has junk values. I am using OUTREC to perform this operation. Could anyone provide any pointers? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Why did you not post some sample input and output data? And, by the way, there is no such thing as "junk values" -- the values may not be human-readable, but they are values from the collating sequence and as such may require interpretation, but they are NOT "junk".
Is the data set fixed length or variable length? If variable length, did you account for the RDW in your OUTREC positions? |
|
Back to top |
|
|
spoorni
New User
Joined: 29 Nov 2007 Posts: 20 Location: india
|
|
|
|
The input and output are both fixed length files. The input is an unload from a DB2 table. In the table the column is of DECIMAL type and length of 11. The output is a fixed length file and the field is of type S9(16)V COMP-3. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
Why don't you fix the source (the select query by using CAST function)? |
|
Back to top |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
spoorni wrote: |
If i do a straight move, the field is getting populated with junk values. |
Do some twisted moves instead.
. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
RahulG31 wrote: |
Do some twisted moves instead. . |
spoorni wrote: |
If i move, zeroes to the first 3 bytes of the output and then the field, it still has junk values. |
There was an attempt at that too |
|
Back to top |
|
|
spoorni
New User
Joined: 29 Nov 2007 Posts: 20 Location: india
|
|
|
|
How would I use CAST in this case? I tried a few options but were not fruitful. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
Code: |
select cast( your_column_name as DEC(16,0) )from sysibm.sysdummy1 |
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
There are zeros, and zeros. To create your longer packed-decimal, use binary zeros.
...,3Z,sourcestart,sourcelength... |
|
Back to top |
|
|
|