Decimal data error in RPG

895 pts.
Tags:
Decimal Data Error
RPG
RPGLE
I declare time field in RPG as D btime    4  0 eval btime = 2400 this one I pass to a CL program with var type var(&tim) type(*dec) len(4,0) and this in turn passed to another RPG program D stime    4  0 When it comes to third program it has some hex char shown in debug as belo stime = 2_4_ I have no clue how this hex char comes in to picture.. and when I try to move this to another numeric field it throws decimal data error Please help

Software/Hardware used:
as400

Answer Wiki

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

If this is really how you define it in RPG:
<pre>
D btime 4 0
</pre>
Then this is incorrect in CL:
<pre>
var(&tim) type(*dec) len(4,0)
</pre>
One or the other is wrong. The two types are not the same — it’s zoned-decimal in RPG and packed-decimal in CL. The RPG is zoned-decimal because you did not specify a data type and it’s not a stand-alone field; it’s a data structure subfield.

Give it a data type of ‘P’ in RPG, or make it a stand-alone field, or change it to CHAR (4) in CL. If you change the RPG, change both places.

Tom

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