SET MNTH
The SET MNTH statement extracts the month of the year from a date/time field.
SET MNTH
(1)
(2) (3) (4)(5) (6)
(7) (8)
(5) Type (S=short name, L=long name) | |
(4) Destination occ (constant/index) |
(8) Source occurrence (constant/index) |
If the type (item 5) is S (short), the result is returned in the destination field as three characters (for example, Sep). If the type is L (long), the result is returned in the destination field as up to nine characters (for example, September). If the source field is blank, the destination field is set to blank.
The destination must be an alpha field type and the source must be a Gregorian date/time field type with at least the month part.
A non-recoverable error occurs at runtime if the source field does not include the month part.
The following example with TAR WORK FISCAL MONTH set to the first month of the accounting year. The routine then retrieves and displays all the months in a year beginning with that start month.
*
* Set
and display calendar months
*
SET TAR
WORK MM = TAR
WORK FISCAL MONTH
BEG LOOP X = 001
TO 012 STEP 001
SET MNTH TAR
WORK MONTH DESCRIPT X S TAR
WORK MM
DATE ADD TAR
WORK MM 6 1
DISPLAY TAR
WORK MONTH DESCRIPT X (AT APPEARANCE
# )
END LOOP X