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