Home page  
Help >
CalcObject Statement: Set
Version 7.11
CalcObject Statement: Set CalcObject Statement: Set
    Syntax: SET vname=<string operand> [(n)]
            SET vname=<numeric operand> [(n.d)]
            SET vname=<string operand1> ! <string operand2> ! ...
    Placement: RETURN Section, EVERY Section, ATEND Section or
             R_INITIAL section
    Description: Assigns a value to a user defined string 
       variable, vname, which may be either local or global. 
 
       The length of a local variable is constant within a 
       REPORT and is defined to be the maximum length 
       attained by any SET statement.
 
       The length of a global string variable is variable;
       however, a global string variable occupies a constant
       number of positions within a PRINT class statement.
 
       In the first form, the simple <string operand> is
       copied to the string variable vname. <string operand> 
       may be an alpha field, a local string variable, a global
       string variable, a string constant or a string valued
       function.
 
       In the second form, the simple <numeric operand> is
       converted to a string and copied to the string variable
       vname. <numeric operand> may be a numeric field, a local
       numeric variable, a global numeric variable or an
       unsigned numeric constant.
 
       In the third form, two or more simple <string operand>s
       are concatenated and the result is copied to the string
       variable vname.
 
       The value of an alpha variable is moved to the
       RETURN line only when the variable appears on the
       left side of an equals in a SET statement. The 
       value of an alpha variable after being modified by
       nxt(), nxtd() or nxtn() will not be moved to the
       RETURN line unless the statement "SET vname=vname"
       is performed.
 
       Options which apply to the SET command are:
          L - remove leading blanks from result string
          N - if result is SQL-null, make result non SQL-null; 
              refer to CALC-SET-IF with SQL null
          S - force result string to lower case
          T - trim trailing blanks from result string; this
              is meaningful only is vname is a global variable
          U - force result string to upper case
 
     7.5.1  Legal string operands are:
         String constant enclosed in ' or "
         Alpha fields
         Alpha local variables
         Alpha global variables
         String functions
 
     7.5.2  String valued functions
 
       The following is a list of string-valued functions.
 
       In the following descriptions, 
        . vname must be a global string variable
        . dstring may be an alpha constant, an alpha variable, 
          or an alpha field;
        . n may be a numeric constant, a numeric variable, or a
          numeric field;
        . text is a TEXT field.
 
     7.5.3  edate() function - edit date 
     7.5.4  edate64() function - edit datetime
     7.5.5  isnull() function - test for SQL NULL
     7.5.6  lower() function - convert string to lower case 
     7.5.7  ltrim() function - trim blanks from left of string
     7.5.8  nxt() function - retrieve sub-string
     7.5.9  nxtd() function - extract sub-string
     7.5.10  nxtn() function - extract sub-string
     7.5.11  nxtw() function - extract sub-string
     7.5.12 proper() function - convert string to proper name case
     7.5.13 rtrim() function - trim spaces from right of string
     7.5.14 squeeze() function - convert multiple spaces
     7.5.15 trim() function - trim spaces from right of string
     7.5.16 upper() function - convert string to upper case 
     7.5.17 _words() function - convert number to words
     7.5.18 _present() function - record status
     7.5.19 timestr() function - convert time to string
     7.5.20 substr() function - extract sub-string from string
     7.5.21 _porter() function - porter stemming function
     7.5.22 _soundex() function - soundex fuzzy match function
     7.5.23 _phonic() function - phonic fuzzy match function
     7.5.24 _metaphone() function - metaphone fuzzy match function
 
edate() function - edit date
         The string valued function edate(jd,template)
         converts the numeric date since January 1, 1753 into
         a date string. "jd" is the numeric date in the 
         form of a constant number, a numeric variable or a
         numeric field. If "jd" is 0, it represents the current 
         date.
   
         "template" is an editing template in the form of a
         constant string, a string variable or a string field.
 
         Each 'm' or 'M' represents a digit in the month (right to left);
         each 'd' or 'D' represents a digit in the day (right to left);
         each 'y' or 'Y' represents a digit of the year (right to left);
         each 'x' or 'X' represents a character of the mnemonic month (left to right);
         each 'z' or 'Z' represents a character of the mnemonic day (left to right);
 
         If the year is edited as 'yy', it will represent the
         last two digits of the year. If the year is edited
         as 'yyyy' it will represent the absolute year from 
         1753 to 4999.
   
         If the [,template] argument is omitted a default 
         template 'mm/dd/yy' is assumed.
 
