From Java z/OS, using zfile I can create a mainframe dataset. Both flat file and GDG versions.
If the GDG base does not exist the java code abends. Do we have an option to create the mainframe GDG base dataset from Java?
Given below is the code snippet i used to create the GDG Base from java. We just add the IDCAMS SYSIN input to a string and execute the AccessMethodServices with that input. getoutputlines will give you the sysout from the IDCAMS command.
AccessMethodServices ams = new AccessMethodServices();
String gdgCreateString = "DEFINE GDG(NAME( " + dsName + " ) LIMIT(15) NOEMPTY SCRATCH) " ;
ams.addInputLine(gdgCreateString );
int rc = ams.execute();
System.out.println(ams.getOutputLines());
GDG base entries are created via the IDCAMS DEFINE GENERATIONDATAGROUP command.
There is a section in the documentation on invoking IDCAMS from within your program, but it seems to presume the invoking program is Assembler.
In my experience, job step failure due to a GDG base being undefined is not something recovered from programmatically. Implementation plans include define all required GDG base entries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With