Difference between revisions of "Creating the AskPlus Macro File"

From Vital Soft Wiki
Jump to: navigation, search
>Johno
(Macros Affected by DFTL-HR-OFFSET)
>Johno
(Macros Affected by DFTL-HR-OFFSET)
Line 76: Line 76:
  
 
==== Macros Affected by DFTL-HR-OFFSET ====
 
==== Macros Affected by DFTL-HR-OFFSET ====
In the table which follows, "current", "previous" and "next" are all dtermined by the current system date, less the number of hours specified in the DFLT-HR-OFFSET macro.  If ASK_REFDATE has been set, then "current", "previous" and "next" are determined by the value of ASK_REFDATE.
+
In the table which follows, "current", "prior" and "next" are all dtermined by the current system date, less the number of hours specified in the DFLT-HR-OFFSET macro.  If ASK_REFDATE has been set, then "current", "prior" and "next" are determined by the value of ASK_REFDATE.
 
     {| class="wikitable" style="border-spacing: 2,2,2,2;"
 
     {| class="wikitable" style="border-spacing: 2,2,2,2;"
 
     |Macro Name||Description.
 
     |Macro Name||Description.
Line 86: Line 86:
 
     | FDAY-CUR-MO & LDAY-CUR-MO || Returns the first/last day of the "current" month in CYMD format.
 
     | FDAY-CUR-MO & LDAY-CUR-MO || Returns the first/last day of the "current" month in CYMD format.
 
     |-
 
     |-
     | FDAY-PRI-MO & LDAY-PRI-MO || Returns the first/last day of the "previous" month in CYMD format.
+
     | FDAY-PRI-MO & LDAY-PRI-MO || Returns the first/last day of the "prior" month in CYMD format.
 
     |-
 
     |-
 
     | FDAY-NXT-MO & LDAY-NXT-MO || Returns the first/last day of the "next" month in CYMD format.
 
     | FDAY-NXT-MO & LDAY-NXT-MO || Returns the first/last day of the "next" month in CYMD format.
Line 92: Line 92:
 
     | FDAY-CUR-WK & LDAY-CUR-WK || Returns the first/last day of the "current" week in CYMD format.
 
     | FDAY-CUR-WK & LDAY-CUR-WK || Returns the first/last day of the "current" week in CYMD format.
 
     |-
 
     |-
     | FDAY-PRI-WK & LDAY-PRI-WK || Returns the first/last day of the "previous" week in CYMD format.
+
     | FDAY-PRI-WK & LDAY-PRI-WK || Returns the first/last day of the "prior" week in CYMD format.
 
     |-
 
     |-
 
     | FDAY-NXT-WK & LDAY-NXT-WK || Returns the first/last day of the "next" week in CYMD format.
 
     | FDAY-NXT-WK & LDAY-NXT-WK || Returns the first/last day of the "next" week in CYMD format.
Line 98: Line 98:
 
     | LOAD-DATES-CUR-WK || Loads an array with the 7 days in the "current" week in CYMD format.
 
     | LOAD-DATES-CUR-WK || Loads an array with the 7 days in the "current" week in CYMD format.
 
     |-
 
     |-
     | LOAD-DATES-PRI-WK || Loads an array with the 7 days in the "previous" week in CYMD format.
+
     | LOAD-DATES-PRI-WK || Loads an array with the 7 days in the "prior" week in CYMD format.
 
     |-
 
     |-
 
     | LOAD-DATES-NXT-WK || Loads an array with the 7 days in the "next" week in CYMD format.
 
     | LOAD-DATES-NXT-WK || Loads an array with the 7 days in the "next" week in CYMD format.
 
     |}
 
     |}

Revision as of 23:05, 14 July 2020

AskPlus macros are an easy way to save commonly used calculations. When macros are used, the definition of the macro is expanded and the definition is used as though it had been typed. Macros may contain parameters.

Sample macros:

macro PRINT-AC-PHONE(area-code, phone-nbr) =  "(" cat !format:X3("ZZZ", area-code) cat ") " cat !format:X8("ZZZ-ZZZZ", phone-nbr)
macro MEM-PHONE =  %PRINT-AC-PHONE(MEMBER-FILE.PHONE-AC, MEMBER-FILE.PHONE)
macro MEM-CSZ = !CVT:X37(MEMBER-FILE.CITY splice "," join MEMBER-FILE.STATE join %fzip)
macro CYMD-TODAY = !datext:x8($SECONDS - %DFLT-HR-OFFSET, "CYMD" )
macro CU-NAME = "Vital Soft Employees Credit Union"
macro share-is-open = (SHARE-FILE.REST-FLAG-11 <> 80,81 and SHARE-FILE.REST-FLAG-12 <> 80, 81 and SHARE-FILE.DESC-ABRV <> "COS")
macro loan-is-chgoff = (LOAN-FILE.ACTION = "O")

The above examples demonstrate a variety of different macros, some with parameters and some without. Several of the macro definitions include other macros. When used, the macro name is always preceded by a percent sign (%macro-name).

