RPGLE: File value

Tags:
RPG ILE
RPG Output File Field
RPGLE
I have a file value which is of length 15 with 2 decimal places. This value has to be assigned to an output file field whose length is 13 (eg:10.2). Can this be assigned in RPGLE. The field from input file is a numeric field

Answer Wiki

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

Yes – but your spec’s are incomplete.

On the input – can there be a negative value and how do you want that to appear in the output?
Do you want the output field to be Zero filled?

- output field is character 13
- output field should look like it were 10 digits + decimal + 2 digits (12.2)

Here’s the method for:
zero fill included and no sign

Eval Outputfield =
%subst(
%editw(InputField : ’0 . ‘) <– ’0 + 12 blanks + . + 2 blanks
: 4:13)

But this code drops the most significatant 3 digits so it would be better to code it like this..
If InputField > 100000000.00
Eval Outputfield =
%subst(
%editw(InputField : ’0 . ‘)
: 4:13)
else
Eval Outfile = ’9999999999.99′
Endif

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