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)

(1) T/F execution conditions

(5) Type (S=short name, L=long name)

(2) Destination application ID

(6) Source application ID

(3) Destination field name or PDF

(7) Source field name, PDF, or constant

(4) Destination occ (constant/index)

(8) Source occurrence (constant/index)

Using the Statement

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.

Restrictions

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.

Execution Errors

A non-recoverable error occurs at runtime if the source field does not include the month part.

Related Statements

SET, SET DATE, SET DAY

Example

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