My problem is different... I can't set anything on AS400. I'm trying to port some workstations to linux, but print settings on AS400 are untouchables. I need to set printing condition (if possible) with lp5250d.

In order to do that, you'll have to stop using env.IBMMFRTYPMDL, since that keyword tells the AS/400 to do the transformation to the printer language -- and you say you can't change anything on the AS/400. Personally I think this is a mistake -- you should discuss this with the AS/400 administrator, perhaps showing him/her my previous e-mail (or a translation) because it provides a great deal more flexibility.

If you really can't do it that way, then you'll have to do it without env.IBMMFRTYPMDL. If you don't use that keyword, then the printouts won't be transformed on the AS/400, and you can do all of the work on the Linux box.

It's important to understand that lp5250d is only a communication daemon. It communicates with the AS/400, and downloads the printout from the spool still in it's original SCS format. It does no transformation of that data itself.

For each spooled file it downloads, lp5250d will launch a new Linux process, and open a pipe to that process (it uses the popen() function to do this). It'll use the pipe to send the SCS data. The command/program that it runs in the new process is defined by the outputcommand configuration keyword.

For example, I might do this:

    lp5250d outputcommand="scs2ascii|lpr" env.DEVNAME=PRT01 as400

This tells lp5250d that (for each report it downloads) it should open a pipe to program named scs2ascii. scs2ascii will convert the document from SCS format to an ASCII text file. The output from scs2ascii is subsequently piped to the lpr command, which puts it in the Unix print queue.

You can specify anything you like for this output command. You could even write a shell script or program that makes big changes to the document before sending it to the printer.

For example, you might use the enscript tool (which should be easy to find for Linux) to make some transformations on the data. You could do the following:

outputcommand="scs2ascii|enscript --no-header -p- -q -fCourier-Bold@10/12|lpr 

(sorry if the preceding line wrapped -- it should all be one line)

This tells lp5250d to convert the SCS data to plain ASCII text, and pipe the ASCII text to the enscript program. Enscript converts the document to PostScript. The postscript that's written out will print the document with the Courier-Bold font, 10 points wide, and 12 points high.

The output from enscript is sent to the printer via LPR, and I've included the switch -Pps4 to tell it which print queue to use. Of course,if you didn't want it to print, you don't have to use LPR. You can just redirect the stream to a file. Or to /bin/mail if you want to e-mail it. Whatever you want to do...

Of course the output from enscript is PostScript rather than PCL, so if your printers don't understand PostScript, you'll want to configure Linux so that the print spooler automatically converts PostScript documents to PCL for that printer. (You'll want that for other things as well, since almost all Linux software writes printer output in PostScript)

There's also a tool called scs2pdf that's included with tn5250. You can use that in lieu of scs2ascii if you want the output in PDF format instead of plain ASCII text.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by 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.