Dear all,
I need one more time your help...
Well, I'm starting to learn C/400 programmation and I would like in my program to log all my traces in a specific output queue (not in the standard QPRINT output queue).
I found a solution by changing the default output queue and using the simple printf...
But I don't want to change the standard output queue...
I made some test trying to open the output queue file and using fprintf... but it was not working.
I hope you'll be able to help me and perhaps give me an example.
Thanks in advance,
Pierre
Software/Hardware used:
ASKED:
June 20, 2006 6:19 AM
UPDATED:
June 21, 2006 7:31 AM
Ok, thanks for the information… Now I understand a little bit more how it’s working.
As I don’t want to change the standard output queue for the other programs running on the AS/400, I don’t think your solution should be used.
What I’m looking for is a way in C/400 to open a printer file (of the type *OUTQ) in a specific directory and be able to read and write logs.
Thanks one more time for your support.
Pierre.
Hi Pierre,
I don’t think you understood alasdair727 recommendation.
The OVRPRTF command does not change the system supplied QPRINT file.
It only says: for this job, whenever you write data to printer file QPRINT, route it to a new OUTQ.
While doing so, all your STDOUT (printf calls) will be printed into a spooled file that is attached to the new OUTQ.
In the OVRPRTF, you can also rename the spooled file name so it will not be called QPRINT:
OVRPRTF FILE(QPRINT) OUTQ(library/queue) SPLFNAME(newname)
If you do not want to use QPRINT at all, you can create your own printer file (using the CRTPRTF command with similar parameters to the OVRPRTF).
In your C program, you can open the file you created using the fopen(“*LIBL/myfile”) and perform write operation to your open file descriptor.
Because this printer file is on the QSYS file system and not IFS file, you must compile your C module (CRTCMOD) with the following option: SYSIFCOPT(*NOIFSIO)
Hope this helps
Hi Pierre,
I don’t think you understood alasdair727 recommendation.
The OVRPRTF command does not change the system supplied QPRINT file.
It only says: for this job, whenever you write data to printer file QPRINT, route it to a new OUTQ.
While doing so, all your STDOUT (printf calls) will be printed into a spooled file that is attached to the new OUTQ.
In the OVRPRTF, you can also rename the spooled file name so it will not be called QPRINT:
OVRPRTF FILE(QPRINT) OUTQ(library/queue) SPLFNAME(newname)
If you do not want to use QPRINT at all, you can create your own printer file (using the CRTPRTF command with similar parameters to the OVRPRTF).
In your C program, you can open the file you created using the fopen(“*LIBL/myfile”) and perform write operation to your open file descriptor.
Because this printer file is on the QSYS file system and not IFS file, you must compile your C module (CRTCMOD) with the following option: SYSIFCOPT(*NOIFSIO)
Hope this helps