Can’t print correct library list out with Java

45 pts.
Tags:
Java
SBMJOB
WRKJOBSCDE
We have several customers running on our hardware. For these customers we set up job descriptions to keep library list information since they all have their own database files. I have a Java program that runs as a batch program at a set time to update a database file for each customer. I create these jobs via WRKJOBSCDE. Presently I have created a shell script on the IFS to package up the Java command line, just to make things a little cleaner. In the WRKJOBSCDE entry I run this shell script with command line arguments, via QSH. Also in the WRKJOBSCDE entry I add the job description to the JOBD parameter. What happens though, is not what I want. I want the Java program to inherit this library list. That doesn't happen. It inherits the library list of the user that starts this job. I've been around and around this with other 400 people. https://groups.google.com/forum/?fromgroups=#!topic/comp.sys.ibm.as400.misc/kBJQJ46y6Ik Even starting the program with SBMJOB and "forcing" the issue with INLLIBL(*JOBD) brings no joy. Below is a sample program and SBMJOB entry. I will not say that what I'm doing in the Java program is correct. That may be part of my problem. SBMJOB CMD(QSH CMD('cd /home/beak; /home/beak/MyJob.sh')) JOB(myQSHtest) JOBD(DOROOT/JP990004) USER(*JOBD) CURLIB(QGPL) INLLIBL(*JOBD) This is what is in my shell script: java -cp :/QIBM/ProdData/OS400/jt400/lib/jt400Native.jar MyJob And the Java source itself: import java.io.*; import java.util.*; import com.ibm.as400.access.*; public class MyJob { private AS400 m_as400sys = null; private String m_userID = null; private String m_librarylist = null; private Properties properties = null; public MyJob(String[] args) throws java.lang.ClassNotFoundException, Exception, com.ibm.as400.access.AS400SecurityException { // Grab the user ID of the process running this application. Probably DFCUSER. m_as400sys = new AS400(); Job myJob = new Job(m_as400sys); System.out.println("user ID is " + myJob.getUser()); System.out.println("current library=" + myJob.getCurrentLibrary()); String usrLibs[] = myJob.getUserLibraryList(); for (int i = 0; i < usrLibs.length; ++i) { System.out.print(usrLibs[i]); if (i < usrLibs.length - 1) { System.out.print(","); } } System.out.println(); } public static void main(String[] args) { MyJob prg = null; try { prg = new MyJob(args); } catch (Exception e) { System.out.println("Constructor problem: " + e); System.exit(1); } } }

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    ==> SBMJOB CMD(QSH CMD('cd ...')) JOB(myQSHtest) JOBD(DOROOT/JP990004) USER(*JOBD)... The USER(*JOBD) parameter value doesn't seem to make much sense for this. What is the purpose of it? How are expecting it to work? Tom
    125,585 pointsBadges:
    report
  • DraeByllek
    We have, for the moment, chosen to run all of these jobs under a user specified in the job description, that's all really. Do you see a problem with this?
    45 pointsBadges:
    report
  • TomLiotta
    No, it's not a problem as long as that's what you intend to do. It wasn't clear if that's what you wanted. Specifying a user on a *JOBD can be trouble when it's not expected and authorities aren't established, but it's a valid operation. Was it done because specifying the user directly in the USER() parameter did not seem to work as expected? Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following