MvsJobSubmitter fails when implementes Callable

General discussion on the JZOS batch launcher and toolkit
Post Reply
arsi
Posts: 3
Joined: Sun Jul 29, 2012 4:50 pm

MvsJobSubmitter fails when implementes Callable

Post by arsi » Sun Jul 29, 2012 5:55 pm

I want to simultaneously submit several jobs and at the same time track all of them. I modified the sample MvsJobSubmitter to implement Callable. When I submit one job, it works but not when I submit two. One works and the other fails with below exception.
Not sure what's going on. Your advice would be highly appreciated. Thanks.

Code: Select all

ExecutorService executor = Executors.newFixedThreadPool(NTHREDS);
		List<Future<JclJob>> list = new ArrayList<Future<JclJob>>();
		Callable<JclJob> worker1 = null;
		Callable<JclJob> worker2 = null;
		try {
			worker1 = new JclSubmitter("//'MYID.CNTL(IDCAMS)'");
			worker2 = new JclSubmitter("//'MYID.CNTL(IEFBR14)'");
		} catch (Throwable e1) {
			e1.printStackTrace();
			System.exit(12);
		}		
		list.add(executor.submit(worker1));
		list.add(executor.submit(worker2));		
		wait2sec()
                executor.shutdown();
		
		// Wait until all threads are finish
		while (!executor.isTerminated()) {
		}
		try {
			for (Future<JclJob> outjcl : list) {
				try {
					JclJob job = outjcl.get();
					JclOutput jout = new JclOutput(job.getJobname(), job.getJobid());
					wait2sec();
				} catch (InterruptedException e) {e.printStackTrace();
				} catch (ExecutionException e) {	e.printStackTrace();
				}
			}
		} catch (IOException e) {e.printStackTrace();
		}
		if (list.size() <= 0){throw new RuntimeException("Double-entries!!!"); 
		}
	}
java.util.concurrent.ExecutionException: com.ibm.jzos.RcException: Rexx 'submitJob' process failed: 59 +++ jobid = submit('jcl.'
) RC=3 (0x3)
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:233)
at java.util.concurrent.FutureTask.get(FutureTask.java:94)
at com.ual.jzos.JclTest.main(JclTest.java:86)
Caused by: com.ibm.jzos.RcException: Rexx 'submitJob' process failed: 59 +++ jobid = submit('jcl.') RC=3 (0x3)
at com.ual.jzos.JclSubmitter.submitJob(JclSubmitter.java:221)
at com.ual.jzos.JclSubmitter.call(JclSubmitter.java:106)
at com.ual.jzos.JclSubmitter.call(JclSubmitter.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:314)
at java.util.concurrent.FutureTask.run(FutureTask.java:149)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
at java.lang.Thread.run(Thread.java:737)

arsi
Posts: 3
Joined: Sun Jul 29, 2012 4:50 pm

Re: MvsJobSubmitter fails when implementes Callable

Post by arsi » Sun Jul 29, 2012 8:52 pm

Added wait2sec between submit and got different results. Please advice.

Code: Select all

list.add(executor.submit(worker1));
		wait2sec();
		list.add(executor.submit(worker2));
java.io.IOException: Stream closed
at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:156)
at java.io.BufferedInputStream.read(BufferedInputStream.java:319)
at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:464)
at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:506)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:234)
at java.io.InputStreamReader.read(InputStreamReader.java:188)
at java.io.BufferedReader.fill(BufferedReader.java:147)
at java.io.BufferedReader.readLine(BufferedReader.java:310)
at java.io.BufferedReader.readLine(BufferedReader.java:373)
at com.ibm.jzos.Exec$1.readLine(Exec.java:393)
at com.ibm.jzos.Exec.readLine(Exec.java:365)
at com.ual.jzos.JclSubmitter.submitJob(JclSubmitter.java:202)
at com.ual.jzos.JclSubmitter.call(JclSubmitter.java:106)
at com.ual.jzos.JclSubmitter.call(JclSubmitter.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:314)
at java.util.concurrent.FutureTask.run(FutureTask.java:149)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
at java.lang.Thread.run(Thread.java:737)
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:233)
at java.util.concurrent.FutureTask.get(FutureTask.java:94)
at com.ual.jzos.JclTest.main(JclTest.java:84)
Caused by: java.lang.NullPointerException
at com.ual.jzos.JclSubmitter.call(JclSubmitter.java:111)
at com.ual.jzos.JclSubmitter.call(JclSubmitter.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:314)
at java.util.concurrent.FutureTask.run(FutureTask.java:149)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
at java.lang.Thread.run(Thread.java:737)

arsi
Posts: 3
Joined: Sun Jul 29, 2012 4:50 pm

Re: MvsJobSubmitter fails when implementes Callable

Post by arsi » Sun Jul 29, 2012 10:37 pm

Never mind guys. I have to rewrite this code.

Post Reply