use dataset pipes + dtlspawn + jar to zip a mainframe file.
Posted: Mon Feb 11, 2008 2:00 pm
I'm never one to do things the easy way when I can do it the complicated
way <grin>. Anyway, below is a way to create a ZIP file containing a
SINGLE z/OS sequential file. It uses Dovetailed Technologies DTLSPAWN,
fromdsn, todsn, and the Java jar command. It must use a z/OS UNIX file
as intermediary storage.
//EX1 EXEC DTLSPAWN
//STDIN DD *
. /etc/profile
cd /tozip &&
fromdsn -t 819 "//...zos.file..." >intermediate.unix.file &&
jar cvM intermediate.unix.file |
todsn -o 'recfm=fb,lrecl=1,space=(cyl,(500,200))' -b \
"//...zos.file.ZIP"
rm intermediate.unix.file
/*
The fromdsn command copies the data to the intermediate unix file,
converting it to ISO8859-1 (with UNIX line endings, not Windows line
endings, but you can specify other line endings with the -l parameter).
The jar command reads the intermediate unix file, sending its output to
STDOUT.
Which is piped to the todsn command which writes its output to a z/OS
sequential file.
You need to replace "intermediate.unix.file" to be the proper file name.
That is, what you want it called when unzipped.
You can create a ZIP with multiple files by simply using multiple fromdsn commands before the jar command, each going to a unique UNIX file name. Be sure to end each extra fromdsn with a &&. Note that the && guarantees that the previous command finished correctly before doing the next command. A primitive form of condition code checking.
way <grin>. Anyway, below is a way to create a ZIP file containing a
SINGLE z/OS sequential file. It uses Dovetailed Technologies DTLSPAWN,
fromdsn, todsn, and the Java jar command. It must use a z/OS UNIX file
as intermediary storage.
//EX1 EXEC DTLSPAWN
//STDIN DD *
. /etc/profile
cd /tozip &&
fromdsn -t 819 "//...zos.file..." >intermediate.unix.file &&
jar cvM intermediate.unix.file |
todsn -o 'recfm=fb,lrecl=1,space=(cyl,(500,200))' -b \
"//...zos.file.ZIP"
rm intermediate.unix.file
/*
The fromdsn command copies the data to the intermediate unix file,
converting it to ISO8859-1 (with UNIX line endings, not Windows line
endings, but you can specify other line endings with the -l parameter).
The jar command reads the intermediate unix file, sending its output to
STDOUT.
Which is piped to the todsn command which writes its output to a z/OS
sequential file.
You need to replace "intermediate.unix.file" to be the proper file name.
That is, what you want it called when unzipped.
You can create a ZIP with multiple files by simply using multiple fromdsn commands before the jar command, each going to a unique UNIX file name. Be sure to end each extra fromdsn with a &&. Note that the && guarantees that the previous command finished correctly before doing the next command. A primitive form of condition code checking.