How to: |
Some date functions that calculate business days use a holiday file to define days that are considered holidays. These days are not counted in calculations based on business days.
By default, the holiday file has a file name in the form HDAYxxxx.err and is on your path or, on z/OS under PDS deployment, is a member named HDAYxxxx of a PDS allocated to DDNAME ERRORS. In your procedure or request, you must issue the SET HDAY=xxxx command to identify the file or member name. Alternatively, you can define the file to have any name and be stored anywhere or, on z/OS under PDS deployment, allocate the holiday file as a sequential file of any name or as member HDAYxxxx of any PDS.
In all environments except z/OS under PDS deployment, use the following syntax.
FILEDEF HDAYxxxx DISK {app/|path}/filename.ext
where:
Is the logical name (DDNAME) for the holiday file, where xxxx is any four characters. You establish this logical name by issuing the SET HDAY=xxxx in your procedure or request.
Is the name of the application in which the holiday file resides.
Is the path to the holiday file.
Is the name of the holiday file.
On z/OS under PDS deployment, use the following to allocate a sequential holiday file.
DYNAM ALLOC {DD|FILE} HDAYxxxx DA qualif.filename.suffix SHR REU
On z/OS under PDS deployment, use the following to allocate a holiday file that is a member of a PDS.
DYNAM ALLOC {DD|FILE} HDAYxxxx DA qualif.filename.suffix(HDAYxxx) SHR REU
where:
Is the DDNAME for the holiday file. Your FOCEXEC or request must set the HDAY parameter to xxxx, where xxxx is any four characters you choose. If your holiday file is a member of a PDS, HDAYxxxx must also be the member name.
Is the fully-qualified name of the sequential file that contains the list of holidays or of the PDS with member HDAYxxxx that contains the list of holidays.
The following holiday file, named holiday.data in the c:\temp directory on Windows, defines November 3, 2011 and December 24, 2011 as holidays.
20111103 20111224
The following request against the MOVIES data source uses the FILEDEF command to define this file as the holiday file. The logical name in the FILEDEF command is HDAYMMMM, and the procedure issues the SET HDAY=MMMM command. It then defines the date November 2, 2011 and calculates the next business day.
FILEDEF HDAYMMMM DISK c:\ddrive\ibi\holiday.data SET HDAY = MMMM SET BUSDAYS = _MTWTF_ DEFINE FILE MOVIES NEWDATE/YYMD = '20111102'; NEXTDATE/YYMD = DATEADD(NEWDATE, 'BD', 1); END TABLE FILE MOVIES SUM COPIES NEWDATE NEXTDATE ON TABLE SET PAGE NOPAGE END
The output shows that the next business day after November 2 is November 4 because November 3 is a holiday.
The following sequential file, named USER1.HOLIDAY.DATA defines November 3, 2011 and December 24, 2011 as holidays.
20111103 20111224
The following request against the MOVIES data source uses the DYNAM command to allocate this file as the holiday file. The DDNAME in the DYNAM command is HDAYMMMM, and the procedure issues the SET HDAY=MMMM command. It then defines the date November 2, 2011 and calculates the next business day.
DYNAM ALLOC DD HDAYMMMM DA USER1.HOLIDAY.DATA SHR REU SET HDAY = MMMM SET BUSDAYS = _MTWTF_ DEFINE FILE MOVIES NEWDATE/YYMD = '20111102'; NEXTDATE/YYMD = DATEADD(NEWDATE, 'BD', 1); END TABLE FILE MOVIES SUM COPIES NEWDATE NEXTDATE ON TABLE SET PAGE NOPAGE END
The output shows that the next business day after November 2 is November 4 because November 3 is a holiday.
COPIES NEWDATE NEXTDATE ------ ------- -------- 117 2011/11/02 2011/11/04
The following holiday file, member HDAYMMMM in a PDS named USER1.HOLIDAY.DATA defines November 3, 2011 and December 24, 2011 as holidays.
20111103 20111224
The following request against the MOVIES data source uses the DYNAM command to allocate this file as the holiday file. The DDNAME in the DYNAM command is HDAYMMMM, the member name is also HDAYMMMM, and the procedure issues the SET HDAY=MMMM command. It then defines the date November 2, 2011 and calculates the next business day:
DYNAM ALLOC DD HDAYMMMM DA USER1.HOLIDAY.DATA(HDAYMMMM) SHR REU SET HDAY = MMMM SET BUSDAYS = _MTWTF_ DEFINE FILE MOVIES NEWDATE/YYMD = '20111102'; NEXTDATE/YYMD = DATEADD(NEWDATE, 'BD', 1); END TABLE FILE MOVIES SUM COPIES NEWDATE NEXTDATE ON TABLE SET PAGE NOPAGE END
The output shows that the next business day after November 2 is November 4 because November 3 is a holiday:
COPIES NEWDATE NEXTDATE ------ ------- -------- 117 2011/11/02 2011/11/04
WebFOCUS |