Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Regarding Date format to print the Report

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Nethraa

New User


Joined: 02 Feb 2010
Posts: 12
Location: chennai

PostPosted: Mon Mar 29, 2010 10:04 pm    Post subject: Regarding Date format to print the Report
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: 6968
Location: porcelain throne

PostPosted: Mon Mar 29, 2010 10:21 pm    Post subject:
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: 2504
Location: Atlanta, Georgia, USA

PostPosted: Mon Mar 29, 2010 10:43 pm    Post subject: Reply to: Regarding Date format to print the Report
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: 94
Location: India

PostPosted: Tue Mar 30, 2010 9:29 am    Post subject: Reply to: Regarding Date format to print the Report
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    Post subject:
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: 1243
Location: Israel

PostPosted: Tue Mar 30, 2010 1:19 pm    Post subject:
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    Post subject: Reply to: Regarding Date format to print the Report
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10327
Location: italy

PostPosted: Tue Mar 30, 2010 5:53 pm    Post subject: Reply to: Regarding Date format to print the Report
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: 1777
Location: Bloomington, IL

PostPosted: Tue Mar 30, 2010 6:55 pm    Post subject:
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: 12
Location: chennai

PostPosted: Thu Apr 15, 2010 2:42 pm    Post subject: Reply to: Regarding Date format to print the Report
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Julian Date to CICS ABSTTIME blayek CICS 3 Wed Aug 30, 2017 11:15 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us