Subject: | |
From: | |
Reply To: | Dave Powell, MMfab |
Date: | Fri, 4 Dec 2009 13:05:27 -0800 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
:print workdays.func.shr;page=0
option nolist
parm REAL_DAYS = 0 NOISE_LEVEL = 0
if bound (WDS_ERRORS)
deletevar WDS_@
endif
setvar WDS_ERRORS 0
setvar WDS_NEW_CYMD HPYYYYMMDD
if not numeric ("0!REAL_DAYS")
setvar WDS_ERRORS WDS_ERRORS + 1
echo 1st input must be digits only, number of 'real' (calendar) &
days we have
elseif !REAL_DAYS > 60
setvar WDS_ERRORS WDS_ERRORS + 1
echo 1st input (number of real "calendar" days we have) &
can't be more than 60
endif
if not numeric ("0!NOISE_LEVEL")
setvar WDS_ERRORS WDS_ERRORS + 1
echo 2nd input must be numeric unless it is omitted
echo 0 = no displays (default)
echo 1 = display final result only
echo 2 or higher = also display each days's status
endif
if WDS_ERRORS > 0
echo **exiting and returning '1' (the programmer's guess)**
return 1
endif
if !REAL_DAYS = 0
setvar WDS_CNT 0
setvar WDS_HOLIDAY HOLIDAY.FUNC.SHR(WDS_NEW_CYMD)
setvar WDS_WORKDAY not (WDS_HOLIDAY or HOL_DOW=1 or HOL_DOW=7)
return 0
endif
setvar WDS_CNT 0
setvar I 0
while (setvar (I, I + 1) <= !REAL_DAYS)
setvar WDS_NEW_CYMD TOMORROW.FUNC.SHR(WDS_NEW_CYMD)
setvar WDS_HOLIDAY HOLIDAY.FUNC.SHR(WDS_NEW_CYMD)
setvar WDS_WORKDAY not (WDS_HOLIDAY or HOL_DOW=1 or HOL_DOW=7)
if WDS_WORKDAY
setvar WDS_CNT WDS_CNT + 1
endif
if !NOISE_LEVEL > 1
echo ![rht("00!I",3)] date=!WDS_NEW_CYMD&
; day-of-week=!TOM_NEXT_DOW !HOL_DOW&
; holiday=![lft("!WDS_HOLIDAY ", 5)]&
; workday=![lft("!WDS_WORKDAY ", 5)]
endif
endwhile
if !NOISE_LEVEL <> 0
echo there are !WDS_CNT work days in the next !REAL_DAYS days
endif
return WDS_CNT
# WORKDAYS Dave Powell, 06/26/2009
#
# Function to return the number of work days in the next
# "x" real (calendar) days.
#
# 1st function input parm is the number of real days we have,
# (such as days until the end of the month)
# 2nd parm controls the amount of info it displays.
#
# Possible uses: any job that wants to sound an alarm if
# we don't have enough work days before some
# deadline, such as a month-end warning job
# complaining if we are too close to the end
# of the month.
# Example
# :XEQ EOM.SYSCMD.SHR (check #-of-days left in the month)
# :IF WORKDAYS.FUNC.SHR (EOM_DAYS_TILL) < 5
# <complain-a-lot>
# :ENDIF
#
# "0" is a valid input, and returns "0".
#
# This rtn treats Sat & Sun as non-work days. Sites that
# work Saturdays will need to tweak the logic.
#
#
# Dependencies: HOLIDAY.FUNC.SHR
# TOMORROW.FUNC.SHR
# (locations are hard-coded, and don't need to be in the
# path, but sites that don't want to create a "FUNC.SHR"
# group & acct will need to tweak the fine-print).
#
# --------------------------------------------------
# To do:
#
#
# --------------------------------------------------
# See also: HOLIDAY.FUNC.SHR, TOMORROW.FUNC.SHR
# HOLITEST.TESTCMD.SHR REALDAYS.FUNC.SHR
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|
|
|