Alocating SYSOUT dynamically in COBOL.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Vibha
Registered Member
Posts: 31
Joined: Tue Jul 16, 2013 7:35 pm

Alocating SYSOUT dynamically in COBOL.

Post 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?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1885
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Alocating SYSOUT dynamically in COBOL.

Post 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]
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: Alocating SYSOUT dynamically in COBOL.

Post 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=*.
Vibha
Registered Member
Posts: 31
Joined: Tue Jul 16, 2013 7:35 pm

Re: Alocating SYSOUT dynamically in COBOL.

Post 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?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1885
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Alocating SYSOUT dynamically in COBOL.

Post 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.
Vibha
Registered Member
Posts: 31
Joined: Tue Jul 16, 2013 7:35 pm

Re: Alocating SYSOUT dynamically in COBOL.

Post by Vibha »

But is not allocating SYSOUT using SELECT is different than allocating a DD name dynamically?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1885
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Alocating SYSOUT dynamically in COBOL.

Post 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.
Vibha
Registered Member
Posts: 31
Joined: Tue Jul 16, 2013 7:35 pm

Re: Alocating SYSOUT dynamically in COBOL.

Post by Vibha »

Thanks everyone.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

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