Binary Field

520 pts.
Tags:
RPG ILE
How do I populate a binary field (field length of 9), buffer length of 4, with the value 10002- (right justified) I need to do this in an existing RPG ILE program. Help ?

Answer Wiki

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

Character fields have values such as 10002- (right justified). Binary fields have values that can represent -10002, but are not right justified or controlled in terms of where the sign is stored.

If you have a field BinaryFld with is defined as ’9b 0′, which would mean a 4-byte buffer, then to set (or populate) BinaryFld to -10002 would be:

<pre>
dBinaryFld s 9b 0

/free
BinaryFld = -10002;
/end-free
</pre>

If you already have the character field (CharFld) which contains the 10002- and you wanted to use this character field to set BinaryFld, then:

<pre>
dBinaryFld s 9b 0
dCharFld s 10 inz(’10002-’)

/free
BinaryFld = %int(CharFld);
/end-free
</pre>

But in all of these cases BinaryFld will actually be x’FFFFD8EE’.

Bruce Vining
<a href=”http://www.brucevining.com/”> http://www.brucevining.com/</a>

Discuss This Question:  

 
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

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