Hey guys I need to comapare two dates feilds but the roblem is that one of the eild is packed decimal and the other is zoned decimal .How do I compare these values.(Is there any way to convert the values to dates and then compare them I am trying to comapare it in a cl program).
Announcement
Collapse
No announcement yet.
Comparing Dates
Collapse
X
-
Re: Comparing Dates
Just move them both to a date defined field of your choice..
make sure to test prior
Code:test(de) *cymd lhvndt; if not%error; isodate = %date(lhvndt:*cymd); s5vndt = %dec(isodate:*mdy); else; clear s5vndt; endif;
All my answers were extracted from the "Big Dummy's Guide to the As400"
and I take no responsibility for any of them.
www.code400.com
-
Re: Comparing Dates
but as a learning experience look at bif %subdt its pretty nerdy!
http://publib.boulder.ibm.com/iseries/v5r1/ic2924/books/c0925083595.htm
jamieAll my answers were extracted from the "Big Dummy's Guide to the As400"
and I take no responsibility for any of them.
www.code400.com
Comment
-
Re: Comparing Dates
Wouldn't it be better to provide a link to the current (Release 7.1) RPG Reference (even though %SUBDT didn't change since Release 5.1):
http://publib.boulder.ibm.com/infoce...c092508881.htm
Birgitta
Comment
-
Re: Comparing Dates
sure .. I was just lazy Thank youAll my answers were extracted from the "Big Dummy's Guide to the As400"
and I take no responsibility for any of them.
www.code400.com
Comment
-
Re: Comparing Dates
Hey guys I am getting this error
Receiver value too small to hold the result
my code:
Code:/free date0 s D datfmt(*mdy); date0= %date(dateofjoining:*mdy);--> this line /end free dateof joining is a numeric database field of length 8 p 0
Comment
-
Re: Comparing Dates
In which format is the date stored?
YYYYMMDD (*ISO) or YYMMDD (*YMD) or MMDDYYYY (*USA) or MMDDYY (*MDY) or DDMMYYYY (*EUR) or DDMMYY (*DMY).
If it is stored in format *ISO, *USA, *EUR and you want to convert the numeric date into format *MDY, you need to make sure the date will be in the range between 01/01/1940 and 12/31/2039.
If it is stored in format *YMD, *DMY or *MDY, try to format DateOfJoining into 6P 0
Code:/Free Date0 = %Date(%Dec(DateOfJoining: 6: 0): *MDY); /End-Free
Birgitta
Comment
-
Re: Comparing Dates
ok this is the problem i need to find if a date(numeric of length 8) is in betweeen two particular dates.
so i stored it in a date varaiable byCode:date0= %date(dateofjoining:*usa);-->
So basically is there a way that i could anyhow get the 8 digit numeric into 6 digit date so that i can compare it with other two dates or viceversa.
Thanks all u guys for helping me(noob) please bear with me ..
Comment
-
Re: Comparing Dates
if they are true date field the format doesn't matter as far as the comparison goes. dates aren't really formatted in storage the format option on affects the "human-readable" display of the dates.I'm not anti-social, I just don't like people -Tommy Holden
Comment
-
Re: Comparing Dates
Remember that the 2nd parm supplied to the %date() is the format of the NON-DATE field, and doesn't have to agree with the format of the date field. If you are getting incompatable fields, you are not comparing date fields - you are comparing the numeric on one of them.
Comment
-
Re: Comparing Dates
post the actual data you are trying to compare....and we can post code to do it.
thanks
JamieAll my answers were extracted from the "Big Dummy's Guide to the As400"
and I take no responsibility for any of them.
www.code400.com
Comment
Comment