Retrive Day from a field which holds date

2505 pts.
Tags:
AS/400
RPG
I have a file which has a field say FieldA which is of type 10A. It holds date in Format DD/MM/YYYY. Through an RPG program, I'm reading this file and when the Day in FieldA is a Saturday/Sunday I need to perform some set of logic. How can I extract the day from FieldA?

Software/Hardware used:
AS400

Answer Wiki

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

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
  • philpl1jb

    So here is a discussion on this question:

    http://itknowledgeexchange.techtarget.com/itanswers/day-of-week/

    of the many options I was looking at this

    DayOfWeek = %Subst((‘Sunday   Monday   Tuesday  WednesdayThursday Friday   Saturday ‘ ):(((%Rem(%Diff(%Date():%Date(0001-01-01′):*D):7)+1)*9))-8:9);

    And in your case the %DATE() .. which is today's date becomes

    %Date( myField : *EUR)

    49,550 pointsBadges:
    report
  • TomLiotta

    A more generic procedure could be built using Phil's suggestions or with a couple APIs. Simplest, though, might be using SQL:

    exec sql values ( DAYOFWEEK(DATE( '10/08/2013' )) ) into :myDayName

    The direct use of your file field value in that statement could depend on your job's DATFMT and DATSEP. You might also CREATE a VIEW or use a SELECT that does the DAYOFWEEK() for you when the file row is read. That would remove the code from any program and make it part of the database.

    Tom

    125,585 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