Standard use of arguments

Description

Command line arguments are intended to facilitate the running of a sequence of jobs that require small changes to the command file between runs. The output file name is modified by the use of this feature if the -R option is specified.

Command line arguments are strings listed on the command line after basename, the command file name, or specified on the top job control line after the !ARGS qualifier. These strings are inserted into the command file at run time. When the input routine finds a $n in the command file it substitutes the nth argument (string). n may take the values 1 ... 9 to indicate up to 9 strings after the command file name. If the argument has 1 character, a trailing blank is attached to the character and inserted into the command file. If no argument exists, a zero is inserted. For example,
     asreml rat.as alpha beta

tells ASReml to process the job in rat.as as if it read alpha wherever $1 appears in the command file, beta wherever $2 appears (and 0 wherever $3 appears).

The use of arguments in ASReml

in command file on command line becomes in ASReml run
abc$1def no argument abc0 def
abc$1def with argument X abcX def
abc$1def with argument XY abcXYdef
abc$1def with argument XYZ abcXYZdef
abc$1 def with argument XX abcXX def
abc$1 def with argument XXX abcXXX def
abc$1   def
(many spaces) 
with argument XXX abcXXX def

Prompting for input

Another way to gain some interactive control of a job in the PC environment is to insert !? text in the .as file where you want to specify the rest of the line at run time. ASReml prompts with text and waits for a response which is used to compete the line. The !? qualifier may be used anywhere in the job and the line is modified from that point. Unfortunately the prompt may not appear on the top screen under some windows operating systems in which case it may not be obvious that ASReml is waiting for a keyboard response.

Top command Line

Arguments can be specified on the first line of the .as file instead of on the command line. This is convenient when the .as file is run from within an editor environment like ConText or ASReml-W. If specified in both places, the command line values take precedence. For example, the first line of rats.as might read
   !ARGS alpha beta

Common examples

The most common use of arguments is to select PATHs through the command file, and with the R option, to perform several analyses at one time. The general structure of this process is as follows:
 !RENAME !ARGS 2 3 // !DOPART $1
 Title
 ...
 datafile
 !PART 1
   ... # Model 1
 !PART 2
   ... # Model 2
 !PART 3
   ... # Model 3
 !PART 4
   ... # Model 4

See Also