Marysue

CA Tuesday Tip: (CA 7) Calendars (cont)

Discussion created by Marysue Employee on Feb 25, 2014
Latest reply on Feb 25, 2014 by Phon_Shuffitt

Last week we ended the calendar discussion with explanation of the SCHONLY field.  This week we are going to discuss perpetual calendars (PCAL).  R11.3 added the PCAL enhancement.  With the use of PCALs you no longer have to update each calendar every year—calendars ‘create’ themselves now the first time they are referenced in CA 7.  In this discussion I am showing the PCAL definitions to create the following calendar:

********************************************************************************

**                                                                            **

**                      CA-7 BASE CALENDAR      SCAL14WD                      **

**                         YEAR 2014   GEN DATE 14.049                         *

**                              SCHD DAY ONLY = N                              *

********************************************************************************

********************************************************************************

**                                                                            **

**  MONTH 01                          JAN                                     **

**                                                                            **

**                                                                            **

**            SUN     MON     TUE     WED     THU     FRI     SAT             **

**                                                                            **

**                                   (B01)     02      03                     **

**                     06      07      08      09      10                     **

**                     13      14      15      16      17                     **

**                             21      22      23      24                     **

**                     27      28      29      30    .E01.                    **

**                                                                            **

********************************************************************************

********************************************************************************

**                                                                            **

**  MONTH 02                          FEB                                     **

**                                                                            **

**            SUN     MON     TUE     WED     THU     FRI     SAT             **

**                                                                            **

**                                                           (B02)            **

**                     03      04      05      06      07                     **

**                     10      11      12      13      14                     **

**                             18      19      20      21                     **

**                     24      25      26      27    .E02.                    **

**                                                                            **

********************************************************************************

********************************************************************************

**                                                                            **

**  MONTH 03                          MAR                                     **

**            SUN     MON     TUE     WED     THU     FRI     SAT             **

**                                                                            **

**                                                           (B03)            **

**                     03      04      05      06      07                     **

**                     10      11      12      13      14                     **

**                     17      18      19      20      21                     **

**                     24      25      26      27      28                     **

**                   .E03.                                                    **

**                                                                            **

********************************************************************************

********************************************************************************

**                                                                            **

**  MONTH 04                          APR                                     **

**                                                                            **

**            SUN     MON     TUE     WED     THU     FRI     SAT             **

**                                                                            **

**                           .B04.     02      03      04                     **

**                     07      08      09      10      11                     **

**                     14      15      16      17      18                     **

**                     21      22      23      24      25                     **

**                     28      29    .E04.                                    **

**                                                                            **

********************************************************************************

********************************************************************************

**                                                                            **

**  MONTH 05                          MAY                                     **

**                                                                            **

**            SUN     MON     TUE     WED     THU     FRI     SAT             **

**                                                                            **

**                                           .B05.     02                     **

**                     05      06      07      08      09                     **

**                     12      13      14      15      16                     **

**                     19      20      21      22      23                     **

**                             27      28      29      30    (E05)            **

********************************************************************************

********************************************************************************

**                                                                            **

**  MONTH 06                          JUN                                     **

**                                                                            **

**            SUN     MON     TUE     WED     THU     FRI     SAT             **

**                                                                            **

**           (B06)     02      03      04      05      06                     **

**                     09      10      11      12      13                     **

**                     16      17      18      19      20                     **

**                     23      24      25      26      27                     **

**                   .E06.                                                    **

**                                                                            **

********************************************************************************

********************************************************************************

**                                                                            **

**  MONTH 07                          JUL                                     **

**                                                                            **

**            SUN     MON     TUE     WED     THU     FRI     SAT             **

**                                                                            **

**                           .B07.     02      03                             **

**                     07      08      09      10      11                     **

**                     14      15      16      17      18                     **

**                     21      22      23      24      25                     **

**                     28      29      30    .E07.                            **

**                                                                            **

********************************************************************************

********************************************************************************

**                                                                            **

**  MONTH 08                          AUG                                     **

**                                                                            **

**            SUN     MON     TUE     WED     THU     FRI     SAT             **

