|
Not in particular a cobol program, but this should get you started. Runtime exec simply runs any QSH command (parameters included). The QSH system command outputs spooled files created by the CL command as normal output (but obviously at the _end_) of the command. import java.util.*; import java.io.*; public class CmdExec { public static void main(String[] args) { try { int count = 0; int i; Vector match = new Vector(); String cmd = "system \"WRKCMTDFN JOB(*ALL) STATUS(*XOPEN) OUTPUT (*PRINT)\""; boolean end = false; System.out.println(cmd); Process p = Runtime.getRuntime().exec(cmd); InputStream is = p.getInputStream(); InputStreamReader ir = new InputStreamReader(is, "Cp037"); BufferedReader buf = new BufferedReader(ir); count = 0; while (!end) { String s = buf.readLine(); if (s == null) end = true; else { System.out.println(s); if ((i = s.indexOf("Global transaction identifier")) != -1) { // this line has gt id int j = s.indexOf("X", i); String gtid = s.substring(j); System.out.println("gtid =" + gtid); match.addElement(gtid); count++; } if ((i = s.indexOf("Branch qualifier")) != -1) { // this line has bqual int j = s.indexOf("X", i); String bqual = s.substring(j); System.out.println("bqual =" + bqual); match.addElement(bqual); count++; } } } System.out.println("total matches=" + match.size()); } catch (Exception e) { e.printStackTrace(); } } } "The stuff we call "software" is not like anything that human society is used to thinking about. Software is something like a machine, and something like mathematics, and something like language, and something like thought, and art, and information... but software is not in fact any of those other things." Bruce Sterling - The Hacker Crackdown Fred A. Kulack - IBM eServer iSeries - ERP, Java DB2 access, Jdbc, JTA, etc... IBM in Rochester, MN (Phone: 507.253.5982 T/L 553-5982) mailto:kulack@us.ibm.com Personal: mailto:kulack@magnaspeed.net AOL Instant Messenger: Home:FKulack Work:FKulackWrk
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.