data base files

1,150 pts.
Tags:
DB2
PF
How are the negative values in the packed fields are stored in the PF? How to enter negative data in those fields?
ASKED: May 27, 2009  5:51 PM
UPDATED: July 30, 2009  3:42 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi,

The negatives are stored with a sign in the rightmost position of the field – the sign is normally a letter and is dependent upon the rightmost digit in the value. This sounds more confusing than it is and you don’t really need to know too much about it in practice.

To enter negative values in packed fields you could use DFU or SQL or any other data entry tool and just enter the value as a normal negative – the system will handle the packing and unpacking for you.

Regards,

Martin Gilbert.

////////////////////////////

Hi,
Expanding Martin explanation, to store a packed field the format in hex for number 12345 will be:
’12345F’

For -12345 it will be :
’12345D’

Well, the last byte (’5D’) will represent character ‘)’ but if you put this negative number in screen it will be displayed like :
’1234N’
because system will convert hex ’12345D’ to hex ‘F1F2F3F4D5′ and ‘D5′ is letter ‘N’

Wilson

To expand on Wilson’s answer… in his example it will only
display an N if you display the value with without consideration
for the sign. use a display field that allows for negative numbers
and you can display ‘-12345′.

Steve

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • ten2008
    Hi thanks for the feed back. But i still have a doubt. When i tried to enter a negative value into a packed field in a PF (like -1234.56) the keyboard is getting locked for entering - sign. Please explain how to avoid this. thanks again Ram
    1,150 pointsBadges:
    report
  • WilsonAlano
    Hi Ram, To allow enter a sing in a DSPF you must use a "keyboard shift" 'S' or 'Y' if you will use an edit code or edit word. The minus sign must be entered after the number. 1234.45- Regards Wilson
    2,435 pointsBadges:
    report
  • LBurkett99
    Enter your number (ie., 1234.45), then use the Field Minus key. I use Client Access, and the default for this key is the minus key on the 10-key pad. Having done this the field will display with a non-numeric character in the right-most position of the field, but will show as 1234.45- when re-displayed on the screen. Leo Burkett
    830 pointsBadges:
    report
  • Yorkshireman
    Ignore the sign at the bit level. If you use DFU or any editor, it will transalte, as Leo says. If you're editing the PF at byte level, then check the manuals for the character map or write yourself a byte dump and understand which bit is the sign bit in the field. A character 'D' for instance is merely a 5 with its sign bit set to negative, ditto for A, B etc. F indicates all bits set, which is taken as positive. I forget the other defaults for 1110, 1100 1101 etc - Mainly - just use an editor and let the compilers take the strain..
    5,520 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following