13. Building Applications : imagename Command--Run a Completed Application : Using Application-specific Parameters
 
Share this page                  
Using Application-specific Parameters
When users run an imaged application from the command line, you can let them specify values for parameters that are passed back to the application itself. For example, you can ask the user to indicate a department name when starting the application. You then can use this value to restrict the records that the user sees on various frames of the application.
The -a flag indicates the start of a string of application-specific parameters. You retrieve the values into the application with the CommandLineParameters() function. This function returns a varchar value of the appropriate size (up to n bytes, where n represents the lesser of the maximum configured row size and 32,000 to hold the parameters specified on the command line (up to 126 characters for PCs). After n bytes, any additional characters are truncated.
VMS: The parameter list can be up to 512 bytes, including up to 256 parameters.
Note:  The -a flag must be the last flag on the command line.
In an application, you can define as many variables as you must hold the values that the user specifies. You then can use these variables any number of times, from any frames or procedures within the application.
If you want to use multiple parameters, be aware that the CommandLineParameters() function always returns a single value--all the parameters concatenated into a single string, with the parameters separated by a single space. You must write your own code for parsing this value into the separate variables for your application to use. The characters that the user enters after the -a flag, including multiple spaces, can be parsed differently by different operating systems.
See the 4GL section of this guide for more information on how this function retrieves parameter values, including an example of 4GL string-parsing code.