Default Spectrum Macro Definitions

Vital Soft provides two sets of default macros for Spectrum clients. The definitions are provided as part of the AskPlus installation and they can also be downloaded separately. The definitions provided in macrodef.samp should not be modified by individual Credit Unions. Vital Soft will periodically provide updates to macrodef so any local changes could be overwritten in future releases. On the other hand, Credit Unions are encouraged to make changes to the definitions provided in usermdef.samp by either modifying existing macros, or by adding new macros.

Accessing a Macro File

To be used by Visimage3 or AskPlus, the macro definitions must be loaded into a macro file. Once created, the macro file must be referenced either by the AskPlus assign macro command, or in a Visimage Manager File Macro statement.

Creating the Macro File

By default, most credit unions store the macro file in /ASKPLUS/visimage/macro. To create this file using the definitions provided by Vital Soft, follow these steps.

  • In the /ASKPLUS/visimage directory, compare the new macrodef.samp file to your existing macrodef file.
  • Contact Vital Soft if you have questions about any differences before replacing the current macrodef file
  • In the /ASKPLUS/visimage directory, compare the new usermdef.samp file to your existing usermdef file.
  • Decide if there are any new macros that you wish to incorporate in your existing usermdef file.
# login as the askplus user
cd /ASKPLUS/visimage
# After reviewing the differences between macrodef and macrodef.samp
cp -p macrodef macrodef.bkup
cp -p macrodef.samp macrodef
# After comparing usermdef and usermdef.samp
cp -p usermdef usermdef.bkup
# Edit usermdef and make any appropriate changes
../load_macros

The output from running the script should look smething like this:

/ASKPLUS/askplusx
Copyright LSWE (c) 1978-2020. Distributed by Vital Soft, Inc.
ASKPLUS/Unix E.8.5.3 (64 bits) ready ! Tue Jul 14 09:57:23 2020
newreg xeqname:x100=^XEQNAME
xeq #xeqname, quiet
** assign macro ./macro
** ---
** Load macros from /ASKPLUS/visimage/macrodef ...
** Visimage macros for Fiserv Spectrum users.
** Last updated August 8, 2019.
** ---
** Load macros from ./usermdef ...
** ---

exit
======================================================
Successfully created macro file: ./macro
======================================================
  • The load_macros script will load macro definitions from /ASKPLUS/visimage/macrodef and either /ASKPLUS/visimage/usermdef OR ./usermdef.
  • The load_macros script can be launched with two optional parameters:
../load_macros ver fname
Where:
ver - Is a valid AskPlus version, for example e852
fname - Is the name of the macro file to be created.

%DFLT-HR-OFFSET

This macro sets a default time offset in hours which is used by some date macros, like CYMD-TODAY and CYMD-YESTERDAY. The macro allows reports run early in the morning to use the previous day's date as the "current" date. By default, the value is 6 hours, meaning that jobs which are run prior to 6 am will behave as though they were run before midnight.

macro DFLT-HR-OFFSET = !IIF((6 * 3600) splice "|" splice 0, (!datext($SECONDS, "cymd") = (($YEAR * 10000) + ($MONTH * 100) + $MONTHDAY)))
  • The !IIF logic shown above ensures that the offset will be ignored when ASK_REFDATE is set.
  • To disable the offset, set it to 0. (Do not delete the macro.)
  • The value is actually a number of seconds. Since there are 3600 seconds in one hour, the offset is calculated as 6*3600.

Macros Affected by DFTL-HR-OFFSET

In the table which follows, "current", "prior" and "next" are all dtermined by the current system date, less the number of hours specified in the DFLT-HR-OFFSET macro. If ASK_REFDATE has been set, then "current", "prior" and "next" are determined by the value of ASK_REFDATE.

Macro Name Description.
CTMD-TODAY Returns the "current" day in CYMD format.
CTMD-YESTERDAY Returns the "previous" day in CYMD format.
FDAY-CUR-MO & LDAY-CUR-MO Returns the first/last day of the "current" month in CYMD format.
FDAY-PRI-MO & LDAY-PRI-MO Returns the first/last day of the "prior" month in CYMD format.
FDAY-NXT-MO & LDAY-NXT-MO Returns the first/last day of the "next" month in CYMD format.
FDAY-CUR-WK & LDAY-CUR-WK Returns the first/last day of the "current" week in CYMD format.
FDAY-PRI-WK & LDAY-PRI-WK Returns the first/last day of the "prior" week in CYMD format.
FDAY-NXT-WK & LDAY-NXT-WK Returns the first/last day of the "next" week in CYMD format.
LOAD-DATES-CUR-WK Loads an array with the 7 days in the "current" week in CYMD format.
LOAD-DATES-PRI-WK Loads an array with the 7 days in the "prior" week in CYMD format.
LOAD-DATES-NXT-WK Loads an array with the 7 days in the "next" week in CYMD format.