User Tools

Site Tools


command_file_parameters

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
command_file_parameters [2018/11/16 19:05] – WIP lrickercommand_file_parameters [2018/11/16 23:41] – WIP lricker
Line 71: Line 71:
 Here, ''P1'''s value becomes ''"This is a test"'', and ''P2'''s value becomes ''"Another test"''. Here, ''P1'''s value becomes ''"This is a test"'', and ''P2'''s value becomes ''"Another test"''.
  
-==== Parameters are character stringsnot integers ====+==== Parameters Are Always Character StringsNever Integers ====
  
   * All parameters are treated as character strings -- you cannot (directly) pass an integer as a parameter value:   * All parameters are treated as character strings -- you cannot (directly) pass an integer as a parameter value:
Line 87: Line 87:
 $ sum   = ival1 + ival2 $ sum   = ival1 + ival2
 $ ! or also:  $ sum = F$INTEGER( P1 ) + F$INTEGER( P2 ) $ ! or also:  $ sum = F$INTEGER( P1 ) + F$INTEGER( P2 )
-$ WRITE sys$output "Sum of the values is: ''sum'" +$ WRITE sys$output "The arithmetic sum of the values is: ''sum'" 
 </code> </code>
  
 yields this output: yields this output:
 <code> <code>
-Sum of the values is: 45801+The arithmetic sum of the values is: 45801
 </code> </code>
  
Line 99: Line 99:
 $ ! ...again, in the command file: $ ! ...again, in the command file:
 $ not_a_sum = P1 + P2 $ not_a_sum = P1 + P2
-$ WRITE sys$output "Wrong! Sum of the values is not: ""''not_a_sum'""" +$ WRITE sys$output "Wrong! The arithmetic sum of the values is not: ""''not_a_sum'""" 
-$ WRITE sys$output "This is just a concatenated string of digit-characters..."+$ WRITE sys$output "That is just a concatenated string of digit-characters..."
 </code> </code>
  
 yields: yields:
 <code> <code>
-Wrong! Sum of the values is not: "12345678" +Wrong! The arithmetic sum of the values is not: "12345678" 
-This is just a concatenated string of digit-characters...+That is just a concatenated string of digit-characters...
 </code> </code>
  
 +==== Parameters for Batch Jobs ====
  
 +You know to execute a command file "interactively," from the command line as seen above:
  
 +<code>
 +$ @UTILS:DISK_BACKUP dka0: now mkb300: verify
 +</code>
 +
 +which will execute the command file ''DISK_BACKUP.COM'' from the ''UTILS:'' directory (likely a logical name), and passes four parameter values, ''"DKA0:"'', ''"NOW"'', ''"MKB300:"'' and ''"VERIFY"'' (all are UPCASED, because no quotes were used on any of the parameter values/words), which become ''P1'', ''P2'', ''P3'' and ''P4'', respectively, within the script.
 +
 +You likely know how to run that same command file in a batch job, perhaps delaying it until sometime this evening when everyone's gone home for the day:
 +
 +<code>
 +$ SUBMIT /AFTER=21:00 UTILS:DISK_BACKUP
 +</code>
 +
 +But what if you need to provide parameters to that batch job when it runs?  Certainly __not like this__:
 +
 +<code>
 +$ SUBMIT /AFTER=21:00 UTILS:DISK_BACKUP dka0: now mkb300: verify
 +$ !                            wrong!---^^^^^ ^^^ ^^^^^^^ ^^^^^^
 +</code>
 +
 +That's wrong syntax for the ''SUBMIT'' command... those "parameter words" will not be seen as actual parameter values in the ''SUBMIT'' command's syntax.  Instead, you pass parameter values to the batch job like this:
 +
 +<code>
 +$ SUBMIT /AFTER=21:00 UTILS:DISK_BACKUP /PARAMETER=(dka0:,now,mkb300:,verify)
 +$ !... or like this -- double-quoting continues to work for lowercase and/or multi-word values:
 +$ SUBMIT /AFTER=21:00 UTILS:DISK_BACKUP /PARAMETER=("dka0:","now","mkb300:","verify")
 +</code>
 +
 +==== But My Script Needs More Than 8 Parameters ====
 +
 +Normally, eight parameters P1...P8 is sufficient for almost any script/application, but sometimes you might need more.  There are two ways to handle this -- The first one requires the assistance (and approval) of your VMS system administrator; the second one you can just implement yourself.
 +
 +TODO --
 +
 +JOB_CTLFLAGS
 +
 +compound parameter string
  
  
  
command_file_parameters.txt · Last modified: 2019/11/12 16:02 by mmacgregor

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki