I have an application that reads through IFS records, parses out fields and then writes them to a physical file using SQL. I ran into an issue with the date. It comes in as MM/DD/CCYY formatted text and I need to get it to a Julian date (actually a 5 digit number) So I thought the following would work (/FREE):
jvDate = %Date(INvDate:*JUL0);
The 2nd parameter of the %date() BIF specifies the format of the date that it's trying to interpret, not the one that's output from the BIF. I think that's where you're getting confused.
I'm assuming that InvDate is a character string (not a date field) that's in MM/DD/YYYY (*USA) format. If that's the case, your code should look like this:
jvDate = %date(InvDate: *USA);Then, to convert it to a character representation of the julian date, you'll do the following:
vDate = %char(jvDate: *JUL0);
I am suspecting that the runtime error is occurring because the program is assuming *ISO for the date format and it is coming in as *USA.
It's not assuming anything. You specifically told it that the date in the InvDate field is in *JUL0 format. That's why it's confused.
know how to tell %Date built in that I am formatting a date FROM *USA to *JUL. Do I need to add another step so that I first convert the character field to *USA date and THEN convert that to a *JUL format?
You specify the format of the date field that %date() outputs on the D-spec when you declare the date field in the first place. The 2nd parameter to %date() is the input format, not the output format.
This mailing list archive is Copyright 1997-2014 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact