Frustrated with this one passing a DATE value to a display file

I have a display file with a field called APPDATE, it is a numeric O field with a length of 8.  It is formatted to display the date in DD/MM/YYYY format.

I am trying to pass it the system date in a sub-routine with the following statement

EVAL APPDATE = *DATE

But the compiler is complaining, everything I try keeps giving me trouble.

Suggestions?

Dogulas
LVL 1
dpalmeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dpalmeAuthor Commented:
Anyone have any suggestions on this?

The compiler error is the following:

 *RNF7406 30     33 000008  Data-Format entry does not match the definition of the input field APPDATE.                                  
0
daveslaterCommented:
Hi
I am assuming you are running V5.1. It is not as easy in 5.1 as it is in 5.2 because the %dec function does not convert characters to numeric.

This is about the easiest way.

d DDMMYY          ds                                                
d APPDATE                                                            
d                                                                    
c                   eval      DDMMYY = %char(%date() : *Eur0)        
c                                                                    

Dave
0
dpalmeAuthor Commented:
Actually we are at V5R2 although I believe there is a plan to upgrade it to V5R3 very soon.
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

daveslaterCommented:
Hi
You can then use

c                   eval      APPDATE = %dec(%char(%date() : *Eur0) )

Dave
0
dpalmeAuthor Commented:
I added what you suggested Dave, but I am still getting the same error and I am also getting another error:

 *RNF7416 30     65 000703  The types of the right and left hand side do not match in    
                            the EVAL operation.                                          
0
daveslaterCommented:
Hi
What you have done is define              
APPDATE
as a date field in the database
and a numeric field on the screen.

Change the screen definition name to
MYDATE
recompile then chnage the rpg to

c                   eval      MYDATE = %dec(%char(%date() : *Eur0) )

dave
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dpalmeAuthor Commented:
Ok but won't that give me the same problem when reading a record from the database?

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
IBM System i

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.