use of com.ibm.as400.access.Job in project IBMiProgTool by vzupka.
the class Compile method printJobLog.
/**
*/
protected void printJobLog() {
try {
// Create object for calling CL commands
CommandCall cmdCall = new CommandCall(remoteServer);
// Build command DSPJOBLOG so that the job log is printed after the current job ends
String commandDspJobLog = "DSPJOBLOG JOB(*) OUTPUT(*PRINT) MSGF(*MSG) DUPJOBOPT(*MSG)";
// Perform the DSPJOBLOG command
cmdCall.run(commandDspJobLog);
} catch (Exception exc) {
exc.printStackTrace();
}
}
use of com.ibm.as400.access.Job in project IBMiProgTool by vzupka.
the class ChangeLibraryList method getUserLibraryList2.
/**
* @return
*/
protected String[] getUserLibraryList2() {
CommandCall cmdCall = new CommandCall(remoteServer);
Job currentJob = new Job();
try {
currentJob = cmdCall.getServerJob();
currentJob.getUser();
currentJob.getName();
currentJob.getNumber();
String[] libList = currentJob.getUserLibraryList();
return libList;
} catch (Exception exc) {
exc.printStackTrace();
return null;
}
}
use of com.ibm.as400.access.Job in project IBMiProgTool by vzupka.
the class Compile method performCommand.
/**
* @param compileCommandText
*/
protected void performCommand(String compileCommandText) {
if (compileCommandText == null) {
return;
}
// Create object for calling CL commands
CommandCall cmdCall = new CommandCall(remoteServer);
try {
// Get current server job
Job currentJob = new Job();
currentJob = cmdCall.getServerJob();
// Set job attributes
currentJob.setLoggingLevel(4);
currentJob.setLoggingCLPrograms("*YES");
currentJob.setLoggingSeverity(0);
currentJob.setLoggingText(Job.LOGGING_TEXT_SECLVL);
// Get library list from the file "UserLibraryList.lib"
String liblParameter = "";
List<String> items = Files.readAllLines(libraryListPath);
if (!items.isEmpty()) {
items.get(0);
String[] userUserLibraryList = items.get(0).split(",");
for (int idx = 1; idx < userUserLibraryList.length; idx++) {
liblParameter += userUserLibraryList[idx].trim() + " ";
}
}
if (liblParameter.isEmpty()) {
liblParameter = "*NONE";
}
// Get current library for the file "CurrentLibrary.lib"
String curlibParameter = "";
List<String> curlib = Files.readAllLines(currentLibraryPath);
if (!curlib.isEmpty()) {
// The only item is the current library name or *CRTDFT
curlibParameter += curlib.get(0);
}
// Build command CHGLIBL
String commandChgLiblText = "CHGLIBL LIBL(" + liblParameter + ") CURLIB(" + curlibParameter + ")";
// Perform the GHGLIBL command
// -------
cmdCall.run(commandChgLiblText);
// Perform the compile command
// -------------------
cmdCall.run(compileCommandText);
// Get messages from the command if any
AS400Message[] messagelist = cmdCall.getMessageList();
String[] strArr = new String[messagelist.length];
// Print all messages
String type = "";
int msgType;
for (int idx = 0; idx < messagelist.length; idx++) {
msgType = messagelist[idx].getType();
switch(msgType) {
case AS400Message.ESCAPE:
{
type = "*ESCAPE";
}
case AS400Message.DIAGNOSTIC:
{
type = "*DIAGNOSTIC";
}
case AS400Message.COMPLETION:
{
type = "*COMPLETION";
}
case AS400Message.NOTIFY:
{
type = "*NOTIFY";
}
case AS400Message.INFORMATIONAL:
{
type = "*INFORMATIONAL";
}
}
strArr[idx] = messagelist[idx].getID() + " " + type + ": " + messagelist[idx].getText();
row = strArr[idx];
msgVector.add(row);
if (!messagelist[idx].getHelp().isEmpty()) {
strArr[idx] = " " + messagelist[idx].getHelp();
row = strArr[idx];
msgVector.add(row);
}
}
reloadMessages();
} catch (Exception exc) {
exc.printStackTrace();
}
}
Aggregations