Home page  
Help >
DDL Command SET
Version 7.11
DDL Command SET

SET

Establish a value in a variable for later use. The "string expression" on the right side of the equals can be a literal, a fieldname, a variable, an expression, a function, a formula, and/or the concatenation of all of these. SET is used to initialize variables, to perform string manipulations, to scan data, and to convert Julian dates into calendar dates of any form.

Notation standards Variables Options Answers

Syntax:
                SET/options %variable = string-expression

Options:
                L              -Trim leading blanks
                M            -Remove excess blanks
                P              -Convert to proper noun
                S              -Convert to lower case
                T             -Trim trailing blanks
                U             -Convert to upper case
                V             -Evaluate any {%v} in text
                X             -Suppress the command response
                Y             -Do not alter the command answer cells

Answers:
                Ctl.Ans1                -The number of characters in the resultant SET variable
                Ctl.Ans2                -Zero
                Ctl.Ans3                -Zero

Notes:
The following command
                set %qq='abc'

defines the variable %qq, establishes it as a string variable, and assigns to it the value abc. %qq is global and can be used in downstream commands, state- ments or reports.

                OPERATORS                        FUNCTIONS
                --------------                             -------------
                ! Connect                               A function consists of a function name
                                                                followed immediately by its arguments
                Most CALC                          which are enclosed in parenthesis. i.e.:
                formula
                operators                               set %vv=upper(%qq)

                                                                UPPER is the "convert to upper case" function.
                                                                So if %qq contained abc then %vv becomes ABC.

                               
The CONNECT Operator

The SET command uses the exclamation mark as a special operator to cause concatenation. For example, suppose %xx contained the value ABC and %yy contained the value GHI. Then:

                                set %qq = %xx!"DEF"!%yy

would yield the value ABCDEFGHI in %qq. Note the mixing of variables and a literal in the above, and that a literal must always be surrounded with quotes.
Either single or double quotes may be used to delineate a literal. That is, the expression %xx!'DEF'!%yy is exactly the same as above.


Functions

As shown below, if a function has more than one argument they are separated
by either a semicolon or a comma (no spaces), and the entire argument string is enclosed in parenthesis.

                String:                                                    Scanning:
                                trim(string)                                            nxt(string)
                                ltrim(string)                                           nxtn(string;number)
                                upper(string)                                         nxtd(string;"delimiters")
                                lower(string)                                         nxtw(string;number)
                                squeeze(string)
                                proper(string)                       Date:
                                strlen(string)                                         edate(jnumber;"template")

                Check Writing:                                     Substring:
                                _words(string)                                      substr(string;position;count)
                                _ewords(string)
                                                                                Time:
                                                                                                timestr(number)

Why did we use semicolons instead of commas in the above prototypes?

Descriptions and Examples

                                General String Functions
                                Date Functions
                                Time Functions
                                Scanning Functions
                                Check Writing Functions
                                The Substring Function

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.