简体   繁体   English

如何从OUTQ到Java获取假脱机文件列表

[英]How to get List of Spool files from OUTQ to Java

1st i want to say thank you for viewing this Question :) 首先,我想说谢谢您浏览此问题:)

I'm a beginner to AS400/JAVA development. 我是AS400 / JAVA开发的初学者。 I want to know how to get spool file list to java and how to convert it to PDF from OUTQ, Using JT400. 我想知道如何将假脱机文件列表转换为java,以及如何使用JT400将其从OUTQ转换为PDF。

Can anyone to tell me or give me sample java code ? 谁能告诉我或给我示例Java代码?

Thanks in advance! 提前致谢!

Split it in two. 一分为二。

One is reading the characters in the spool file. 一种是读取假脱机文件中的字符。 I did this a few years back. 几年前我做了这个。 I believe there is a SPoolFile class where you then need to search for the actual spool file given the job name/user name/job number triplet and then choose the one of potentially many generated by that job. 我相信有一个SPoolFile类,然后您需要在给定作业名称/用户名/作业编号三元组的情况下搜索实际的假脱机文件,然后从该作业生成的可能的众多文件中选择一个。 Then you need to transform it (I had to use cp850 on our host as the code page) but the rest eludes me. 然后,您需要对其进行转换(我必须在主机上使用cp850作为代码页),但其余的问题使我难以理解。

The second is to generate a PDF file containing the characters read. 第二个是生成一个包含读取字符的PDF文件。 This is a pure Java thing - I believe it was iText I used and it was pretty straight forward. 这是纯Java的东西-我相信它是我使用的iText,非常简单。

            SpooledFile spooledFile = new SpooledFile(as400, splfName.trim(), Integer.parseInt(spoolFileNumber), jobName.trim(), jobUser.trim(), jobNumber.trim());
            PrintParameterList printParms = new PrintParameterList();
            printParms.setParameter(PrintObject.ATTR_WORKSTATION_CUST_OBJECT, "/QSYS.LIB/QWPDEFAULT.WSCST");
            printParms.setParameter(PrintObject.ATTR_MFGTYPE, "*WSCST");
            try {
                InputStreamReader in = new InputStreamReader(spooledFile.getTransformedInputStream(printParms), "cp850");
                char[] buf = new char[32767];
                outputData = new StringBuilder();
                if (in.ready()) {
                    int bytesRead = 0;
                    bytesRead = in.read(buf, 0, buf.length);
                    while (bytesRead > 0) {
                        outputData.append(buf, 0, bytesRead);
                        bytesRead = in.read(buf, 0, buf.length);
                    }
                }
            //    System.out.println(sbuf.toString());

            } catch (Exception e) {
                e.printStackTrace();
            }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM