9/1/2019 Copy Spooled File To Ifs
Amphastar: The problem can be solved under OS/400 pretty much the same way you'd do it under Windows. That is, if you spooled a report (or document) into the Windows spooler and wanted to intercept it from there and put a copy into a file on another system, you could take a similar series of steps as you would under OS/400. Of course, hardly anybody ever does that because it's commonly assumed to be a ridiculous way to go about it because it's harder than all of the alternatives. Instead, you'd most likely redirect the output to a known location by taking control at the time the printed output was generated. For some reason, you choose to avoid controlling the output when it's generated, perhaps because you don't have access to the source code. So, you need to (1) locate the correct spooled file without knowing what job created it and (2) extract the print lines and turn them into lines in a text file.
In order to locate the spooled file, you will need some kind of unique identifier. You mentioned that the 'file name' is always the same. Is this name different from every other spooled file name? If so, that can be the major part of the unique identifier.
File name isn't the best choice for simplicity, but it can work. The change in job number makes sense.
Every new job in the system will get a new job number until the six-digit number wraps back around to zero and starts over. But if either job name or job user changes to various values, neither might be useful in creating a unique identifier. Two other spooled file attributes help make it easier to identify spooled files uniquely - form type and 'user-specified data'.
If either of those is unique or the combination of the two is unique, then the spooled files can be easily located. Further, if the spooled files are on an output queue that isn't used for spooled files from other jobs, again it gets easier. Other than 'file name' (which might not be unique among all types of spooled files on your system), are any of those attributes useful in uniquely identifying the output you need to locate? Unique combinations are as useful as individual unique attributes. Now, as for extracting the print lines so they can be inserted as lines in a text file, that can vary greatly depending on the characteristics of the printer that the output was generated against. Assuming the output is basic text print lines, it's not too difficult. The CPYSPLF command might be sufficient.
I've done that a number of times. Is it a simple text-only set of print lines? If so, why not just create a Windows printer definition that outputs to a text file? Then start a iSeries Access printer session pointing to that Windows printer.
Send the spooled file to the output queue for the emulation printer, and it can go into a text file on your PC. (I just set one up and ran a quick test in about five minutes. It's been a few years since I've used a iSeries Access or Client Access printer from one of our systems.) Likewise, if the spooled output is directed into a known output queue, you can start an outq monitor that automatically sends copies via LPR/LPD to a Windows printer that's directed to a file.
But if you can't supply attributes that identify which spooled files, it's all speculation on what a good technique would be for you. So, what will you use to identify and what are the contents of the spooled file like? There are a couple of commands I use that I pulled off the Internet for free. Facebook hacking download free.
I have times when a user will request that a report be emailed to them, rather than printed and sent to them via the inter company mail. The easiest way would be to create a PDF file from the spool file and then email it to the requestor. There are many third party tools that allow you to be able to convert a spool file to PDF, but how can I do it just using native IBM i features? The method I am going to describe can only be used IBM i servers with either version 6.1 or 7.1 installed.
Before you can do what I will describe in this post you need to check if you have the necessary licensed program, Transform Services, installed on your IBM i. The documentation states you can use the CHKPRDOPT command to check if it is installed, but I have found it to give false positives on some IBM i servers. I rely on viewing the list of licensed programs to see if it is there. Type: GO LICPGM and press Enter. Then take option 10 to ‘Display installed licensed programs’.
The licensed program code if different depending upon which release your server is running:. Version 7.1: 5770TS1. Version 6.1: 5761TS1. Scroll through the list of programs to find the following (this is from a 7.1 server): Licensed Installed Program Status Description 5770TS1.COMPATIBLE IBM Transform Services for i 5770TS1.COMPATIBLE Transforms - AFP to PDF Transform Transform Services is a free product that comes on the following disks of the install media:. Version 7.1: BGROUPx04 disk. Version 6.1: B29xx02 disk. If it is not installed on your server ask your IBM i administrator to install:.
Version 7.1: 5770TS1 and 5770TS1 option 1. Version 6.1: 5761TS1 and 5761TS1 option 1. And now to the programming In this first example I am using the OVRPRTF command. 01 OVRPRTF FILE(QPQUPRFIL) DEVTYPE(.AFPDS) + TOSTMF('/MyFolder/test.pdf') WSCST(.PDF) + OVRSCOPE(.CALLLVL) 02 RUNQRY QRY(.NONE) QRYFILE((MYLIB/TESTPF)) OUTTYPE(.PRINTER) There are three parameters in the OVRPRTF command we need to address: Printer Device Type, DEVTYPE, need to be.AFPDS. To Stream File, TOSTMF, contains the folder and file name I wish to save the spooled file to. In this example I will save it to the document test.pdf in the IFS folder MyFolder.
Work Stations Customization Object, WSCST, must be.PDF. When I run the RUNQRY command, line 2, no spool file is produced. The PDF file is created in MyFolder instead. To view it you can either use the Operations Navigator or you can use the DSPLNK at the command prompt: DSPLNK OBJ('/MyFolder/.'
) As I have used the asterisk after the folder name the command displays all of the files in the folder: Display Object Links Directory.: /MyFolder Type options, press Enter. 5=Display 8=Display attributes 9=Display authority Opt Object link Type Attribute Text test.pdf STMF While running the above example if you receive a CPFCE01 error then Transform Services is not installed on your server. Additional Message Information Message ID.: CPFCE01 Severity.: 40 Message type.: Escape Date sent.: DD/DD/DD Time sent.: TT:TT:TT Message.: Required product option not available. Cause.: The function requires that product 5770TS1 option 01 be available to use. Recovery.: Use the Check Product Option (CHKPRDOPT) command to verify that product 5770TS1 option 01 has been properly installed on the system.
Correct the error and try the request again. In my second example I am copying an existing spool file to my folder as a PDF file: CPYSPLF FILE(QPQUPRFIL) TOFILE(.TOSTMF) + SPLNBR(.LAST) + TOSTMF('/MyFolder/test1.pdf') WSCST(.PDF) + STMFOPT(.REPLACE) The same parameters in the CPYSPLF command, TOSTMF, WSCST, STMFOPT, have to be completed as in the previous example. And in the To File, TOFILE, the value.TOSTMF is given as I am copying the spool file to a stream file. If you do not have Transform Services on your server you can still copy spool files to the IFS as a TIF (TIFF) file using the Work Stations Customization Object, WSCST, QWPTIFFG4, see below: 01 OVRPRTF FILE(QPQUPRFIL) DEVTYPE(.AFPDS) + TOSTMF('/MyFolder/test1.tif') + WSCST(QWPTIFFG4) OVRSCOPE(.CALLLVL) 02 RUNQRY QRY(.NONE) QRYFILE((DEVSRC)) OUTTYPE(.PRINTER) The TIF is not as nice as the PDF, but it is better than nothing. You can learn more about these from the IBM web site:.
This article will only work for IBM i 6.1 and 7.1. Update I have received several communications informing me that you can use the Operation Navigator to convert a spool file to a PDF file. The above post was to describe how to create a PDF file from a spool file without human intervention, for example: part of a day-end process. I can verify the copy doesn't work at V6R1, but you can circumvent that. I have a physical file with a 133 record length on my box that I've been using to copy spool files in for different reasons. Using that file this worked. CPYSPLF FILE(QPQUPRFIL) TOFILE(PFSPLF) JOB(459531/KEVIN/QPADEV0003) CTLCH AR(.FCFC) 1788 records copied to file PFSPLF in KEVIN.
OVRPRTF FILE(QSYSPRT) DEVTYPE(.AFPDS) CTLCHAR(.FCFC) TOSTMF('/kevin/test1 23.pdf') WSCST(.PDF) OVRSCOPE(.JOB) CPYF FROMFILE(PFSPLF) TOFILE(QSYSPRT) 1788 records copied from member PFSPLF. DLTOVR FILE(QSYSPRT) LVL(.JOB).
April 26, 2010 As I was learning about the details of our PDF support in the 7.1 release to write this blog, I discovered things were a bit more confusing than I realized. So this blog post is going to discuss the PDF support we've had in the past along with what's new with 7.1. PDF Support Using the IBM Infoprint Server for i First of all, through the System i Navigator administrative interface, there’s been support to convert a spooled file to a PDF for several releases. The Convert to PDF option brings up the PDF Convert wizard to lead you through several steps. In order for the Convert to PDF option to appear, you must install the AFP Manager feature as part of the System i Navigator installation. This support also requires the product to perform the conversion; the IBM Infoprint Server for i is a chargeable product that has quite a bit of function, but many clients don't need all of the function when they just want to generate PDFs.
In 6.1, this same support is available in the IBM Systems Director Navigator for i Web Console. I'd also like to note the Export option; prior to 7.1, export just saves the spooled file as a text file and isn't related to PDF capabilities at all. The following 6.1 screen capture shows where these options are located.
Free download spss full version. SPSS merupakan salah satu software statistik yang dibuat pertama kali pada tahun 1968 oleh tiga mahasiswa Stanford University, yakni Norman H. Hadlai Hull, dan Dale H. Ketika pertama kali diciptakan software ini dioperasikan pada komputer mainframe, hingga akhirnya penerbit McGraw-Hill menerbitkan user manual SPSS. Pada tahun 1984, muncul SPSS dalam versi PC (bisa dipakai untuk komputer desktop) dengan nama SPSS/PC+, dan sejalan dengan populernya sistem operasi Windows maka SPSS pada tahun 1992 mengeluarkan versi Windows.
IBM i 6.1 – Native PDF Generation In the 6.1 release, IBM added the support to allow you to natively generate a PDF file from your application though the use of workstation customizing objects. To do this, you define or override a printer file with a device type of.AFPDS to use a workstation customizing object; you can use the IBM-supplied special value of.PDF for the WSCST parameter, or you can specify a workstation customizing object with an attribute of CTXFORM. In either case, you also must identify the stream file where the resulting PDF output is to reside.
The application, without change, can now generate a PDF file rather than the AFP spooled file. This support requires the IBM Transform Services for i licensed program product to be installed and also requires PASE (since the transform services function runs in PASE).The Transform Services licensed program product (5761-TS1 or 5770-TS1) is a no-charge product that is included with the operating system. IBM i 7.1 – Export a Spooled File to a PDF The PDF support has been enhanced in the 7.1 release to allow you to export a spooled file to a PDF file. This support is found within the IBM Systems Director Navigator for i administrative interface only (it isn’t available on the System i Navigator client). You will find four different options to export a spooled file as the following screen capture shows: This is a bit confusing because it’s only the first option-Export as PDF to client file system-that provides new support in 7.1.
Working With Ifs Files
This option takes an existing spooled file, whether AFPDS or SCS, and exports it to PDF format. You can store the PDF locally on your PC or, if you have mapped a network drive, can store it within the IFS. This support requires the IBM Transform Services for i licensed program product, but it doesn’t require the Infoprint Server product. If the Transform Services product isn’t installed, you’ll still see the export option, but if you try to perform the export, you’ll get an error message telling you the function requires the 5770-TS1 option 1 to be installed.The other three options – export to output queue, IFS, or e-mail – are existing functions that require the installation of the Infoprint Server product. Choosing one of those three options will bring up the PDF Convert wizard like the Convert to PDF option did in prior releases.
One other point to note: on the screen capture, you’ll also see an option to View as PDF. This is also new in 7.1, and converts the spooled file to PDF using the transform services support and opens the resulting PDF. Finally, for the brave, you can use the directly to perform this conversion from a spooled file to a PDF. I wonder if IBM will provide an easier interface to do this someday?
It seems like it would be really nice to simply copy a spooled file to a PDF. I'd like to thank Rod Klingsporn, Terry Luebbe, and Kevin Vette, all members of the IBM i Print team, for helping me better understand our PDF support and for their assistance with this blog article. Posted April 26, 2010 Post a Comment Note: Comments are moderated and will not appear until approved.
Sorry for not seeing this sooner, but it was under 'Mainframe' topics rather than one of the AS/400 topics. (Now, since the 'AS/400' topics have inexplicably been reclassed under 'Mainframe', I stumbled onto it.) Do you have a solution? Two fairly simple possibilities come to mind. ISeries Navigator doesn't seem to have a directly implemented method of drag/drop from output queue to IFS directory. However, drag/drop can be done to a Windows folder on a PC. And if that Windows folder represents a network shared directory that is physically an IFS directory, the actual result is a copy in the IFS directory on the server. One technical problem is that the spooled file EBCDIC character encoding is converted to the Windows default encoding, which is probably CCSID 1252.
That might not be a problem if PC access is the intended objective, but it can cause possible confusion for iSeries programs. Also, if a programmed solution on the iSeries is needed, the can be a handy shortcut.
The Copy Spooled File ( CPYSPLF) command now supports copying spooled files into the integrated file system. The spooled file can optionally be converted using a workstation customizing object.
This allows the spooled file to be converted to other formats. To convert the spooled files to Portable Document Format (PDF), you must download and apply 7.1 PTF or a superseding PTF and you must also install licensed program 5770TS1,.BASE and Option 1, 'IBM Transform Services for i' and 'Transforms - AFP to PDF Transform'. For more information, refer to the following APAR and PTF cover letters: APAR SE47834 7.1 PTF This document was last updated on 24 October 2013. To take advantage of this new function, specify the new.TOSTMF special value on the CPYSPLF TOFILE parameter. The spooled file will be converted based on the workstation customizing object specified in the Workstation customizing object (WSCST) parameter and the output placed in the stream file specified in the To stream file (TOSTMF) parameter. To stream file (TOSTMF) Specifies the stream file where the output data is to be written. All directories in the path name must exist.
New directories are not created. This parameter must specify a value other than.NONE if the To data base file (TOFILE) parameter is.TOSTMF.NONE The output is written to a user-defined physical file. This value is only valid if the To data base file (TOFILE) parameter specifies a user-defined physical database file. Path-name Specify the path name for the stream file where the output data is to be written. This value is only valid if the To data base file (TOFILE) parameter specifies.TOSTMF.
Note: If the stream file exists, the CCSID associated with the stream file will not be changed. For more information on specifying path names, refer to 'Object naming rules' in the CL topic collection in the Programming category in the IBM i Information Center at the following URL: Note: This parameter is Unicode-enabled. For additional information, see 'Unicode support in CL' in the CL topic collection in the Programming category in the IBM i Information Center at the following URL: Workstation customizing object (WSCST) Specifies the workstation customizing object to use to transform the spooled file output to final form before writing it to a stream file. If the To data base file (TOFILE) parameter specifies a physical database file, the WSCST parameter is ignored. In order to convert a spooled file using the (WSCST) parameter, the device type (DEVTYPE) of the spooled file must be.SCS or.AFPDS.NONE Specifies that no workstation customizing object is to be used. If the To data base file (TOFILE) parameter specifies.TOSTMF and the device type of the spooled file is.AFPDS or.USERASCII, the spooled file data will be copied directly to the stream file. If the stream file does not exist, the associated CCSID of the stream file will be set to 65535.
For other types of spooled files, the spooled file data will be copied to the stream file using the Control character (CTLCHAR) parameter to format the data. Lines will be ended with carriage return and line feed controls to indicate record boundaries.
Specifically, the carriage return is a hexadecimal x'0D' and a line feed is a x'25'. If the stream file does not exist, a CCSID obtained from the spooled file attributes will be associated with the stream file. If the spooled file has a CHRID attribute other than.DEVD, the CHRID attribute will be used to select the CCSID to be associated with the stream file. If the spooled file has a CHRID attribute of.DEVD, the CCSID of the job which created the spooled file will be used.PDF The output is transformed to Portable Document Format (PDF) before it is written into a stream file. If the stream file does not exist, the CCSID associated with the stream file will be set to 65535. Qualifier 1: Workstation customizing object name name Specify the name of the customizing object. When a named customizing object is used and the stream file does not exist, the CCSID associated with the stream file will be set to 65535.
Qualifier 2: Library.LIBL - All libraries in the library list for the current thread are searched until the first match is found.CURLIB The current library for the job is used to locate the customizing object. If no current library entry exists in the library list, QGPL is used. Name Specify the name of the library where the customizing object is located.
Stream file option (STMFOPT) Specifies whether the copy operation replaces or fails to copy the records to the stream file if a stream file with the specified name already exists. If the stream file does not exist, it is created.NONE No records are copied and the operation will fail.REPLACE The records replace the existing stream file records.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |