by wcn00 » Tue Mar 04, 2008 9:35 am
Answered my own question... finally.
The JZOS package (freely available for IBM) provides a ZFile object which has static methods which allow you to allocate a DDNAME, dynamically map it to a dataset and then open it. Like this:
ddName = ZFile.allocDummyDDName();
String dynallocRequest = "alloc fi("ddName") da(bob.dev.c(sample)) shr reuse msg(2)";
System.out.println("Attempting to dynamically allocate a dataset using:\n "+dynallocRequest);
zf.bpxwdyn(dynallocRequest);
zf = new ZFile("//DD:" + ddName,"r");
zf.seek(0,ZFile.SEEK_END);
long size = zf.tell();
zf.seek(0,ZFile.SEEK_SET);
byte[] barray = new byte(int) size;
int read = zf.read(barray,0,(int)size);
String thing = new String(barray, "Cp037");
System.out.println(thing);
In this case I didn't do anything fancy like use an uncatalogued dataset, but the principle holds. The bpxwdyn method takes any string allowable by the equivalent REXX function, see the rex for uss doc.
Not that once you have allocated a DDname you can use the regular java rio package to do more java centric operations on it.
wcn