Can you redirect COBOL DISPLAYs to a file?

Dear Experts,

Is there any way on the AS/400 to redirect COBOL DISPLAY statements, such that they are written to a file instead of displaying on the terminal?  Could you use some sort of preceding CL override to do this?  

Thanks,
BrianMc1958
BrianMc1958Asked:
Who is Participating?
 
tliottaCommented:
BrianMc1958:

Off the top of my head, I'd guess not.

I've never researched it, but it appears as if COBOL DISPLAYs don't do what we think of as file I/O; therefore, there is no override possible.

It _looks_ as if COBOL DISPLAYs rely on underlying support similar to SNDPGMMSG or SNDUSRMSG. That is, the output goes to the job's *EXT message queue, not to a file.

If I needed the messages to end up in a file, I'd probably look at messaging APIs that would retrieve messages from the job's message queue and write what was received to a file.

But maybe someone out there has a bright idea.

Tom
0
 
daveslaterCommented:
Hi
I have never tried it but in cl try

pgm

CRTDUPOBJ OBJ(QASCCPY) FROMLIB(QSYS) OBJTYPE(*FILE) TOLIB(mylib) NEWOBJ(MYFILE)

strcpysrc srcdev(*requester) outdev(*none) outfile(mylib/myfile)

call pgm

ENDCPYSCN

endpgm


Dave
0
 
BrianMc1958Author Commented:
Dear Everybody,

Thanks, but I'm afraid business pressures have forced me to move on from this question, so I can't try it out.  If anyone is reading this later, give it a try!  As it is, I'm forced to award points to Tom.  His response matches my experience: You can't get there from here.

Thanks again!
--BrianMc1958
0
 
tliottaCommented:
BrianMc1958:

Wish I could do more. Dave's STRCPYSCN is a novel idea. Best I can do is to point to retrieving messages from the joblog (i.e., the job *EXT message queue) after the program is done.

Assuming this is a kind of audit function, I'd guess that retrieving the messages is as good as it's gonna get. Reading up on COBOL DISPLAY gave no better hint.

Tom
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.