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
 
To find day of a date in the past

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

New User


Joined: 22 Nov 2007
Posts: 83
Location: Chennai

PostPosted: Sun Jun 08, 2014 8:53 pm    Post subject: To find day of a date in the past
Reply with quote

Hi All,

I have a requirement in which I need to find the day of a date in the past.

In my COBOL program I will be using an input file which will be having account numbers. I need to read that account number and go in to an IMS DB to check the date. That date is the entry date of that account number in the system. Usually the date would be a past date. I have to take that date and find the date of last Friday of that month and also I have to find out the date of previous month's last Friday.

For example, if the entry date of an account number is 01012014 (DDMMYY format)in the database, I need to find out the date of last Friday of January 2014 and also if the job is going to run in July, I have to find out the date for last Friday of June 2014 as well.

Can someone please help me with this?

Also, please let me know if you need more details.

Regards
Agni
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10375
Location: italy

PostPosted: Sun Jun 08, 2014 9:33 pm    Post subject: Reply to: To find day of a date in the past
Reply with quote

where are You facing problems ...
the logic or the coding ?

hint ...
the INTEGER-OF-DATE and DATE-OF-INTEGER are all You need ...

INTEGER-OF-DATE returns an absolute number whose modulo 7
will tell the week day

something like
Code:
IDATE = FUNCTION INTEGER-OF-DATE (Your date)
DOFW = FUNCTION MOD( IDATE, 7)
IFRI = IDATE + 7 -DOFW
FRIDAY = FUNCTION DATE-OF-INTEGER(IFRI)


I SAID SOMETHING LIKE ...
what I posted just finds the friday of the same week of the input date

probably it would be faster
to find the FRIDAY before the first day of the month that follows
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 Jun 09, 2014 2:43 pm    Post subject: Reply to: To find day of a date in the past
Reply with quote

Before using INTEGER-OF-DATE, validate "your date". If you don't have any type of date validity checking facility, then use the LE Callable Date routine "CEEDAYS".

After calling "CEEDAYS", if the first 2-bytes of the 12-byte Feedback area are NOT X'00's, then the date is invalid.

Search the forum for "CEEDAYS". You'll get many hits and suggestions.

Any type of DATE FUNCTION in COBOL (except for FUNCTION CURRENT-DATE) requires valid data. Otherwise, you'll crash and burn.

"CEEDAYS" is also handy to determine if a particular year is a leap-year. Just build the leap-year date (for example) as "YYYY0229" and pass it to "CEEDAYS". If the first 2-bytes of the feedback area are NOT X'00's, then it's not a leap-year.

HTH....
Back to top
View user's profile Send private message
Agni

New User


Joined: 22 Nov 2007
Posts: 83
Location: Chennai

PostPosted: Mon Jun 09, 2014 11:45 pm    Post subject: Re: Reply to: To find day of a date in the past
Reply with quote

Bill O'Boyle wrote:
Before using INTEGER-OF-DATE, validate "your date". If you don't have any type of date validity checking facility, then use the LE Callable Date routine "CEEDAYS".

After calling "CEEDAYS", if the first 2-bytes of the 12-byte Feedback area are NOT X'00's, then the date is invalid.

Search the forum for "CEEDAYS". You'll get many hits and suggestions.

Any type of DATE FUNCTION in COBOL (except for FUNCTION CURRENT-DATE) requires valid data. Otherwise, you'll crash and burn.

"CEEDAYS" is also handy to determine if a particular year is a leap-year. Just build the leap-year and pass it to "CEEDAYS". If the first 2-bytes of the feedback area are NOT X'00's, then it's not a leap-year.

HTH....


Hi Bill,

Sure, I will do that. Thanks for your suggestion.

Regards
Afni
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 Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Date in where clause - Windows Karthikeyan Subbarayan DB2 9 Wed Nov 15, 2017 9:07 pm
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
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