Date-OF-Integer function



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Date-OF-Integer function

Postby Pumpkin » Fri Apr 22, 2011 5:15 pm

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!
You do not have the required permissions to view the files attached to this post.
-------------------
Pumpkin
Pumpkin
 
Posts: 55
Joined: Sat Mar 05, 2011 9:12 am
Has thanked: 0 time
Been thanked: 0 time

Re: Date-OF-Integer function

 

Re: Date-OF-Integer function

Postby MrSpock » Fri Apr 22, 2011 5:24 pm

I'm not a COBOL programmer, but wouldn't it be COMPUTE CURRENT-DATE = FUNCTION DATE-OF-INTEGER (0147697)?
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

Re: Date-OF-Integer function

Postby NicC » Fri Apr 22, 2011 7:24 pm

CURRENT-DATE is a reserved name in COBOL - it is the name of the function that returns the current date (oddly enough).
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Date-OF-Integer function

Postby BillyBoyo » Fri Apr 22, 2011 7:33 pm

Good spot NicC.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Date-OF-Integer function

Postby Pumpkin » Sat Apr 23, 2011 6:19 am

yes, these function work with compute statement,can't work with move statement.
thanks.
-------------------
Pumpkin
Pumpkin
 
Posts: 55
Joined: Sat Mar 05, 2011 9:12 am
Has thanked: 0 time
Been thanked: 0 time

Re: Date-OF-Integer function

Postby BillyBoyo » Sat Apr 23, 2011 12:57 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Date-OF-Integer function

Postby Robert Sample » Sat Apr 23, 2011 6:17 pm

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.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: Date-OF-Integer function

Postby Ed Goodman » Fri Jun 24, 2011 1:14 am

Google's 500+ hits are probably all copies of this same question listed on other boards by scraper bots.
Ed Goodman
 
Posts: 342
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post