Contents of Article


Sample SET Edit session

Using SET to Define SPFLite Options


Syntax


SET


[  name  [  OFF  |  { = value }  ]  ]


Note: Because name could be any value, the operands to SET are positional. 


e.g. to reset a SET variable of LOCK, the command must be SET LOCK OFF, not SET OFF LOCK



Operands


name

Defines the name of the SET variable. A SET variable name is case-insensitive, and must be a letter followed by zero or more letters, digits and underscores. 


SET variable names may also contain dot characters. Dots may appear anywhere in the name, except for the first position which must be a letter. 


Because the command notation =X is a shortcut for the command EXIT, a SET variable with a name of X is not allowed; the name X is reserved. (This shortcut emulates a notation used in IBM ISPF to quickly exit that editor.)


SET name by itself will display the current contents of SET variable name.


SET with no operands will bring up a SET Edit session.


OFF

SET name OFF will remove the SET variable name.  Once removed, attempting to remove it again will produce the message Unknown SET variable.



= value

SET name = value will assign value to SET variable name. 

The value may be a simple word, or multiple words. If the value itself needs to included quotes, here are the rules for quoting:

  1. All values (single or multiple strings) are merged, and ONE set of enclosing quotes will be removed.


e.g.

"ABC DEF GHI"              will be treated as ABC DEF GHI

"'ABC DEF GHI'"     will be treated as 'ABC DEF GHI'

'ABC "DEF" "GHI"'   will be treated as ABC "DEF" "GHI"   


  1. So, if a single sting value needs  quotes, you must enclose the entire value as in other quotes. An example follows.


If 'ABC' is the value, it must be coded as "'ABC'"


  1. For example, suppose you want to reference a number of 12345 as a string by using the SET variable name NUM in several CHANGE commands, such as:


CHANGE ABC =NUM  


If you defined this as SET NUM = '12345' this would not work, since the value would just stored as 12345 without the quotes, and the CHANGE command would effectively be


CHANGE ABC 12345


and the 12345 would look like a line number, not a string. To store the SET variable's value so that the quotes are included, you would have to “quote the quotes”. The correct command would be SET NUM = "'12345'"

Then the CHANGE command would get correctly expanded to


CHANGE ABC '12345'


NOTE:   The operands of SET may be separated by blanks, or not, as you prefer.  That is, 

       SET XXX = YYY

     SET XXX=YYY

     SET XXX= YYY    are all equivalent



But SET XXX =YYY  is NOT, since the =YYY looks like a request to substitute the current SET value for variable YYY, not what you want.




Description


The SET command is used to store named values, known as SET variables. A SET variable is comparable to a Windows environment variable in the way it is defined and used.


In SPFLite primary commands, you can access the value of a SET variable by putting an = equal sign followed by the name of the variable. Suppose you wanted to refer to a certain line number by name. You could say,


       SET LINE = 1234


and then use it in commands as a symbolic name for 1234:


       CHANGE ABC DEF =LINE

or

       LOC =LINE

       

Wherever you said =LINE the value of LINE, 1234, would get substituted.


Concatenation


Normally, SET substitution is done in regular 'word' mode, where the SET value replaces the =xxxxx value in the command line. It is possible to concatenate the SET value to following characters.  This uses the normal concatenation character |.  e.g. If a SET variable was SET ABC = DEF, and the command line contained =ABC|GHI the substituted value would be DEFGHI.


       

Sample SET Edit session


If you issue the SET command by itself, you will bring up a SET edit session. This is marked by a file tab of (SET Edit).



To ensure the integrity of the SET values, the SET command cannot be issued from any tab when a SET Edit session is active.


You can add, change or delete SET variables in the SET Edit session, or just browse their contents. When you issue an END command, the contents of the SET Edit session become the new values of all SET variables, and can be used immediately. It's not necessary to say SAVE in a SET Edit session. That is implied, and SPFLite takes care of that for you. However, it is possible to say CANCEL in a SET Edit session, which will discard any changes you might have made.


The SET variable values are stored in the normal SPFLite.CFG file, along with most other settings.


Note: As you observe the SET Edit display above, the name and value are normally separated by a single = sign with no spaces between. You may user xxx=yyy or xxx  =  yyy as you choose.


Also, since it may be entered inadvertently, even though not needed, the lines in a SetEdit session may optionally be preceded with a SET command.  e.g. Either SET  AAA=BBB or AAA=BBB are acceptable.


Using SET to Define SPFLite Options


SPFLite has several options which are controlled via SET options.


Command Aliases


You can define command aliases for primary commands using the SET command. A command alias name applies to both an Edit/Browse session and to the File Manager.


You can use an alias to modify an existing command. For example, an alias could change an L command into an L TOP command in order to add TOP to any normal L command.  Or it can simply provide an alias to shorten an otherwise long command or macroname. 


You define a command alias by the following SET command:


SET ALIAS.name1[.name2[.name3]] = command 


Note the ALIAS name can contain up to 3 'words' separated by periods. This allows you to define aliases for phrases. The 'words' refer to the 1st 3 space delimited operands on the command line. So you could have multiple aliases for a single primary command.


