how can i make my CL program output to spool file instead of 5250 terminal - IBM AS400
This is a discussion on how can i make my CL program output to spool file instead of 5250 terminal - IBM AS400 ; program like this:
PGM:
SNDPGMMSG MSG('asdf')
ENDPGM
when i call it, the 'asdf' is print in my 5250 terminal, but i want
to output to spool file. how can i do that?
Thanks!...
-
how can i make my CL program output to spool file instead of 5250 terminal
program like this:
PGM:
SNDPGMMSG MSG('asdf')
ENDPGM
when i call it, the 'asdf' is print in my 5250 terminal, but i want
to output to spool file. how can i do that?
Thanks!
-
Re: how can i make my CL program output to spool file instead of 5250 terminal
On Jun 6, 4:33 am, Alan wrote:
> program like this:
>
> PGM:
> SNDPGMMSG MSG('asdf')
> ENDPGM
>
> when i call it, the 'asdf' is print in my 5250 terminal, but i want
> to output to spool file. how can i do that?
>
> Thanks!
Try SNDPGMMSG MSG('asdf') TOPGMQ(*SAME)
this might stop the message appearing if you're lucky.
Then add dspjoblog to your program to print the message to a
spoolfile.
After that you can rcv the message to remove it from the joblog. This
should definitely stop it being shown on the screen.
CL dosnt have any good methods of writing data out except to a display
file. You may get lucky defining a screen dds with output only fields
in exactly the same way as a printer dds the doing an override to make
the cl open the printfile instead of the screen then writing that way
but I couldnt recomend it. Its likely to lead to problems later. I
think a different language would be better.
Another alternative may be to create a message file eg
CRTMSGF MSGF(QTEMP/MYMSGF)
ADDMSGD MSGID(A123456) MSGF(QTEMP/MYMSGF) MSG(TEST)
DSPMSGD MSGF(QTEMP/MYMSGF) DETAIL(*BASIC) OUTPUT(*PRINT)
but this leads to a quite rubbish print. The advantage is that you
could add many messages with different ids & print all at once at the
end.
HTH
Jonathan
-
Re: how can i make my CL program output to spool file instead of 5250 terminal
On Jun 6, 5:41 pm, Jonathan Bailey wrote:
> On Jun 6, 4:33 am, Alan wrote:
>
> > program like this:
>
> > PGM:
> > SNDPGMMSG MSG('asdf')
> > ENDPGM
>
> > when i call it, the 'asdf' is print in my 5250 terminal, but i want
> > to output to spool file. how can i do that?
>
> > Thanks!
>
> Try SNDPGMMSG MSG('asdf') TOPGMQ(*SAME)
> this might stop the message appearing if you're lucky.
> Then add dspjoblog to your program to print the message to a
> spoolfile.
>
> After that you can rcv the message to remove it from the joblog. This
> should definitely stop it being shown on the screen.
>
> CL dosnt have any good methods of writing data out except to a display
> file. You may get lucky defining a screen dds with output only fields
> in exactly the same way as a printer dds the doing an override to make
> the cl open the printfile instead of the screen then writing that way
> but I couldnt recomend it. Its likely to lead to problems later. I
> think a different language would be better.
>
> Another alternative may be to create a message file eg
> CRTMSGF MSGF(QTEMP/MYMSGF)
> ADDMSGD MSGID(A123456) MSGF(QTEMP/MYMSGF) MSG(TEST)
> DSPMSGD MSGF(QTEMP/MYMSGF) DETAIL(*BASIC) OUTPUT(*PRINT)
>
> but this leads to a quite rubbish print. The advantage is that you
> could add many messages with different ids & print all at once at the
> end.
>
> HTH
> Jonathan
Thanks for so detail explanation. I try to add DSPJOBLOG
OUTPUT(*PRINT) in my CL program. It trace the message sent to green
screen. It's enough.
-
Re: how can i make my CL program output to spool file instead of 5250 terminal
On Jun 5, 10:33 pm, Alan wrote:
> program like this:
>
> PGM:
> SNDPGMMSG MSG('asdf')
> ENDPGM
>
> when i call it, the 'asdf' is print in my 5250 terminal, but i want
> to output to spool file. how can i do that?
>
> Thanks!
I use a message queue to handle this type of processing. At the
beginning of your program simply create a message queue.
CRTMSGQ MSGQ(QTEMP/MYLOG)
Then, anywhere in the program you can add to the message queue by
sending a message to it, such as:
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('ERROR: +
Unable to Setup Environment') +
TOMSGQ(QTEMP/MYLOG)
You can even receive messages sent to your program queue and forward
them on the your message queue.
Then at the end of the program you display the message queue to
*PRINT, such as
DSPMSG MSGQ(QTEMP/MYLOG) OUTPUT(*PRINT)
It works quite well and the resulting spooled file as the date & time
stamp on each message.
Mark
-
Re: how can i make my CL program output to spool file instead of 5250 terminal
On Jun 7, 11:02 am, MarkL wrote:
> On Jun 5, 10:33 pm, Alan wrote:
>
> > program like this:
>
> > PGM:
> > SNDPGMMSG MSG('asdf')
> > ENDPGM
>
> > when i call it, the 'asdf' is print in my 5250 terminal, but i want
> > to output to spool file. how can i do that?
>
> > Thanks!
>
> I use a message queue to handle this type of processing. At the
> beginning of your program simply create a message queue.
>
> CRTMSGQ MSGQ(QTEMP/MYLOG)
>
> Then, anywhere in the program you can add to the message queue by
> sending a message to it, such as:
>
> SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('ERROR: +
> Unable to Setup Environment') +
> TOMSGQ(QTEMP/MYLOG)
>
> You can even receive messages sent to your program queue and forward
> them on the your message queue.
>
> Then at the end of the program you display the message queue to
> *PRINT, such as
>
> DSPMSG MSGQ(QTEMP/MYLOG) OUTPUT(*PRINT)
>
> It works quite well and the resulting spooled file as the date & time
> stamp on each message.
>
> Mark
Good method
Thanks a lot