Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OVRPRTF used to send IFS pdf file to a OS/400 printer via FTP doesn't work anymore

732 views
Skip to first unread message

Sunnyday

unread,
Apr 15, 2014, 5:04:14 AM4/15/14
to
Hi everybody,

I need to send raw data from an IFS pdf file to a OS/400 printer able to print pdf files.

What I did is creating a *USERASCII printer:

CRTPRTF FILE(mylib/myprinterfile) DEVTYPE(*USERASCII)

Then, everytime I need to print an IFS pdf file I had done the following:

OVRPRTF (mylib/myprinterfile) DEV(physical printer)
then, using ftp directly from FTP command or Scott Klement's FTPAPI in RPGLE programs,

> namefmt 1
> bin
> put /ifspath/ifspdffile.pdf /QSYS.LIB/mylib.LIB/myprinterfile.FILE

It had been working fine for a couple of weeks. Then, I havn't used it for a while and now it doesn't work anymore.

The IFS pdf file is copied into myprinter spool file, it is graphic but it's in the wrong queue: it remains in QPRINT as if the override command doesn't apply for FTP printing anymore.

Having discovered that the printing process is run under a job different from active one, I thought I should have the override command run inside the FTP environment. And so I did using a quote RCMD, but it had no effect.

Should anyone of you already faced the same situation or has any idea? It's making me crazy...

Thank you

Lucia

Mauro Romeo

unread,
Apr 15, 2014, 5:50:12 AM4/15/14
to
Il 15/04/2014 11:04, Sunnyday ha scritto:
> Hi everybody,
>
> I need to send raw data from an IFS pdf file to a OS/400 printer able to print pdf files.
>
<cut>
>
> Thank you
>
> Lucia
>
I use this to printi directly pdf files and it work fine (thank you
Scott Klement):

* Demonstration of taking a stream file from the IFS and dumping
* it (as-is) to a *USERASCII spooled file.
* Scott Klement, August 9, 2005
*
* To compile:
* CRTBNDRPG PGM(mylib/PRTSTMFR4) SRCFILE(mylib/QRPGLESRC)
* CRTCMD CMD(mylib/PRTSTMF) SRCFILE(mylib/QCMDSRC)
* PGM(mylib/PRTSTMFR4)
*
* To run:
* PRTSTMF STMF('/home/klemscot/test.pdf') OUTQ(PRT01)
*
H DFTACTGRP(*NO) BNDDIR('QC2LE')

FQSYSPRT O F 132 PRINTER USROPN

D PRTSTMF PR ExtPgm('PRTSTMF')
D stream 256A varying const
D outq 10A const
D PRTSTMF PI
D stream 256A varying const
D outq 10A const

/copy qcopy,IFSIO_H

D QCMDEXC PR ExtPgm('QCMDEXC')
D command 32702A const options(*varsize)
D len 15P 5 const
D igc 3a const options(*nopass)

D ReportError PR

D cmd s 500A varying
D fd s 10I 0
D buf s 132A

/free

cmd = 'OVRPRTF FILE(QSYSPRT) '
+ 'DEVTYPE(*USERASCII) '
+ 'OUTQ(' + %trim(OutQ) + ')';

QCMDEXC(cmd: %len(cmd));

open QSYSPRT;

fd = open(stream: O_RDONLY);
if (fd < 0);
ReportError();
endif;

buf = *allx'20';
dow (read(fd: %addr(Buf): %size(Buf)) > 0);
except;
buf = *allx'20';
enddo;

callp close(fd);
close QSYSPRT;

cmd = 'DLTOVR FILE(QSYSPRT)';
QCMDEXC(cmd: %len(cmd));

*inlr = *on;

/end-free

OQSYSPRT E
O buf 132


*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* ReportError(): Send an escape message explaining any errors
* that occurred.
*
* This function requires binding directory QC2LE in order
* to access the __errno() function.
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P ReportError B
D ReportError PI

D get_errno PR * ExtProc('__errno')
D ptrToErrno s *
D errno s 10I 0 based(ptrToErrno)

D QMHSNDPM PR ExtPgm('QMHSNDPM')
D MessageID 7A Const
D QualMsgF 20A Const
D MsgData 32767A Const options(*varsize)
D MsgDtaLen 10I 0 Const
D MsgType 10A Const
D CallStkEnt 10A Const
D CallStkCnt 10I 0 Const
D MessageKey 4A
D ErrorCode 8192A options(*varsize)

