auto print PDF from another server to AS400 printer

30 pts.
Tags:
AS/400 PDF
AS/400 printing
PDF
PDF to AS/400
In our network setup, we have a teamcenter server ( for engineering data) which contains a PDF file. We do 5250 scan shipping from our AS400. When a label is scanned, they want me to pull this PDF file ( from this other server ) and print it on a laser printer which is a network printer and an AS400 printer. Can this be done? The job is initiated from the AS400, didnt know if I could use embedded SQL to access it?

If so, does anyone have any sample code of how to achieve this?

thanks

ASKED: September 28, 2010  1:34 PM
UPDATED: September 30, 2010  7:09 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

I extracted this from a process I have used, but I don’t know if there were any special requirements for the type/setup of the printer

<pre>
H OPTION(*NODEBUGIO: *SRCSTMT) DFTACTGRP(*NO) ACTGRP(*CALLER)
H BNDDIR(‘QC2LE’) DATFMT(*ISO)

FQSYSPRT O F 1024 PRINTER

* Prototype for C++ Procedure in system service program QRNXIE
* This moves data based on addresses. Parms are:
* Address of Destination
* Address of Source
* length to copy

D memcpy PR EXTPROC(‘__memcpy’)
D p_memD * VALUE
D p_memS * VALUE
D nByteCount 10I 0 VALUE

* PDF Related fields
* for our use 64500 was big enough to hold the PDF file, but you need to define
* these big enough for your needs
D PDFdoc 64500A document

* Size of PDF
D docSize S 10I 0

* Single line of Print Buffer
D buf S 1024A

* Current offset from the beginning of the PDF
D bRead S 10I 0 INZ(0)

D aOverride S 200
D sLength S 15 5 Inz(200)
D @OUTQ S 10 Inz(‘QPRINT’)

C Eval aOverride = ‘OVRPRTF QSYSPRT ‘ +
C ‘OUTQ(‘ + %TrimR( @OutQ ) + ‘) ‘ +
C ‘SECURE(*YES)’
C Call ‘QCMDEXC’
C Parm aOverride
C Parm sLength

* get the PDF document and the length by whatever process you use
C* EVAL docSize =
C* EVAL PDFdoc =

* Move one line at a time to the buffer and add it to the spoolfile.
C DOW bRead < docSize
C EVAL buf = *ALLx’20′
C CALLP memcpy(%ADDR(buf):
C %ADDR(PDFdoc)+bRead:%SIZE(buf) )

C Except

* Increment the pointer and clear the buffer.
C EVAL bRead = bRead + %SIZE(buf)
C ENDDO

C Eval *Inlr = *On
C Return

OQSYSPRT E
O Buf 1024
</pre>

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following