edate64() function - edit datetime
         The string valued function edate64(jd,template)
         converts the numeric datetime into a string. The numeric
         datetime is the number of days since January 1, 1753 plus
         the time expressed as a fractional day. "jd" is the numeric
         datetime in the form of a constant number, a numeric variable
         or a numeric field. If "jd" is 0, it represents the current 
         datetime.
   
         "template" is an editing template in the form of a
         constant string, a string variable or a string field.
 
         Each 'm' or 'M' represents a digit in the month (right to left);
         each 'd' or 'D' represents a digit in the day (right to left);
         each 'y' or 'Y' represents a digit of the year (right to left);
         each 'x' or 'X' represents a character of the mnemonic month (left to right);
         each 'z' or 'Z' represents a character of the mnemonic day (left to right);
 
         If the year is edited as 'yy', it will represent the
         last two digits of the year. If the year is edited
         as 'yyyy' it will represent the absolute year from 
         1753 to 4999.
 
         Each 'h' or 'H' represents a digit in the hour (right to left);
         each 'n' or 'N' represents a digit in the minute (right to left);
         each 's' or 'S' represents a digit of the second (right to left);
         each 't' or 'T' represents a digit of the fractional second (left to right);
         each 'a' or 'A' represents a character of the AM/PM suffix (left to right);
 
         If the 'a' or 'A' suffix is not specified, a 24 hour clock
         format is used; otherwise, a 12 hour clock is used.
   
         If the [,template] argument is omitted a default 
         template 'mm/dd/yyyy hh:nn:ss.ttt' is assumed.
 
nxt() function - extract sub-string
       Syntax: nxt(vname)
               nxt(text)
       Description: skips leading blanks, returns the sub-
          string up to the next blank or end, then removes
          the skipped and returned characters from vname.
 
nxtd() function - extract sub-string
       Syntax: nxtd(vname,dstring)
               nxtd(text,dstring)
       Description: skips leading characters specified by 
          dstring, returns the sub-string up to the next
          character specified by dstring or end, then removes
          the skipped and returned characters from vname.
          Note: nxt(vname) <==> nxtd(vname," ")
 
nxtn() function - extract sub-string
       Syntax: nxtn(vname,n)
               nxtn(text,n)
       Description: returns n characters from vname, then
          removes n characters from vname
 
nxtw() function - extract sub-string
       Syntax: nxtw(vname,n)
               nxtw(text,n)
       Description: returns up to n characters from vname, 
          wrapped on a word boundary if possible, then 
          removes the characters from vname
 
_present() function - record status
 
       Syntax: _present(dgname)
       Description: 
          The _present() function in SET and IF is a function of 
          the hierarchy level of a data group. In general,
          the hierarchy level is the ordinal of the data group
          in the collection.
 
          _present('TableName') is 'MISSING' if 'TableName' is not currently defined;
          _present('TableName') is 'NO' if 'TableName' is defined but is not in 
                    the current RETURN 
          _present('TableName') is 'YES' if 'TableName' is in the current RETURN
 
          For example, the command:
             RELATE A CUSTOMERS INVENTORY SALES OVER CUST# ITEM#
          would produce a hierarchy that looked like this
          in a RAWPRINT:
   
          DGNAME      REC#  NAME    PRICE    QUAN       
          ----------  ----  ----    -----    ----
          CUSTOMERS   1     BATMAN  
          INVENTORY   1             12.75      
          SALES       1                        5      
          SALES       2                        8      
          INVENTORY   2             17.00      
          INVENTORY   3             25.00      
          SALES       3                       12      
          SALES       4                       24      
 
          For each frame of a REPORT, the _present() function is:
   
                                   _present()   _present()   _present()
          NAME    PRICE    QUAN    'CUSTOMERS'  'INVENTORY'  'SALES'
          ----    -----    ----    ---------    ---------    ---------
          BATMAN  12.75      5       'YES'        'YES'        'YES'
                             8       'NO'         'NO'         'YES'
                  17.00              'NO'         'YES'      'MISSING'
                  25.00     12       'NO'         'YES'        'YES'
                            24       'NO'         'NO'         'YES'
 
       The _level() function is an analogue to the _present() function.
 
