
118 Java Stand-alone Applications on z/OS Volume II
Example 7-2 Member copy using JZOS ZFile
public static void copyMembers(ArrayList members) {
try {
int count = 0;
for (int i = 0; i < members.size(); i += 2) {
String input = ZFile.getSlashSlashQuotedDSN((String)
members.get(i));
String output = ZFile.getSlashSlashQuotedDSN((String)
members.get(i + 1));
ZFile zFileIn = new ZFile(input,
"rb,type=record,noseek");
ZFile zFileOut = new ZFile(output,
"wb,type=record,noseek");
//Jzos file factory
byte[] recBuf = new byte[zFileIn.getLrecl()];
int nRead;
while ((nRead = zFileIn.read(recBuf)) >= 0) {
zFileOut.write(recBuf, 0, nRead);
}
System.out.println("C ...