public class AccessMethodServices
extends java.lang.Object
Output from IDCAMS (DD SYSPRINT) is redirected by default
to a String (getOutputLines()
).
The method setOutputDDName(String)
may be used before
execute()
to direct IDCAMS output to a pre-allocated
DDNAME.
Example: LISTC output directed to outputLines String buffer.
AccessMethodServices ams = new AccessMethodServices();
ams.addInputLine("LISTC LEVEL(ACCTING)");
int rc = ams.execute();
System.out.println("IDCAMS output:");
System.out.println(ams.getOutputLines());
Example: LISTC output directed to temporary dataset.
String ddname = ZFile.allocDummyDDName();
ZFile.bpxwdyn("alloc fi(" + ddname +
") da(&&IDTEMP) new delete reuse msg(2)");
AccessMethodServices ams = new AccessMethodServices();
ams.setOutputDDName(ddname);
ams.addInputLine("LISTC LEVEL(BILLING)");
int rc = ams.execute();
...
ZFile.bpxwdyn("free fi(" + ddname + ") msg(2)");
For detailed information on using Access Method Services (IDCAMS), see:
SC26-7394 DFSMS Access Method Services for Catalogs
.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_OUT_BUF_LEN |
static int |
MAX_INPUT_LINE_LEN |
Constructor and Description |
---|
AccessMethodServices()
Construct an instance
|
Modifier and Type | Method and Description |
---|---|
void |
addInputLine(java.lang.String inputLine)
Add an input line to be treated as a SYSIN input record to IDCAMS.
|
int |
execute()
Execute IDCAMS.
|
java.lang.String |
getOutputLines()
Answer a String containing the output lines, separated by newlines.
|
void |
setOutputBufLen(int length)
Sets the output buffer length.
|
void |
setOutputDDName(java.lang.String ddname)
Sets a pre-allocated DDNAME to be used to write IDCAMS SYSPRINT output.
|
public static final int MAX_INPUT_LINE_LEN
public static final int DEFAULT_OUT_BUF_LEN
public void addInputLine(java.lang.String inputLine) throws java.lang.IllegalArgumentException
inputLine
- Stringjava.lang.IllegalArgumentException
- if inputLine is null or greater than MAX_INPUT_LINE_LENpublic java.lang.String getOutputLines()
execute()
is called,
and is limited by the setOutputBufLen(int)
setting.public void setOutputDDName(java.lang.String ddname)
getOutputLines()
ddname
- Stringpublic void setOutputBufLen(int length)
DEFAULT_OUT_BUF_LEN
length
- output buffer lengthpublic int execute()
getOutputLines()
,
setOutputDDName(String)
,
setOutputBufLen(int)