Example:

SET ALIAS.FIND.A = FIND VALUE1 ALL PREFIX C MX TOP

SET ALIAS.FIND.B = FIND VALUE2 10 20 +RED


Which means you can create 'shortcuts' for lengthy commands you use frequently. e.g FIND A and FIND B become two very different commands.


The name1[.name2[.name3]] portion of the SET variable specifies the new alias name you want to define. 


The command portion of the SET command specifies the primary command to be executed when you type name on the primary command line. command may be the name of a macro or an SPFLite built-in primary command.


command may optionally contain operands. There are two types of operands:


Simple strings         There are just normal command line operands, The resulting command line will be the  name you entered, followed by the operands you entered in the SET statement, and then followed by the remaining typed operands on the command line. 


Operand Substitution        This feature (Which is allowed only for a single name1 variety) allows you to selectively choose or re-arrange operands entered after the name. These are symbolic variables of the format =n, like =0, =2 etc. Valid numbers are from =0 to =9


       The Numbered operands are replaced by the original typed values, where =0 is the command name, =1 is the 1st operand, =2 the 2nd, etc.


Example        SET ALIAS.MYCMD = CHANGE =2 =1 ALL

       This would create a command (MYCMD) which performs a CHANGE command with the operands reversed. i.e. If you entered MYCMD AAA BBB, the effective command after substitution would be CHANGE BBB AAA ALL.


Note: The operand =variables can be joined (=1=2 or =2ABC), but the full variable names =ABC can only be used as separate operands. i.e. you cannot say ABC=VARDEF - where =VAR is the variable.


Aliases are normal SET names, and all rules for SET names apply to SET aliases. To delete an alias, you can issue SET ALIAS.name OFF, or enter a SET Edit session and delete the line containing the SET alias definition.


NOTE:  Alias names are only matched against the 1st 3 operands (depending on the # of names in the ALIAS).  If an alias name appears anywhere else, it is an ordinary SPFLite command operand with no special meaning.


Macro Pending


Normally, macro execution is rejected if there are Pending line commands. This is because handling this situation is quite complex and the vast majority of macros simply will malfunction with this condition. 


The statement 


       SET PENDING.macroname = Y 


specifies that the nominated macro can support or intends to exploit the condition.


Such a macro may use the pending commands as part of its processing, or can simply choose to ignore the pending commands.

Either way, SPFLite will remove the pending line commands when the macro ends.


If you wish the pending line commands to still be available after the macro has finished, you need to "wrapper" your macro's logic with additional code.

   Example:

    (1)  Code to "capture" the pending command name (Copy,Move,Before,After,etc) and the associated lines it references.

    (2)  <your-normal-macro-logic-code-here>

    (3)  Code to "replace" the captured command sequence on the original lines


Macro TRACK activate


Normally Macros do not trigger the creation of TRACK saving, this SET command allows you to activate triggering TRACK support for a particular macroname.


SET TRACK.macroname = Y


AUTOFAV Control


AUTOFAV allows you to specify filenames which match a specific mask format to be automatically added to a specific FLIST. More information on AUTOFAV can be found at "AUTOFAV to add to FILELISTS" and "File Lists - FLISTS"


SET AUTOFAV.*.EXT1=EXT1FLIST

 

MACLIB Specification


MACLIB specifies the name of an alternate MACLIB to be used in place of the normal \Users\You\SPFLite\MACLIB folder.  See the MACLIB command for details.


SET MACLIB.maclibname  = full_macrolib_path


MACROMODE Specification


Just as normal line commands (like C or R can be made into BLOCK mode commands by repeating their last character (e.g.  C -> CC or LC -> LCC) so can the names of Line Command Macros (e.g. MYMAC -> MYMACC). But some macros may be inherently BLOCK mode and it seems awkward to have to repeat their last character.  So MACROMODE allows you to specify a macro name that will be treated as BLOCK mode even though it's last character is not repeated.


Similarly, you may have a macro whose name ends in a double letter which is NOT a BLOCK mode macro. Like one named ABCALL.


MACROMODE allows you to explicitly mark a macro name as a SINGLE or BLOCK mode to avoid these situations.

 

SET MACROMODE.macroname = BLOCK | SINGLE


PENDING Specification


PENDING allows you to indicate whether a macro is capable of handling other pending line commands or not.


SET PENDING.macroname = Y | N


Keyboard Definition Substitution


Ten reserved SET variables have been set aside for use as substitution variables when defining Keyboard Definition strings. The symbols Set0 thru Set9 may be used to establish strings which will replace any matching keyboard primitives (Set0) thru (Set9) 


Keyboard Definition Flags


Ten SET variables have also been set aside to act as Y / N flags for use while defining Keyboard Definition strings. The symbols KB0 thru KB9 should be set to Y or N to match your KB definition's use in defining optional strings.


Command RETRIEVE exemption


   SET RETRIEVE.cmdname = Y | N

If specified as N, the cmdname will be exempted from inclusion in the Command Retrieve Stack