how to convert variable attribute in RPGLE

3,790 pts.
Tags:
RPGLE Program
How to convert fixed binary variable(B) value and signed integer variable(I) value to packed decimal (P) field..

Software/Hardware used:
as400 v5r3
ASKED: December 5, 2011  12:18 PM
UPDATED: March 19, 2012  1:47 PM

Answer Wiki

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

Discuss This Question: 7  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
  • philpl1jb
    The Eval command reduces the right hand side of the expression to Numeric, Char, Date .. the receiver must be numeric (signed, packed, integer, etc.) to receive a numeric value. So EVAL A=B or in Free A=B; or in RPGIII MOVE B A or Z-ADD A B ' Phil
    48,565 pointsBadges:
    report
  • TomLiotta
    You don't convert the attributes. You convert value by assigning it to a different variable. As Phil says, the EVAL opcode provides assignment of values to variables. If variable attributes are compatible, you can effectively convert the attributes by defing the variables to the same memory address. This can be done either by using the OVERLAY keyword to "overlay" the definition of one variable on top of another or by using the BASED() keyword to set the address. The address can be taken by using the %ADDR() function of the other variable to assign an address to a pointer, then using BASED() over the pointer. Data type 'B' is generally not directly compatible with 'I' or 'U' because 'B' can represent decimal fractions and has smaller range limits within a given number of bytes. Data type 'S' (zoned-decimal) can be compatible with 'A' and other character data types as long as only non-negative digits are involved. In some cases, overlaying those data types can be useful for 'conversion of attributes'. Tom
    125,585 pointsBadges:
    report
  • pdsathishkumar
    hello Mr. TomLiotta thanks for your answer... can you give me some example for overlay keyword, based() keyword and %addr() function... becoz i don't know about, how to use these keyword and purpose...
    3,790 pointsBadges:
    report
  • TomLiotta
    can you give me some example... Since the ILE RPG Reference and the Programmer's Guide already contain examples, there is no reason to duplicate them here. If the on-line versions are difficult to access, you can download PDFs of the manuals to have on your own PC. Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    Overlay and pointers would not apply to your original question about conversion between numeric types. Phil
    48,565 pointsBadges:
    report
  • TomLiotta
    True, but it does relate to attribute conversion. For a beginner, the difference between values of variables and attributes of variables can be tricky. And for someone searching tomorrow for 'convert variable attribute' and finding this thread, the distinction should be made. Tom
    125,585 pointsBadges:
    report
  • pdsathishkumar
    whats the different between converting 'values of variable' and 'attribute of variable' in RPG...
    3,790 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