Page 1 of 1

Alocating SYSOUT dynamically in COBOL.

Posted: Tue Apr 05, 2016 12:27 pm
by Vibha
Hi,

Enterprise Cobol support dynamic allocation for files by using of an environment variable named with DDname and parameters for dataset for allocation. But if we try to allocate a SYSOUT, this raise an error IGZ0251W at run time. We can use BPXWDYN but can there be full COBOL approach for it?

Re: Alocating SYSOUT dynamically in COBOL.

Posted: Tue Apr 05, 2016 5:28 pm
by Robert Sample
Your post is unclear; are you attempting to allocate to DD name SYSOUT, or are you trying to allocate a SYSOUT=<something>?  For the former, this quote from Enterprise COBOL V5.2 Programming Guide may be relevant:
[font=serif]Two files should not use the same ddname or environment variable name in their[/font]
[font=monospace]SELECT[/font][font=serif]clauses; otherwise, results could be unpredictable. For example, if[/font][font=monospace]DISPLAY[/font]
[font=serif]output is directed to[/font][font=monospace]SYSOUT[/font][font=serif], do not use[/font][font=monospace]SYSOUT[/font][font=serif]as the ddname or environment[/font]
[font=serif]variable name in the[/font][font=monospace]SELECT[/font][font=serif]clause for a file.[/font]

Re: Alocating SYSOUT dynamically in COBOL.

Posted: Thu Apr 07, 2016 8:58 pm
by William Collins
There was a recent Request For Enhancement (RFE) submitted to IBM to allow this. It was declined, although the decline messages refers to //SYSOUT DD ... not to //dddd DD SYSOUT=*.

Re: Alocating SYSOUT dynamically in COBOL.

Posted: Thu Apr 28, 2016 10:34 am
by Vibha
Robert Sample wrote:Your post is unclear; are you attempting to allocate to DD name SYSOUT, or are you trying to allocate a SYSOUT=<something>?  For the former, this quote from Enterprise COBOL V5.2 Programming Guide may be relevant:
[font=serif]Two files should not use the same ddname or environment variable name in their[/font]
[font=monospace]SELECT[/font][font=serif]clauses; otherwise, results could be unpredictable. For example, if[/font][font=monospace]DISPLAY[/font]
[font=serif]output is directed to[/font][font=monospace]SYSOUT[/font][font=serif], do not use[/font][font=monospace]SYSOUT[/font][font=serif]as the ddname or environment[/font]
[font=serif]variable name in the[/font][font=monospace]SELECT[/font][font=serif]clause for a file.[/font]
I was asking for allocating the DD name SYSOUT.
From the quote it means that we can not do that, is that right?

Re: Alocating SYSOUT dynamically in COBOL.

Posted: Thu Apr 28, 2016 6:47 pm
by Robert Sample
The quote is telling you that if you allocate SYSOUT DD name via a SELECT statement, you had better not have any DISPLAY statements in your program (not now nor ever in the future) or you will get unpredictable results.

Re: Alocating SYSOUT dynamically in COBOL.

Posted: Fri Apr 29, 2016 12:22 pm
by Vibha
But is not allocating SYSOUT using SELECT is different than allocating a DD name dynamically?

Re: Alocating SYSOUT dynamically in COBOL.

Posted: Fri Apr 29, 2016 4:04 pm
by Robert Sample
No!  Dynamic allocation is still allocating a dataset to a DD name.  You will get unpredictable results if you allocate to DD name SYSOUT no matter HOW you do the allocation.

Re: Alocating SYSOUT dynamically in COBOL.

Posted: Mon Jul 10, 2017 4:57 pm
by Vibha
Thanks everyone.