×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

decoding packed signed field

decoding packed signed field

decoding packed signed field

(OP)
Within Spufi I'm reading a field that contains three fields values in a string.
It appears as
01F0058
0C2017C in hex, where 0001758+ is the field I would use for join with an other table.
How can I convert this in numeric?

Thanks to all

Candu si tene su 'entu es prezisu bentolare.

RE: decoding packed signed field


Hex
01F 0058
0C2 017C 
 
THERE is your packed binary coded decimal

The sign...
Sign
Digit BCD
      8 4 2 1  Sign  Notes 
A     1 0 1 0  +   
B     1 0 1 1  −   
C     1 1 0 0  +     Preferred 
D     1 1 0 1  −     Preferred 
E     1 1 1 0  +   
F     1 1 1 1  + Unsigned 
 

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: decoding packed signed field

(OP)
The problem is not to decode the sign, but the number.
In other words, I try a function like f(right(myfield, 4)) returning 1578.

Thanks

Candu si tene su 'entu es prezisu bentolare.

RE: decoding packed signed field

Each NIBBLE of each BYTE is a NUMERAL in your number

0058
017C

0
0
 0
 1
  5
  7
   8
   +

0001578+
 

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: decoding packed signed field

(OP)
This is clear, but if I want join to a field in another table, I'm looking for a function for

SELECT MT1.field1, MT1.field2, MT2.field1 in MyTable1 MT1, MyTable2 MT2
WHERE FUN(right(MT1.field4, 4)) = MT2.field2;

(MT2.field2 is numeric)

Candu si tene su 'entu es prezisu bentolare.

RE: decoding packed signed field

(OP)
Link does not work...

Thanks

Candu si tene su 'entu es prezisu bentolare.

RE: decoding packed signed field

Really???

I just clicked on the activated link and it opend right up.

COPY the link and PASTE it into your brower's address bar.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: decoding packed signed field

You might consider something other than SPUFI?

RE: decoding packed signed field

(OP)
My router has a DNS problem.
Now I try.

Thenks for now.

Candu si tene su 'entu es prezisu bentolare.

RE: decoding packed signed field

(OP)
I use spufi before embed code in JCL.

Thank you, SkipVought, it works fine.

Candu si tene su 'entu es prezisu bentolare.

RE: decoding packed signed field


Would you please post your solution for the benefit of other Tek-Tip members.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: decoding packed signed field

(OP)
I apologize for delay, but my pc had some problem. This is the result:

SELECT
RSDR.CTIPSOM, RSDR.DANNCON, RSDR.NRIF, RSDR.CTERINS
, RSDR.COPRINS, RSDR.DDATINS, RSDR.COPRAGG
, RSDR.DDATAGG, RSDR.SSTA, RSDR.COPR, RSDR.DCON
, RSDR.NOPE, RSDR.CFIS
, RSDR.CTIPARC, RSDR.IIMP
, RSDR.SSTASOM, RSDR.SSTAUTI, RSDR.COPRRIM, RSDR.DRIM
, RSDR.NOPERIM, RSDR.SMODRIM, RSDR.NDOCRIM
, PDTR.DINTPAR, PDTR.NINTPAR, PDTR.NPRGTRI
, PDTR.DINTPRO, PDTR.STIPPRO, PDTR.NINTPRO
, CATR.NCAR
FROM ME.FETBRSDR RSDR,
ME.FETBPDTR PDTR,
ME.FETBCATR CATR
WHERE
RSDR.CTIPARC = 'PDI'
AND DEC(LEFT(HEX(LEFT(KARC, 2)), 3), 2, 0) = PDTR.CCOS
AND DEC(LEFT(HEX(SUBSTR(KARC, 3, 2)), 3), 2, 0) = PDTR.CCOC
AND DEC(LEFT(HEX(SUBSTR(KARC, 5, 3)), 5), 4, 0) = PDTR.DINTPRO
AND SUBSTR(KARC, 8, 1) = PDTR.STIPPRO
AND DEC(LEFT(HEX(SUBSTR(KARC, 9, 5)), 7), 6, 0) = PDTR.NINTPRO

AND RSDR.DRIM > 0
AND PDTR.CCOS = CATR.CCOS
AND PDTR.CCOC = CATR.CCOC
AND PDTR.DINTPAR = CATR.DINTPAR
AND PDTR.NINTPAR = CATR.NINTPAR
AND PDTR.NPRGTRI = CATR.NPRGTRI;

Thanks.

Candu si tene su 'entu es prezisu bentolare.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close