moving a field in RPG from a PF to a screen

0 pts.
Tags:
RPG
I have a field in a Physical file, MILLPR defined as 9P 9 I am trying to move it to a display file, SCMILLPR defined as 66.666 In RPG, if I multiple the MILLPR field by 100, I can successfully make the move if the field contains .250000000, .500000000, .750000000 However, if the MILLPR field contains .000000000, this is supposed to be 1.000000000. Since the data is .000000000, I have tried: EVAL SCMILLPR=1 and EVAL SCMILLPR=1*100 I am getting an error when trying to run this program, stating that the target filed isn't big enough. I realize this is probably a simplistic question, but as you can probably tell, I am a new to RPG and SDA. Any assistance with this problem is greatly appreciated.
ASKED: January 11, 2005  12:52 PM
UPDATED: January 13, 2005  10:45 AM

Answer Wiki

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

In SDA 66.666 means five-character, numeric, output field with three decimal positions. EVAL SCMILLPR=1 should work just fine. Do you want to send along a little code to help determine the problem? I assume you didn’t move it to MILLPR (defined as 9P 9) by mistake or accidently define the fields backwards — both of these would cause the error you stated. If you send along a little code a lot of people will help you debug.

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
  • DataKnight
    firstly 1*100 will break the screen field beacuse you can only go to 99.999 as defined by yourself ;-) Can't see why moving 1 to it wont work. When do you move the data into the screen field. Maybe need to see some more code Rgds Ken
    0 pointsBadges:
    report
  • Ferddie
    the EVAL SCMILLPR=1*100 will definitely give the error, since your screen field is only 2 digits in lenght with 3 decimal positions. but EVAL SCMILLPR=1 will work fine.
    0 pointsBadges:
    report
  • TSCHMITZ
    Hi, your problem is due to a well known limitation of the EVAL instruction code. Your result fielf is 5/3 digits( 3 digits after the decimal point and therefore 2 digits before). That means the maximum contents can be 99,999. The eval instruction is not able (when you use (E) operation extender or not) to solve the fact that you try to put a amount that do not fit into the field. In this case you should work like that: Eval intermediate = From_field * multiplicator ****where intermediate is larger that from_field. if intermediate > target_field then exsr error_management *** like fixing a defaul value for such a case else eval target_field = intermediate endif Another solution is to replace EVAl by old fashion code like : From MULT multi result. The result will be automatically truncated (and Half-adjusted if you use (H) option) Hope it may help. Regards.
    470 pointsBadges:
    report
  • Volunteer
    Thank you all for your assistance. I read through each of your responses and got it to work with the following: 0131.00 C EVAL SCMILLPR+MILLPR*100 0132.00 C EVAL SCF90BUS=SCFESTBU*.90 0133.00 C SCMILLPR IFEQ 0 0140.00 C ADD 1 SCMILLPR 0141.00 C EVAL SCESBUME=SCF90BUS*SCMILLPR 0142.00 C ELSE 0143.00 C EVAL SCESBUME=SCF90BUS*(SCMILLPR/100) 0144.00 C END 0145.00 C ADD 1 RRN1 0146.00 C WRITE ACCTSF 0147.00 C READE MEMFMT1 I am still not sure about the numeric moves when the fields and decimal positions are different lengths. I have looked in "The Modern RPGIV Language" by Robert Cozzi, Jr. and on IBM ISeries website without much assistance. Do you have any other suggestions on where to look up numeric moves? Thanks again for your help. This sight and your assistance is as neat as cotton candy. Volunteer
    0 pointsBadges:
    report
  • Rchevalier
    The intermediate results operations of EVAL is documented in the RPG Reference Manual. User this link to go to the appropriate documentation for your release. Once there, in the navigation panel on the left select programming -> RPG -> Reference. I'm doing this from memory so the text may be slightly different than what I show here. The manual can also be downloaded in PDF form. http://publib.boulder.ibm.com/pubs/html/as400/infocenter.html Rick
    0 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