D ErrorCode DS qualified
D BytesProv 1 4I 0 inz(0)
D BytesAvail 5 8I 0 inz(0)

D MsgKey S 4A
D MsgID s 7A

/free

ptrToErrno = get_errno();
MsgID = 'CPE' + %char(errno);

QMHSNDPM( MsgID
: 'QCPFMSG *LIBL'
: ' '
: 0
: '*ESCAPE'
: '*PGMBDY'
: 1
: MsgKey
: ErrorCode );

/end-free
P E

Mauro Romeo

dgome...@gmail.com

unread,
Apr 15, 2014, 11:08:53 AM4/15/14
to

I would suspect the problem is with the printer. Can you FTP files to it from other devices outside the I Series, like your PC?. If you can, I would check to see if you can ping the printer from the I Series.

Jonathan Bailey

unread,
Apr 15, 2014, 11:57:45 AM4/15/14
to
Is the printer started? When I try these commands I'm not allowed to OVRPRTF to a file in a library, so maybe that command failed for you or your library isnt setup or you keyed wrongly here?

Jonathan

Sunnyday

unread,
Apr 16, 2014, 2:36:17 AM4/16/14
to
The printer is up and it works well. If I change the outq parameter of the spool file just generated in the wrong queue it comes out without any problem.

Lucia

Sunnyday

unread,
Apr 16, 2014, 7:10:00 AM4/16/14
to
I gave up trying to understand why it had worked for a while.

Scott Klement's PRTSTMF routine does the trick for me.

Thank you all.

Lucia

CRPence

unread,
Apr 16, 2014, 12:43:07 PM4/16/14
to
On 16-Apr-2014 06:10 -0500, Sunnyday wrote:
> 15 aprile 2014 11:04:14 UTC+2, Sunnyday ha scritto:
>>
>> I need to send raw data from an IFS pdf file to a OS/400 printer
>> able to print pdf files.
>>
>> What I did is creating a *USERASCII printer:
>>
>> CRTPRTF FILE(mylib/myprinterfile) DEVTYPE(*USERASCII)
>>
>> Then, everytime I need to print an IFS pdf file I had done the
>> following:
>>
>> OVRPRTF (mylib/myprinterfile) DEV(physical printer)
>>
>> then, using FTP directly from FTP command or Scott Klement's FTPAPI
>> in RPGLE programs:
>>
>> ≥ namefmt 1
>> ≥ bin
>> ≥ put /ifspath/ifspdffile.pdf /QSYS.LIB/mylib.LIB/myprinterfile.FILE
>>
>> It had been working fine for a couple of weeks. Then, I haven't
>> used it for a while and now it doesn't work anymore.
>>
>> The IFS pdf file is copied into myprinter spool file, it is
>> graphic but it's in the wrong queue: it remains in QPRINT as if
>> the override command doesn't apply for FTP printing anymore.
>>
>> Having discovered that the printing process is run under a job
>> different from active one, I thought I should have the override
>> command run inside the FTP environment. And so I did using a quote
>> RCMD, but it had no effect.
>>
>> Should anyone of you already faced the same situation or has any
>> idea? It's making me crazy...
>>
>
> I gave up trying to understand why it had worked for a while.
>
> <<SNIP>>

Because the OVRPRTF did not include Override Scope (OVRSCOPE) nor the
Output Queue (OUTQ) name, and given either the PRTF or the command
defaults might have changed, those are good probabilities for origin.
In spooling, what is specified on the Device (DEV) parameter is somewhat
moot, whenever the OUTQ name does not resolve to the special value *DEV;
i.e. the destination will be the queue, not the device.

Note: QPRINT is the output queue defaulted for spooling, whenever the
spooling determines at run-time that the specified OUTQ() does not
exist; a condition diagnosed by CPD3322 "Output queue changed to QPRINT
in QGPL."

--
Regards, Chuck
Message has been deleted

Sunnyday

unread,
Apr 18, 2014, 1:11:10 PM4/18/14
to
Actually, the command was more specific: I did many different tests with different scope (default activation group, new with or without a specific name, caller) and I specified both DEV and OUTQ parameters with the same value (i.e. the name of both my printer and out queue). Nothing has changed.

As a matter of fact, I don't know much about how scope works in iSeries, so making such a random series of tests is not worthing, though.

Thank you

Lucia


0 new messages