Page 1 of 1

INTEGER-OF-DATE Function not working as expected

PostPosted: Wed Apr 06, 2016 5:26 pm
by Papya013
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?

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

PostPosted: Wed Apr 06, 2016 6:07 pm
by Akatsukami
What are the pictures and usages of the variables?

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

PostPosted: Wed Apr 06, 2016 6:32 pm
by Papya013
My bad. I am sorry, I had declared it as 9(3). Thanks for correcting me.

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

PostPosted: Wed Apr 06, 2016 6:50 pm
by enrico-sorichetti
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

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

PostPosted: Wed Apr 06, 2016 7:49 pm
by Terry Heinze
Some of the INTRINSIC FUNCTIONS of COBOL do not check for valid values. You must make sure your input is valid.