Under CICS

There are several ways to redirect C standard streams under CICS:

If you assign a file pointer to a stream or use freopen() on it, you will not be able to use C functions to direct the information outside or elsewhere in the CICS environment. Once access to a CICS transient data queue has been removed, either by a call to freopen() or fclose(), or by the assignment of another file pointer to the stream, z/OS® XL C/C++ does not provide a way to regain access. Once C functions have lost access to the transient data queues, you must use the CICS-provided facilities to regain it.

CICS provides a facility that enables you to direct where a given transient data queue, the default standard stream implementation, will go, but you must configure this facility before a CICS cold start.