Automating data input for DOS console programs

Example: You have ABC.EXE program that requires user to enter user name then enter password then enter start date to begin the processing.

Here is "how to":

  1. Create a text  file containing each input value on a separate line, for example


    Let's name this file INPUT.TXT
  2. Run ABC.EXE program input redirection like  ABC.EXE < INPUT.TXT

If the input is static and always the same you can create the input file just once and schedule a program type job to run "ABC.EXE < INPUT.TXT" command. If the input is dynamic, you can create a script type job which will create the INPUT.TXT dynamically and then execute "ABC.EXE < INPUT.TXT". Here is an example JAL script:

Dim data, string
Dim previous_busness_day, string, @ML"mm/dd/yyyy"
Dim process_id, number

ConcatEx "myname", "\r\n", "mypassword", "\r\n", previous_busness_day, "\r\n", data
FileSave "c:\\temp\\input.txt", data
Run "c:\\programs\abc.exe < c:\\temp\\input.txt", "", process_id