Alocating SYSOUT dynamically in COBOL.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Previous topicNext topic

Topic Author
Vibha
Registered Member
Posts: 31
Joined: Tue Jul 16, 2013 7:35 pm
Zodiac: Capricorn

Alocating SYSOUT dynamically in COBOL.

Post by Vibha » Tue Apr 05, 2016 12:27 pm

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?



User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1328
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

Re: Alocating SYSOUT dynamically in COBOL.

Post by Robert Sample » Tue Apr 05, 2016 5:28 pm

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]




William Collins
Global Moderator
Global Moderator
Posts: 499
Joined: Sun Aug 25, 2013 7:24 pm

Re: Alocating SYSOUT dynamically in COBOL.

Post by William Collins » Thu Apr 07, 2016 8:58 pm

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=*.




Topic Author
Vibha
Registered Member
Posts: 31
Joined: Tue Jul 16, 2013 7:35 pm
Zodiac: Capricorn

Re: Alocating SYSOUT dynamically in COBOL.

Post by Vibha » Thu Apr 28, 2016 10:34 am

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?



User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1328
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

Re: Alocating SYSOUT dynamically in COBOL.

Post by Robert Sample » Thu Apr 28, 2016 6:47 pm

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.




Topic Author
Vibha
Registered Member
Posts: 31
Joined: Tue Jul 16, 2013 7:35 pm
Zodiac: Capricorn

Re: Alocating SYSOUT dynamically in COBOL.

Post by Vibha » Fri Apr 29, 2016 12:22 pm

But is not allocating SYSOUT using SELECT is different than allocating a DD name dynamically?



User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1328
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

Re: Alocating SYSOUT dynamically in COBOL.

Post by Robert Sample » Fri Apr 29, 2016 4:04 pm

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.




Topic Author
Vibha
Registered Member
Posts: 31
Joined: Tue Jul 16, 2013 7:35 pm
Zodiac: Capricorn

Re: Alocating SYSOUT dynamically in COBOL.

Post by Vibha » Mon Jul 10, 2017 4:57 pm

Thanks everyone.



Previous topicNext topic

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”