I would like to make a datastep execute an external command with an unnamed
pipe which changes arguments based on data read into the datastep and then
parse the STDOUT. My first attempts have not been fruitful, as only the
pipe with the last assigned value gives me output. Can I change the
filename pipe in a loop in the datastep and parse the output of the pipe in
a DOW loop? If not, why not, and is there a workaround?
I think that my problem can be illustrated in the following log with the
attendant question: why is only the output from the second command output,
and not the first?
239 DATA _NULL_;
240 FILENAME NSLKUP PIPE 'NSLOOKUP 18.104.22.168';
241 INFILE NSLKUP END=EOF;
242 DO UNTIL (EOF);
244 PUT _INFILE_;
246 FILENAME NSLKUP CLEAR;
NOTE: Fileref NSLKUP has been deassigned.
247 FILENAME NSLKUP PIPE 'NSLOOKUP 22.214.171.124';
248 INFILE NSLKUP END=EOF;
249 DO UNTIL (EOF);
251 PUT _INFILE_;
NOTE: The infile NSLKUP is:
Unnamed Pipe Access Device,
NOTE: 6 records were read from the infile NSLKUP.
The minimum record length was 0.
The maximum record length was 51.
NOTE: DATA statement used (Total process time):
real time 0.07 seconds
cpu time 0.00 seconds