Creating an Argument File from a Report

You can create an argument file for one program from the output of another program. For example, you can print a list of account numbers to the acctlist.dat file, and then run a second report with the following command:

sqr myreport sammy/baker @acctlist.dat

End acctlist.dat with a flag such as END, as shown in the following code example:

123344
134455
156664
 ...
END

An SQR program can use the numbers in acctlist.dat with an INPUT command, as shown in the following code example:

begin-procedure get_company
next:
input $account            batch-mode status = #status
  if #status = 3
      goto end_proc
  end-if
begin-select
cust_num, co_name, contact, addr, city, state, zip
  do print-page               ! Print page with
               ! complete company data
from customers
where cust_num = $account
end-select
goto next               ! Get next account number
end_proc:
end-procedure !get_company