Runtime values
Runtime values defined in a production job file and used in a command syntax file simplify tasks such as running the same analysis for different data files or running the same set of commands for different sets of variables. For example, you could define the runtime value @datafile to prompt you for a data file name each time you run a production job that uses the string @datafile in place of a file name in the command syntax file.
- Runtime value substitution uses the macro facility (DEFINE-!ENDDEFINE) to create string substitution values.
- Runtime values in command syntax files are ignored if they are enclosed in quotation marks. If the runtime value needs to be quoted, select Quote Value. If the runtime value is only part of a quoted string, you can include the runtime value in a macro with the !UNQUOTE and !EVAL parameters.
Symbol. The string in the command syntax file that triggers the production job to prompt the user for a value. The symbol name must begin with an @ sign and must conform to variable naming rules. See the topic Variable names for more information.
Default Value. The value that the production job supplies by default if you don't enter a different value. This value is displayed when the production job prompts you for information. You can replace or modify the value at runtime. If you don't provide a default value, don't use the silent keyword when running the production job with command line switches, unless you also use the -symbol switch to specify runtime values. See the topic Running production jobs from a command line for more information.
User Prompt. The descriptive label that is displayed when the production job prompts you to enter information. For example, you could use the phrase "What data file do you want to use?" to identify a field that requires a data filename.
Quote Value. Encloses the default value or the value entered by the user in quotes. For example, file specifications should be enclosed in quotes.
Command syntax file with user prompt symbols
GET FILE @datafile. /*check the Quote value option to quote file specifications.
FREQUENCIES VARIABLES=@varlist. /*do not check the Quote value option
Using a macro to replace part of a string value
If the entire replacement string is enclosed in quotes, you can use the Quote Value option. If the replacement string is only part of a quoted string, you can include the runtime value in a macro, using the !UNQUOTE and !EVAL functions.
DEFINE !LabelSub()
VARIABLE LABELS Var1
!QUOTE(!concat(!UNQUOTE('First part of label - '), !UNQUOTE(!EVAL(@replace)), !UNQUOTE(' - rest of label'))).
!ENDDEFINE.
!LabelSub.