Multiple input datasets

Discussion of the Co:Z Toolkit Dataset Pipes utilities
Post Reply
tsdjim
Posts: 64
Joined: Fri May 07, 2010 2:21 am

Multiple input datasets

Post 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
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: Multiple input datasets

Post 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.
Post Reply