Overlay in RPGLE data structure

935 pts.
Tags:
AS/400
Data structure
RPGLE
Hi all,
I am using data structure with two values, one alpha and other is packed decimal. decimal value overlays alpha value. Actually my intention is to convert character value to decimal value. while debugging strange thing is when I assign value to alpha field and instantly check value in decimal field it contains {(CursorBlock)(Zero)(CursorBlock)} as it length is 3. why it is not getting value of alpha field when I check value in alpha field it contains 3 numeric digits.
Thanks in advance!

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: 5  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
  • CharlieBrowne
    Can you post the code you have for the DS and how you are populating it.
    41,370 pointsBadges:
    report
  • azohawk
    I'm not sure you can do that given the way packed numerics are stored in memory.  You may need to do the overlay of the alpha w/ a signed numeric then move the signed numeric to the packed field.
    385 pointsBadges:
    report
  • CharlieBrowne
    I misread your question. azohawk is correct. You cannot use the same space in memory for bot an alpha field and a numeric field. You need to come up with a different solution for what you are trying to do. If you need suggestions, please give us some detail on what you are trying to accomplish.
    41,370 pointsBadges:
    report
  • philpl1jb

    You could do the conversion in a 'C" spec

    MyNumber = %DEC(MyChar : 3 : 0);

    or the other way

    MyChar = %EDITC(MyNumber: 'X');

    49,550 pointsBadges:
    report
  • hunshabbir7
    Thnx all of you for kind suggestions. Actually I was following this artical. Kindly have a look at this and further suggest. Anyhow I have accomplished my task using 'atoi' API.
    935 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