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

First Sunday after the first working day of the month


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
a b c d

New User


Joined: 04 Mar 2010
Posts: 13
Location: UK

PostPosted: Mon Jul 12, 2010 9:51 pm
Reply with quote

Hi All,

Please let me know how to find the particular day of the week in PL/I.

I have to find the first sunday of the week following the first working day. I able to find the first working day with the help of the existing routines.

For example If we consider July 2010
Then First working day of July 2010 is Thrusday,
and First sunday is 4th July 2010.
In the above example If I am able to find the 1st July 2010 as Thrusday, Then I can add 3 days to get First sunday
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Jul 12, 2010 10:06 pm
Reply with quote

check the ceedate callable service for the integer_of_date function
which has the chatacteristic that modulo 7 will give the day of the week

integer_of_date(....) // 7
0==> sunday
1
2
3
4
5==> friday
6

up to You to fill the empty slots icon_biggrin.gif

but still the issue is not completely defined
standard LE functions will help get the day of week,
they will not help to find out about <working> days
that info requires quite a bit of site specific handling,
fixed holidays ( world, national, local )
variable holidays
... and so on

usually after so many years of data processing every organization ( apart the disorganized ones )
have developed standard functions to take care of the work/holiday issue,

ask Your support !


Quote:
For example If we consider July 2010
Then First working day of July 2010 is Thrusday,
and First sunday is 4th July 2010.


but if You consider January 2010
the first working day would be the 4th not the 1st
and the <first> sunday would fall on the 10
Back to top
View user's profile Send private message
a b c d

New User


Joined: 04 Mar 2010
Posts: 13
Location: UK

PostPosted: Mon Jul 12, 2010 10:14 pm
Reply with quote

Hi enrico,

Integer of date is available in COBOL, here I am looking for PL/I syntax

There are few builtin functions like DAYS and WEEKDAY avaiable on PL/I, but unfortuantly complier is not recognising those...
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Jul 12, 2010 10:30 pm
Reply with quote

the info about LE callable functions is described with samples
in the LE manual starting from ( for example )

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/CEE2BK80

and search for CEEDATE and/or CEEDYWK

but the concern about your inconsistent terminology about working days is still there
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Tue Jul 13, 2010 1:58 am
Reply with quote

a b c d wrote:
Integer of date is available in COBOL, here I am looking for PL/I syntax

There are few builtin functions like DAYS and WEEKDAY available on PL/I, but unfortunately compiler is not recognising those...


Then I would suggest that you tell your management that they should seriously start thinking about getting a new release of the PL/I compiler - what stone-age release are you using?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Jul 13, 2010 10:39 am
Reply with quote

how about mayday?
Back to top
View user's profile Send private message
Sys Edwin

New User


Joined: 18 Oct 2010
Posts: 7
Location: Canada

PostPosted: Tue Oct 19, 2010 6:18 am
Reply with quote

a b c d wrote:
Hi All,

Please let me know how to find the particular day of the week in PL/I.

I have to find the first sunday of the week following the first working day. I able to find the first working day with the help of the existing routines.

For example If we consider July 2010
Then First working day of July 2010 is Thrusday,
and First sunday is 4th July 2010.
In the above example If I am able to find the 1st July 2010 as Thrusday, Then I can add 3 days to get First sunday


Funny I should come across this question today, because I have just been writing some GAL code to do exactly this and to submit a job. I know this reply is off topic, but the congruence with what I was doing is amusing. I took some examples from the manual and coded this to submit a job every Sunday that followed a working day to run a weekly backup. This code is much more rigorous than what you are looking for because it defines working days in relation to holidays and non-working days, not just weekends, but I thought it might amuse you.


DEFINE CATEGORY ( NONWORK )
CONTAINS DAY( WEEKEND )
CONTAINS CATEGORY( HOLIDAY BANK_HOLIDAY )
DESCRIPTION ( 'DAYS WE DONT WORK' )
*
DEFINE CATEGORY ( WORKDAY )
CONTAINS DAY( WEEKDAY )
EXCEPT CATEGORY( NONWORK )
DESCRIPTION ( 'DAYS WE DO WORK' )
*
DEFINE DAY ( NEWYEARS )
AS ( 1ST DAY OF YEAR)
ADD CATEGORY ( HOLIDAY)
DESCRIPTION ( 'US FEDERAL HOLIDAY' )
*
DEFINE DAY ( NEWYEARS_DAY )
AS ( NEWYEARS WHERE ( DOW IS NOT (SAT SUN))
OR FIRST MONDAY OF YEAR )
ADD CATEGORY ( BANK_HOLIDAY )
DESCRIPTION ( 'UK BANK HOLIDAY' )
*
DEFINE DAY (WEEKLY_BACKUP)
AS (FIRST SUN AFTER WORKDAY)
*
* Submit the weekly backup every Sunday that follows a working day
*
AT 04:40 EVERY WEEKLY_BACKUP
SUB(SYSA.SYS.CNTL(SYSAWKBK))
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 -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts replace word 'MONTH' with current mon... SYNCSORT 11
Search our Forums:

Back to Top