Why do I have such a problem with passing to a program a 8 byte field using a parm.

385 pts.
Tags:
RPG
RPGLE
Why do I have such a problem with passing to a program a 8 byte field using a parm. Parm field is define as packed(8,0) but as soon as the program tries to acquired the parm I get a Decimal data error.

*ENTRY        PLIST                                                            PARM                    NWDATE            8 0

EVAL      TodayDate = NWDATE           <=== right here it throws out the

                                                       Decimal data error.



Software/Hardware used:
AS400
ASKED: October 8, 2009  4:43 PM
UPDATED: October 10, 2009  6:28 AM

Answer Wiki

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

Are you are trying to call this by issuing the command from the command line
Call Myprog 091005
I believe OS/400 will assume that your number is 15-5
Phil

==

If your calling from another program be sure the field is defined as Packed and not Signed in the calling program.

That is exactly what fix my problem. Thanks CharlieBrowne who would of thought the AS400 would use such a random number as 15 5 for the input field size for parm values. And of course alpha’s work the way one would expect for passing a parm with a field size that matches the input value field size. Neither of the two books I have had any mention of this in there discussion about parm’s. Thanks

==================
One more gotya — When calling programs from the command lines character fields work well up to 32 characters. That’s because OS/400 stores your char entry in a field 32 bytes long or if longer as long as the character string provided. But if your program defines a longer parmater field .. say 512 it will use the string that you pass plus whatever is in memory immediately after that string up to the 512 characters.

Remember when we pass parameters we really pass pointers to the positions in memory.
Phil

Discuss This Question: 2  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

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