**                                                                            **

**                                                   .B08.                    **

**                     04      05      06      07      08                     **

**                     11      12      13      14      15                     **

**                     18      19      20      21      22                     **

**                     25      26      27      28      29                     **

**           (E08)                                                            **

**                                                                            **

********************************************************************************

********************************************************************************

**                                                                            **

**  MONTH 09                          SEP                                     **

**                                                                            **

**            SUN     MON     TUE     WED     THU     FRI     SAT             **

**                                                                            **

**                   (B09)     02      03      04      05                     **

**                     08      09      10      11      12                     **

**                     15      16      17      18      19                     **

**                     22      23      24      25      26                     **

**                     29    .E09.                                            **

**                                                                            **

********************************************************************************

********************************************************************************

**                                                                            **

**  MONTH 10                          OCT                                     **

**                                                                            **

**            SUN     MON     TUE     WED     THU     FRI     SAT             **

**                                                                            **

**                                   .B10.     02      03                     **

**                     06      07      08      09      10                     **

**                             14      15      16      17                     **

**                     20      21      22      23      24                     **

**                     27      28      29      30    .E10.                    **

**                                                                            **

********************************************************************************

********************************************************************************

**                                                                            **

**  MONTH 11                          NOV                                     **

**                                                                            **

**            SUN     MON     TUE     WED     THU     FRI     SAT             **

**                                                                            **

**                                                           (B11)            **

**                     03      04      05      06      07                     **

**                     10              12      13      14                     **

**                     17      18      19      20      21                     **

**                     24      25      26              28                     **

**           (E11)                                                            **

**                                                                            **

********************************************************************************

********************************************************************************

**                                                                            **

**  MONTH 12                          DEC                                     **

**                                                                            **

**            SUN     MON     TUE     WED     THU     FRI     SAT             **

**                                                                            **

**                   .B12.     02      03      04      05                     **

**                     08      09      10      11      12                     **

**                     15      16      17      18      19                     **

**                     22      23      24              26                     **

**                     29      30    .E12.                                    **

**                                                                            **

**                                                                            **

********************************************************************************

On the CALENDAR statement in the initialization file:

CALENDAR,DSN=MARYSUE.CA7.CALENDAR,PCALDSN=MARYSUE.CA7.PCAL

And in library MARYSUE.CA7.PCAL there is a member called PCALYYWD which looks like this:

********************************* Top of Data **********************************

*

* (WD) Every Monday - Friday except bank holidays. (N)

*

* Note * DO NOT CHANGE THIS CALENDAR

* ****** Use (MF) to change RDAY and use the Mon-Fri calendar.

*

set weekend nonschedule

include USFEDHOL

set holiday nonschedule

******************************** Bottom of Data ********************************

Notice that the PCALYYWD member has an include for member USFEHOL.  That member looks like this:

********************************* Top of Data **********************************

*

define new year's day as jan 1

set new year's day holiday

*

define martin luther king's birthday as third mon in jan

set martin luther king's birthday holiday

*

define washington's birthday as third mon in feb

set washington's birthday holiday

*

define memorial day as last mon in may

set memorial day holiday

*

define independence day as july 4

set independence day holiday

*

define labor day as first mon in sept

set labor day holiday

*

define columbus day as 2nd mon in oct

set columbus day holiday

*

define veteran's day as 11/11

set veteran's day holiday

*

define thanksgiving day as 4th thurs in nov

set thanksgiving day holiday

*

define christmas as 25 dec

set christmas holiday

******************************** Bottom of Data *******************************

After putting these two members in the PCAL library, be sure that there is no SCALyyWD calendars in the CALENDAR library (or loadlib or steplib that CA 7 can access), then you can create the calendar with a PRINT command.  You can also create the calendar(s) by doing a LIST function on the DB.2.8 (CALMOD) screen or by doing a RESOLV that will use this calendar.

To test this I usually create a new calendar name that is not used in a current calendar in your shop—that way you are not affecting the calendars you have created otherwise.

The next Tuesday’s Tip will drill down to the various statements for building the PCAL members.

Have a great week!

Outcomes