Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

First Sunday after the first working day of the month

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
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    Post subject: First Sunday after the first working day of the month
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10211
Location: italy

PostPosted: Mon Jul 12, 2010 10:06 pm    Post subject: Reply to: First Sunday after the first working day of the mo
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10211
Location: italy

PostPosted: Mon Jul 12, 2010 10:30 pm    Post subject: Reply to: First Sunday after the first working day of the mo
Reply with quote

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

http://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

Active Member


Joined: 07 Feb 2009
Posts: 989
Location: Oostende, Belgium

PostPosted: Tue Jul 13, 2010 1:58 am    Post subject:
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Tue Jul 13, 2010 10:39 am    Post subject:
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    Post subject: Re: First Sunday after the first working day of the month
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    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts How to get previous month in SYMNAMES Suganya87 SYNCSORT 9 Fri Oct 28, 2016 1:37 pm
No new posts SCRNAME not working on my mainframe? mrsidhu12 TSO/ISPF 7 Thu Sep 01, 2016 2:17 pm
No new posts 2 same CLIST pgm but with different n... boyti ko CLIST & REXX 5 Fri Jun 03, 2016 4:55 pm
No new posts REXX Screen not working due to LINKED... sundarkudos CLIST & REXX 1 Mon May 09, 2016 1:44 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us