View previous topic :: View next topic
|
Author |
Message |
jctgf Currently Banned Active User
Joined: 04 Nov 2006 Posts: 109
|
|
|
|
Hi,
I have a pd field whose content is x'201005119c'.
I'd like extract the date (20100511) and write it in the output file in the zd format.
The problem is that i can't make sycsort recognize the 5.
it keeps thinking that it is the sign and doesn't write it in the output.
I checked the manual and tried a few things, with no success.
I wonder if someone can help.
Thanks. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
if <sort> thinks that the 5 should be a <sign> ...
did You specify correctly the lengths ??? |
|
Back to top |
|
|
jctgf Currently Banned Active User
Joined: 04 Nov 2006 Posts: 109
|
|
|
|
supposing that the field contains
and that i want to extract the 123456 in a zd format, when i run the following
Code: |
OUTREC=(1,3,PD,EDIT=(TTTTTT)) |
or
Code: |
OUTREC=(1,3,PD,EDIT=(TTTTTT),LENGTH=6) |
the result is 012345.
the 6 never shows up.
thanks. |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
jctgf,
3 byte PD can only store maximum of 5 digits. half byte for each digit and last half byte for sign.
Browse your file in File Aid and you will see that 6 is shifted (or displayed under) next field.
Thanks, |
|
Back to top |
|
|
jctgf Currently Banned Active User
Joined: 04 Nov 2006 Posts: 109
|
|
|
|
hi,
i got this:
Code: |
SORT FIELDS=COPY
INREC FIELDS=(1,4,PD,TO=ZD,LENGTH=7)
OUTFIL FNAMES=SORTOUT,
OUTREC=(1,6) |
i wonder if someone knows how to write in a zd format only the nTH digit (4th, for example) of an input pd field.
thanks. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
???WTF???
you are showing us a 4 byte PD field. when you go 1,3 that makes no sense. |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
jctgf,
Quote: |
i wonder if someone knows how to write in a zd format only the nTH digit (4th, for example) of an input pd field. |
Change your OUTREC to
Thanks, |
|
Back to top |
|
|
jctgf Currently Banned Active User
Joined: 04 Nov 2006 Posts: 109
|
|
|
|
hi,
thanks for the interest.
Quote: |
i wonder if someone knows how to write in a zd format only the nTH digit (4th, for example) of an input pd field. |
this last question referred to a solution different from the one i posted.
i'll explain:
the input file has a pd field whose content is:
pls, suppose the three 1st bytes contain a date (123456).
i'd like to write this date in the output file in the zd format:
if i do
Code: |
outfil fnames=sortout,
outrec=(1,3,pd,edit=(tttttt)) |
the date written in the outfile will be
no matter what i do, sort will always consider the 2nd half
of the 3rd byte
as the signal.
i could do
Code: |
outfil fnames=sortout,
outrec=(1,3,pd,edit=(tttttttt)) |
and the result would be
in this case, the 6 has been written but the 7 has also been.
what i'd like to do is to write only digits 1 to 6 of the input field (that are in bytes 1 to 3).
i wonder if it can be done only with an outrec statment, but without the inrec.
thanks for the patience. |
|
Back to top |
|
|
|