Page 1 of 1

Multiple input datasets

Posted: Wed Jan 11, 2012 11:30 am
by tsdjim
I need to use the diff linux command to compare two files. How do I input multiple files using fromdsn?
I have used many combinations of fromdsn but none seem to work.

The diff command syntax is

diff file1 file2

I need something like this:

fromdsn DD:FILE1 |
fromdsn DD:FILE2 |
diff

Re: Multiple input datasets

Posted: Sun Jan 15, 2012 1:37 pm
by dovetail
SUPER-C might be better for comparing datasets, but you should still be able to use z/OS Unix and Dataset pipes.

z/OS diff allows you to use "-" (dash) as ONE of the file names to mean stdin. You could use a fifo (named pipe) for the other like this:

Code: Select all

dd1=/tmp/$LOGNAME.$$.fifo.dd1
mkfifo $dd1
trap 'rm -f $dd1' EXIT
# fork background process to read dataset into fifo $dd1
fromdsn //DD:DD1 > $dd1 &
fromdsn //DD:DD2 | diff $dd1 -

But unfortunately, this won't work for DDs, since the "&" for the first fromdsn forks a background process to read data into the fifo. The background process is put into another OMVS address space, so you can't use a DD names. But this will work if you reference the dataset by name.