timestr() function - convert time (in seconds and fractional seconds) to string
 
       Syntax: timestr(<time-in-seconds>)
       Description: 
          The timestr() function is used to convert a numeric time value
          in seconds and fractional seconds to a string.
            <time-in-seconds> is the numeric time in seconds and fractional seconds
 
          If the fractional part of <time-in-seconds> is zero, the result
          of the timestr() function is in the form 'hh:nn:ss'.
 
          If the fractional part of <time-in-seconds> is non-zero, the result
          of the timestr() function is in the form 'hh:nn:ss.ttt'.
 
       For example (in ddtl notation):
          >>timing/x %Start
          ...
          >>timing/x %Stop
          >>set %elapsed = timestr(timediff(%Start,%Stop))
          >>vlist
            %START          = 10:23:04
            %STOP           = 10:24:17
            %ELAPSED        = 00:01:13
 
substr() function - retrieve sub-string from string
 
       Syntax: substr(<string>,<position>,<count>)
       Description: 
          The substring function is used to retrieve (but not remove) 
          a portion of a larger string.
            <string> is an alpha variable, literal, or fieldname
            <position> is the relative 1 starting character position to be retrieved
            <count> is the (max) number of characters to be retrieved
 
            The <position> and <count> parameters may be numeric constants, variables, 
            column names or expressions.
 
       For example (in ddtl notation):
          >>set %STRING = 'ABCDEFGHIJKLMN'
          >>set %SUBSTR = substr(%STRING,3,5)
          >>vlist
            %STRING         = ABCDEFGHIJKLMN
            %SUBSTR         = CDEFG
 
 
_porter() function - porter stemming function
 
       Syntax: _porter(word)
       Description: 
          The _porter(word) function is an implementation of the Porter
          Stemming Algorithm, published by Martin Porter. The Porter Stemming
          Algorithm uses a strictly computational process of removing
          multiple prefixes and suffixes to give the root stem. For example,
             nationalizations ==> nation
          Porter stemming does not attempt to deal with special cases such as
             mice ==> mouse
 
          The result string of the _porter(word) function is always in lower case.
 
_soundex() function - soundex fuzzy match function
 
       Syntax: _soundex(word)
       Description: 
          The _soundex(word) function is an implementation of the Soundex
          phonetic algorithm. This particular implementation is based on
          a public domain version by Bob Jarvis dated 1997.
 
          This implementation differs from the original in the fact that
          the generated token can contain up to 6 characters.
 
_phonic() function - phonic fuzzy match function
 
       Syntax: _phonic(word)
       Description: 
          The _phonic(word) function is an implementation of the Phonic
          phonetic algorithm, developed by Peter Christian. The Phonic 
          algorithm is an enhanced version of the Soundex algorithm.
 
          This implementation differs from the original in the fact that
          the generated token can contain up to 6 characters.
 
_metaphone() function - metaphone fuzzy match function
 
       Syntax: _metaphone(word)
       Description: 
          The _metaphone(word) function is an implementation of the Metaphone
          phonetic algorithm, developed by Lawrence Phillips. The Metaphone
          algorithm is an enhanced version of the Soundex algorithm.
 
          The generated token can contain up to 6 characters.

Copyright © 2019 , WhamTech, Inc.  All rights reserved. This document is provided for information purposes only and the contents hereof are subject to change without notice. Names may be trademarks of their respective owners.