INTEGER-OF-DATE Function not working as expected



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

INTEGER-OF-DATE Function not working as expected

Postby Papya013 » Wed Apr 06, 2016 5:26 pm

Hi Team,

I am trying to add 10 days to the current date in my code. So I am using the below mentioned code.

Input date : 20160406

DISPLAY 'W-CURRENT-DATE-Z' W-CURRENT-DATE-Z            
COMPUTE WS-INTEGER-X =                                
             FUNCTION INTEGER-OF-DATE(W-CURRENT-DATE-Z)
DISPLAY 'WS-INTEGER-X    ' WS-INTEGER-X    


This is the output I am getting.

W-CURRENT-DATE-Z20160406
WS-INTEGER-X    672          


I think its returning the Gregorian day. Could anyone help me?
Papya013
 
Posts: 22
Joined: Wed Nov 06, 2013 6:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: INTEGER-OF-DATE Function not working as expected

 

Re: INTEGER-OF-DATE Function not working as expected

Postby Akatsukami » Wed Apr 06, 2016 6:07 pm

What are the pictures and usages of the variables?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1033
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 49 times

Re: INTEGER-OF-DATE Function not working as expected

Postby Papya013 » Wed Apr 06, 2016 6:32 pm

My bad. I am sorry, I had declared it as 9(3). Thanks for correcting me.
Papya013
 
Posts: 22
Joined: Wed Nov 06, 2013 6:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: INTEGER-OF-DATE Function not working as expected

Postby enrico-sorichetti » Wed Apr 06, 2016 6:50 pm

there are gazillions of topics here
and here http://ibmmainframes.com/index.php
which say otherwise

did You think about reading the manual
and checking the pic of the variables involved
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2554
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 121 times

Re: INTEGER-OF-DATE Function not working as expected

Postby Terry Heinze » Wed Apr 06, 2016 7:49 pm

Some of the INTRINSIC FUNCTIONS of COBOL do not check for valid values. You must make sure your input is valid.
.... Terry
Terry Heinze
 
Posts: 178
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 10 times
Been thanked: 11 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post