AskPlus 8.4.2
Revision as of 20:38, 2 February 2018 by >Johno
AskPlus E.8.4.2
AskPlus E.8.4.2 was released in March 2017.
Highlights:
- New date formatting options.
- New text functions: left, right, mid, replacechar, purgechar, upper, lower and many more
- Several bug fixes
Backwards Compatibility:
- User Exits !isdate and !isnum:
- The return values of !isdate and !isnum have been modified and consequently may not be fully backwards compatible with previous versions of AskPlus. See below for more details.
- Users should scan production reports to search for any occurrences of these operators prior to installing this version as the default version.
- There are two options for jobs (contexts) that use these operators:
- Rename !isdate(...) to !isdateorig(...) and rename !isnum(...) to !isnumorig(...), or
- Modify the job (context) to use the new operators which now return True/False instead of the actual date or number.
- Contact support if you would like assistance with this update.
Enhancements:
- Report Output to ASCII file:
- By default, Report output to an ASCII file will only fill the last page with blank lines (or a formfeed when CCTL is specified) if the file is created by Visimage, or when a trailer statement (Z1, Z2) is specified. To force the last page to be filled with blank lines in other situations, use the FILLPAGE keyword on the OUT statement.
REPORT OUT=filename, DELETE, FILLPAGE ...
- Updated System Variables:
- $DQUOTE - Double Quote
- This variable returns the value of a double quote which can be used in an expression. For example,
D1, $DQUOTE splice MEMBER-FILE.NAME splice $DQUOTE, 1 left
- Updated Special Operators:
- !getval:typelen(filename.filename, parm])
- GetVal will strip trailing carriage return (\r) characters from a DOS formatted file (previously only linefeed (\n) chars were stripped.)
- If no typelen is specified, the default return length is automatically calculated.
- !isdate(parm[, "format"])
- Now returns True/False (K1) if parm is a valid date. (Previously the actual date was returned when true.)
- The format is now optional. If not specified a CYMD format is assumed.
- The original version is still available with the name !isdateorig
- !isnum(parm)
- Now returns True/False (K1) if parm is numeric. (Previously the return value was the actual number, or 0.)
- Any numeric parm returns True
- An ASCII value that contains only digits and optional sign and decimal point returns True.
- (At least one digit is required.)
- The original version is still available with the name !isnumorig
- !getstr(str, "off, len") - See !mid (below)
- Len is no longer required, default is the rest of the str (starting at off).
- Offset can be passed as a numeric value (since len is no longer required).
- !datint(date, ["format"])
- If no format is specified, "CYMD" will be used
- When converting dates, !datint now supports the formatting characters '-' and '/', if the specified format is one of CYMD, YMD, MDCY, MDY, DMCY and DMY. For example: "3/15/2016" and "9/9/2009" can be converted using the format "MDCY".
- !datext(int-date, ["format"])
- Where "int-date" is any date in internal format (usually a call to !datint)
- If no format is specified, "CYMD" will be used
- New date formats for displaying and converting dates:
- The characters d (day), m (month) and y (year) have a special meaning according to the table shown below.
- All other characters are treated as insertion characters - see examples.
- When DDD, DDDD, MMM or MMMM appear in all caps, the corresponding name will also be all upper case.
- (Any other combination will display the day/month name using initial caps. Case has no meaning for d, dd, m, mm, yy and yyyy.)
Format Chars | Meaning | Output Length |
d, dd | Day of month | One or two digits. (dd is always two). |
ddd, dddd | Day name | Three chars (ddd) or full name (dddd). |
m, mm | Month number | One or two digits. (mm is always two). |
mmm, mmmm | Month name | Three chars (mmm) or full name (mmmm). |
yy, yyyy | Year | Two digits (yy) or four (yyyy). |
- Examples:
Date Value | Format | Result |
20160704 | "mm/dd/yyyy" | 07/04/2016 |
20160704 | "dd-MMM" | 04-JUL |
20160704 | "d-m-yy" | 4-7-16 |
20160714 | "ddd mmmm d, yyyy" | Thu July 14, 2016 |
20160714 | "DDDD MMMM DD, YY" | THURSDAY JULY 14, 16 |
- For CYMD dates, these formats can be used as print formats (Visimage & AskPlus) and with !format()
- New Special Operators:
- !uniqueid(number)
- Returns a unique ID based on the input number, example: !uniqueid(member-file.account)
- The generated ID is guaranteed to be unique and repeatable
- The calculation of the unique ID is mathematically reversible, however, no reverse function is provided and the algorithm is not documented
- This function will be useful if you want to provide a 3rd party a unique identifier for a member without disclosing the member's actual account number
- !iseven(parm)
- Similar to !even, except !iseven returns True/False (1/0), not 1 and -1.
- !isint(parm)
- Similar to !isnum returns True/False (K1) if parm is integer.
- If parm is type E or R - return False
- If parm is any other numeric type - return True
- An ASCII value that contains only digits and an optional sign returns True.
- (At least one digit is required.)
- !mid(str, "off[,len]") - return a substring (see note)
- Return the middle part of str for the specified off and len. (off is 1 based.)
- If the len is not specified, the remainder of str is returned (starting at off.)
- Functionally equivalent to !getsr().
- !left(str, len) - return the first len characters of a string (see note)
- Return the left part of str for the specified len (off = 1).
- !right(str, len) - return the last len characters of a string. (see note)
- Return the right part of str for the specified len.
- Trailing blanks are counted. Use !right(!rtrim(str), len) to eliminate trailing blanks.
- Special note for !mid, !left & !right:
- In most cases the first parm will be an ASCII (string) value, however, these operators will accept numeric values. The value will be converted to a character string and then the appropriate chars will be extracted.
- !trim(str) - return a trimmed string
- Trim leading & trailing blanks (and control characters < BLANK) from str.
- !ltrim(str) - return a trimmed string
- Trim all leading (left) blanks (and control characters < BLANK) from str.
- !rtrim(str) - return a trimmed string
- Trim all trailing (right) blanks (and control characters < BLANK) from str.
- !upper(str) - return an upshifted string
- Upshift all characters in str.
- Functionally equivalent to !shift(str, "U")
- !lower(str) - return an downshifted string
- Downshift all characters in str.
- Functionally equivalent to !shift(str, "D")
- !initcap(str) - return an string using InitCap logic
- Upshift the first character after each non letter in str (Downshift all of the other characters.)
- Similar to !shift(str, "I"), except shift only upshifts after a BLANK, whereas initcap upshifts after every non alpha character.
!initcap("PATRICK O'BRIEN") = "Patrick O'Brien" !shift("PATRICK O'BRIEN", "I") = "Patrick O'brien"
- !keepchar(str, chars) - return a string keeping only certain chars
- Parse str and only keep the characters present in chars (all other characters are purged.)
- !purgechar(str, chars) - return a string purging certain chars
- Parse str and purge/drop any characters present in chars (all other characters are kept.)
!purgechar(NAME, """'") will purge all double and single quotes in NAME.
- !replacechar(str, "c1c2") - return a string replacing chars
- Parse str and replace all occurrences of c1 with c2.
- Only the first two characters of parm2 are used.
!replacechar(NAME, """'") will replace all double quotes in NAME with a single quote.
- !minval(parm1, parm2) - return the min value using a numeric comparison
- Return the smaller value (numerically) between parm1 and parm2
- Any ASCII parms are converted to R4 before the compare is done.
- !maxval(parm1, parm2) - return the max value using a numeric comparison
- Return the larger value (numerically) between parm1 and parm2
- Any ASCII parms are converted to R4 before the compare is done.
- !minstring(parm1, parm2) - return the min value using a string/ASCII comparison
- Return the smaller value (using a string comparison) between parm1 and parm2
- Any numeric parms are converted to ASCII before the compare is done.
- !maxstring(parm1, parm2) - return the max value using a string/ASCII comparison
- Return the larger value (using a string comparison) between parm1 and parm2
- Any numeric parms are converted to ASCII before the compare is done.
- New Formats (Edit Mask) for Dates
- For dates stored in CYMD format the new !Datext formats described above can be used directly as a print format.
- These formats are valid in Visimage3 and on AskPlus print statements and with the !format() operator.
- If dates are stored in a format other than CYMD, a combination of !datint and !datext is still necessary.
D1, LOAN-FILE.DUE-DATE, "Ddd Mmmm d, yyyy", tab1
- Fixes:
- Fix a bug in !cymd-diff-mths - The wrong number of months could be calculated when one of the dates was eom.
- Fix Convert Bug (Float to Int), for example, "67.71" * 100 did not work.
- In a few instances, reading a float from an ASCII file and converting to INT had a rounding error in earlier releases.
- Limit warning messages in the selection to print a maximum of 50 times.
- Previously available in Report/Save, now also in Find.
- Modify !isnum() and !isdate() to return True/False (K1) instead of attempting to return a numeric value
- Previous versions of !isnum returned inconsistent results
- For backwards compatibility rename the original versions as !isnumorig() and !isdateorig()
- Fix !Even() on Itanium.
- Fix a core dump when opening SD or INDEXED files with missing files or inconsistent access permissions
- Fix a core dump when the select file cannot be created.