Varsub
Set Varsub ON | OFF
(Default: Off)
When this option is enabled, Qedit parses entered commands looking for variable names. If a variable name is found and currently exists, its value is substituted before the command is executed. If the variable does not exist, the variable name is left unchanged.
Qedit commands are added to the Redo stack before the substitution occurs i.e. with the variable name. So, if the variable value changes between the time the command is entered and the time it is retrieved from the stack, the results may be different. It’s also important to note that commands related to Redo stack operations such as Listredo, Do, Before can not have trailing comments enclosed in curly braces anymore. The comments are not removed and likely cause a syntax error.
/listredo { see which commands I have entered so far } Bad option, expecting ;UNN ;ABS ;REL or ;OUT /listredo 1) t testisql 2) l "!myvar" 3) s varsub on 4) l "!myvar" 5) setvar myvar "qed" 6) l "!myvar" 7) LISTREDO { SEE WHICH COMMANDS I HAVE ENTERED SO FAR }
Variable names are identified by a leading exclamation point “!”. For example, !HPACCOUNT
is replaced with the current value of the HPACCOUNT system variable. Since the exclamation point is a valid Qedit string delimiter (Verify Stringdelimiter), Set Varsub On automatically removes it from the string delimiter list.
If you wish to prevent variable substitution and have Qedit interpret the exclamation point at face value, put 2 exclamation points as in !!HPACCOUNT
.
Notes
The Stream command replaces all exclamation points found in column 1 of a file with a colon. So, if a variable name appears at the start of a line, it would not be substituted in the resulting batch job and would likely cause the job to abort
For example, let’s say you have:
!job testjob,user.acct !setvar myvar "showtime" !run qedit set varsub on !myvar e !eoj
If you streamed this file, the batch job would look like this:
:job testjob,user.acct :setvar myvar "showtime" :run qedit set varsub on :myvar e :eoj
:myvar
would not get subtituted and cause an error. To work around this problem, simply insert a space in front of the exclamation point on the offending command inside Qedit.