IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Regarding Date format to print the Report


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Nethraa

New User


Joined: 02 Feb 2010
Posts: 16
Location: chennai

PostPosted: Mon Mar 29, 2010 10:04 pm
Reply with quote

Hi All,

I need to write the records into file if the Expiration Date is <= 60 days.

I am calculating the date by Subtracting the current Date from End Date as follows.


COMPUTE WS-DIFF-DT-DD = WS-END-DT-DD - W-SYSDATE-DD
COMPUTE WS-DIFF-DT-MM = WS-END-DT-MM - W-SYSDATE-MM
COMPUTE WS-DIFF-DT-YY = WS-END-DT-YY - W-SYSDATE-YY


IF WS-DIFF-DT-DD < 60 AND WS-DIFF-DT-MM <= 2 AND
WS-DIFF-DT-YY = 0

Then WRITE THE RECORD.

Is that correct. If i am writing the condition wrongly could you please suggest me correct it?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Mar 29, 2010 10:21 pm
Reply with quote

you should use the LE callable routines to calculate the difference between two dates.

your logic sucks. e.g. sysdate-dd is 10 and the end-dt-dd is 8

why would a ws-diff-dt-dd ever be more than 60?

suggest you provide a better explanation.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Mar 29, 2010 10:43 pm
Reply with quote

Quote:
Dick said "your logic sucks."

Good to have you back.... icon_wink.gif

Regards,

Bill
Back to top
View user's profile Send private message
Ranjithkumar

New User


Joined: 10 Sep 2008
Posts: 93
Location: India

PostPosted: Tue Mar 30, 2010 9:29 am
Reply with quote

Nethra

Convert the date from Gregorian(yymmdd) to Julian(yyddd) format and now you can easily find the difference b/w yy and ddd of W-SYSDATE & WS-END-DT.
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Tue Mar 30, 2010 10:50 am
Reply with quote

Hi Nethraa,

Just to be on the same page, could you explain your requirement better.
Quote:
I need to write the records into file if the Expiration Date is <= 60 days.
How can we compare date to no. of days ? icon_wink.gif

Quote:
IF WS-DIFF-DT-DD < 60 AND WS-DIFF-DT-MM <= 2 AND WS-DIFF-DT-YY = 0
Again, just to be sure.... From my experience I have seen the expiry date used in such a way that when the differnece between the current date and the expiry date is more than 30 or 60 days, write to a archive file. so are u sure what you have mentioned is correct....

Pardon me for my curiosity...
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Mar 30, 2010 1:19 pm
Reply with quote

dbzTHEdinosauer wrote:
your logic sucks
If there were an award in this category, this would be a good candidate!

Nethraa,
Use the INTEGER-OF-DATE and DATE-OF-INTEGER functions, maybe.
Back to top
View user's profile Send private message
Ragav86

New User


Joined: 27 Jan 2010
Posts: 37
Location: chennai

PostPosted: Tue Mar 30, 2010 5:47 pm
Reply with quote

try this

COMPUTE X = FUNCTION INTEGER-OF-DATE(END-DATE)-
FUNCTION INTEGER-OF-DATE(SYSDATE)

IF X < 60
WRITE THE RECORD.

the format should be in YYYYMMDD
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Mar 30, 2010 5:53 pm
Reply with quote

Quote:
Convert the date from Gregorian(yymmdd) to Julian(yyddd) format and now you can easily find the difference b/w yy and ddd of W-SYSDATE & WS-END-DT.


previous Dick comment applies icon_lol.gif

10 jan 2010 - 25 dec 2009 ==> 650 days

10010 - 09360 .....
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Mar 30, 2010 6:55 pm
Reply with quote

Use the Language Environment date functions to convert to and from Lilian day number; do your computations with that.
Back to top
View user's profile Send private message
Nethraa

New User


Joined: 02 Feb 2010
Posts: 16
Location: chennai

PostPosted: Thu Apr 15, 2010 2:42 pm
Reply with quote

Hi All,

Sorry for the delayed reply. As i went on long leave i couldn't reply.
I will work on the suggestions and come back.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
Search our Forums:

Back to Top