On Wed, Aug 20, 2014 at 10:20 AM, TonyIcloud-OPERA <[email protected]>
wrote:

> Looks good, I'll try it out.  Thanks.  I'd be curious about a UNIX (aka
> "the dark side") solution.  I need the practice.
>
> P.S. Sam, thanks for the response but we need to keep this out of the
> development area due to change control constraints.  REXX is viable because
> we can tap dance around our bureaucracy.
>
>
OK, I'll give it a try. In the following, I will assume (based on your
initial post), that the value is the first "word" in the record. And that
the records are textual, not binary. Don't try this if the data contains
binary (non-printable) codes. It is almost guaranteed to mess up big time.

Create a file in a UNIX directory which looks like (called split-em.awk in
my examples):

#!/bin/awk -
BEGIN {system("rm " hlq ".*." suffix);}
{file=sprintf("%s.%s.%s",hlq,$1,suffix);print >>file;}

You invoke the above by running awk, using the -v argument to set the "hlq"
and "suffix" values on the command line. Example:

/bin/awk -v hlq=HLQ -v suffix=RECORDS -f /usr/local/bin/split-em.awk
"//'FB100'"

The above assumes your awk program is in /usr/local/bin/split-em.awk. The
input is in the z/OS sequential data set called FB100.

The last step is to copy all those UNIX files to z/OS sequential data sets.
I would guess that you probably don't just want to let the people read them
from a UNIX subdirectory. Which they can easily do, but most people get the
"deer in the headlights" look when you mention UNIX and z/OS together. So
you'll need a wrapper shell script. Something like:

#!/bin/sh
rm -rf /tmp/split-em
mkdir /tmp/split-em
cd /tmp/split-em
awk -v hlq=$1 -v suffix=$2 -f /usr/local/bin/split-em.awk "//'$3'"
ls -1 "$1.*.$2" |\
while read i;do
    cp -W "seqparms='space=(cyl,(?,?),lrecl=?,recfm=?'" $i "//'$i'""
done

Note: replace the ? in the above with the proper values for your
application. The above is in: /usr/local/bin/split-em.sh as an example

Execution JCL could be:

// SET HLQ=SOMEHLQ
// SET SUFFIX=RECORDS
// SET CMD1='SH /usr/local/bin/split-em.sh'
// SET INDSN=FB100
//SPLITEM EXEC PGM=BPXBATCH,REGION=0M,
// PARM='&CMD1 &HLQ &SUFFIX &INDSN'
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//STDIN DD PATH='/dev/null',PATHOPTS=(ORDONLY)
//

CAUTION: THE ABOVE IS OFF-THE-CUFF AND MAY, NAY LIKELY, HAS SOME ERRORS

-- 
There is nothing more pleasant than traveling and meeting new people!
Genghis Khan

Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to