Page 1 of 1

Date-OF-Integer function

PostPosted: Fri Apr 22, 2011 5:15 pm
by Pumpkin
hi,
i was trying this function,want to convert a Gregorian date to a standard date(yyyymmdd)., but it get RC=12 error. please see the code in pic. and why it can't work ,thanks!

Re: Date-OF-Integer function

PostPosted: Fri Apr 22, 2011 5:24 pm
by MrSpock
I'm not a COBOL programmer, but wouldn't it be COMPUTE CURRENT-DATE = FUNCTION DATE-OF-INTEGER (0147697)?

Re: Date-OF-Integer function

PostPosted: Fri Apr 22, 2011 7:24 pm
by NicC
CURRENT-DATE is a reserved name in COBOL - it is the name of the function that returns the current date (oddly enough).

Re: Date-OF-Integer function

PostPosted: Fri Apr 22, 2011 7:33 pm
by BillyBoyo
Good spot NicC.

Re: Date-OF-Integer function

PostPosted: Sat Apr 23, 2011 6:19 am
by Pumpkin
yes, these function work with compute statement,can't work with move statement.
thanks.

Re: Date-OF-Integer function

PostPosted: Sat Apr 23, 2011 12:57 pm
by BillyBoyo
I saw aleady in the manual that the manual uses COMPUTE. However, GOOGLE gives 500+ hits for its use with MOVE. I've checked a couple. No-one moaning it doesn't work.

NicC is right about the Reseved Word (unless changed recently). Most Reserved Words are individual words. This one, not.

Re: Date-OF-Integer function

PostPosted: Sat Apr 23, 2011 6:17 pm
by Robert Sample
See section 6.2.24 of the COBOL Language Reference manual on the MOVE statement. It explicitly states what a sending field may consist of -- and intrinsic functions do not fall under the sending field definition.

Re: Date-OF-Integer function

PostPosted: Fri Jun 24, 2011 1:14 am
by Ed Goodman
Google's 500+ hits are probably all copies of this same question listed on other boards by scraper bots.