> -----Original Message-----
> From: Linux on 390 Port [mailto:[email protected]] On
> Behalf Of John Summerfield
> Sent: Monday, November 02, 2009 10:18 AM
> To: [email protected]
> Subject: Re: emulating a z/OS DDNAME dataset concatenation in Linux
<snip>
>
<snip>
>
> If there's some useful preprocessing that could be done before the
> program, he could replace cat with a program that does that processing
> and reduce the overhead.
>
> --
>
> Cheers
> John
What I think he wants would be the ability to set an environment variable to
contain a series of file names. Then, in his code, he passes the environment
variable name to some sort of "open" function. The "open" would parse out the
names of the files in the variable and open the first one. Then, when a "read"
is done on the file handle, the program would either get the next record in the
current file; if eof, then close current, open next, read first record and
return; if eof and no next file name, then return eof to the program.
The following Perl code could do something like what the OP want. Assuming his
program is written in Perl <grin>.
#!/usr/bin/perl
use strict;
use warnings;
my ($files,$file,@files)
$files=$ENV{"FILES"};
die "FILES environment variable does not exist" unless $files;
@files=split /:/$files;
foreach $file (@files) {
die "$file is not readable" unless -r $file;
}
$files=join(' ',@files);
open(INPUT,"cat $files |";
while(INPUT) {
# INPUT PROCESSING FOR EACH RECORD IN EACH FILE, IN ORDER.
}
OK, it's not perfect and using "cat" in that way is not as efficient as simply
putting the files in the @ARGV array. But this could be a model for some C code
or other language, perhaps.
--
John McKown
Systems Engineer IV
IT
Administrative Services Group
HealthMarkets(r)
9151 Boulevard 26 * N. Richland Hills * TX 76010
(817) 255-3225 phone * (817)-961-6183 cell
[email protected] * www.HealthMarkets.com
Confidentiality Notice: This e-mail message may contain confidential or
proprietary information. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original message.
HealthMarkets(r) is the brand name for products underwritten and issued by the
insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance
Company(r), Mid-West National Life Insurance Company of TennesseeSM and The
MEGA Life and Health Insurance Company.SM
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390