Several examples are listed. Select the one you wish to see from the list below.
If you print this page, it will print all examples listed below. If you wish to know how to create a MACROFILE, go to
Adding a MACROFILE at the end of the samples list below.
=CCYYMMDD Macro Definition File
for systems with 'CCYYMMDD' dates
(SMACRO)
purge macro (Required for purging and re-building)
assign macrofile MACRO existing macro file.)
macro
MDY(d1) = !datext:x6(!datint ( d1, "ymd" ), "mdy") &
<<converts a CYMDdate to MDY format>>
macro
YMD(d1) = !datext:x6(!datint ( d1, "cymd" ), "ymd") &
<<converts a CYMDdate to YMD format>>
macro
DIFF(d1,d2) = &
(!cvt:p20(!datint(d2,"cymd") / 86400)) -&
(!cvt:p20(!datint(d1,"cymd") / 86400))&
<<calculates #of days btw 2 cymd-dates>>
macro
DAYS-OLD(d1) = &
!cvt:p20(($seconds - !datint(d1,"cymd")) / 86400) &
<<calculates #of days old from TODAY>>
Yesterday and Today
are great macros to use with SELECTION criteria for daily audit reports.
ie: DATE-ADDED = %YESTERDAY
macro TODAY = !datext:x8($seconds, "cymd") &
<<Today's date in CYMD format>>
macro
YESTERDAY = !datext:x8(($seconds - 86400) , "cymd") &
<<Yesterday's date in CYMD format>>
Examples of macros which string several fields together.
Substitute your specific set.ITEM names.
macro FULL-NAME = !CVT:x30(
set.LAST-NAME splice "," &
join
set.FIRST-NAME join
set.MIDDLE-INITIAL ) &
<<LAST, FIRST+MIDDLE init>>
macro CITY-ST-ZIP = !CVT:x30(
set.CITY splice "," &
join
set.STATE cat " " join
set.ZIPCODE ) &
<<Joins CITY,STATE Zip on same line>>
macro ADDCENTURY (date) = !CVT:X2("19" + (date >< "500000")/$TRUE) CAT date
<<Concatenates the century, dates prior to "50" are 2000>>
Macro Definition File
for systems with 'YYMMDD' dates
(SMACRO)
purge macro (Required for purging and re-building
assign macrofile MACRO existing macro file.)
macro
MDY(d1) = !datext:x6(!datint ( d1, "ymd" ), "mdy") &
<<converts a YMDdate to MDY format>>
macro
CMDY(d1) = !datext:x8(!datint ( d1, "ymd" ), "cymd") &
<<converts a YMDdate to CMDY format>>
macro
DIFF(d1,d2) = &
(!cvt:p20(!datint(d2,"ymd") / 86400)) -&
(!cvt:p20(!datint(d1,"ymd") / 86400))&
<<calculates #of days btw 2 ymd-dates>>
macro
DAYS-OLD(d1) = &
!cvt:p20(($seconds - !datint(d1,"ymd")) / 86400) &
<<calculates #of days old from TODAY>>
Yesterday and Today
are great macros to use with SELECTION criteria for daily audit reports.
ie: DATE-ADDED = %YESTERDAY
macro TODAY = !datext:x6($seconds, "ymd") &
<<Today's date in YMD format>>
macro
YESTERDAY = !datext:x6(($seconds - 86400) , "ymd") &
<<Yesterday's date in YMD format>>
Examples of macros which string several fields together.
Substitute your specific set.ITEM names.
macro FULL-NAME = !CVT:x30(
set.LAST-NAME splice "," &
join
set.FIRST-NAME join
set.MIDDLE-INITIAL ) &
<<LAST, FIRST+MIDDLE init>>
macro CITY-ST-ZIP = !CVT:x30(
set.CITY splice "," &
join
set.STATE cat " " join
set.ZIPCODE ) &
<<Joins CITY,STATE Zip on same line>>