Alocating SYSOUT dynamically in COBOL.

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

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

Alocating SYSOUT dynamically in COBOL.

Postby 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?



Online
User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1275
Joined: Fri Jun 28, 2013 1:22 am
Location: East Dubuque Illinois
Has thanked: 2 times
Been thanked: 90 times

Re: Alocating SYSOUT dynamically in COBOL.

Postby 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:
Two files should not use the same ddname or environment variable name in their
SELECTclauses; otherwise, results could be unpredictable. For example, ifDISPLAY
output is directed toSYSOUT, do not useSYSOUTas the ddname or environment
variable name in theSELECTclause for a file.




William Collins
Global Moderator
Global Moderator
Posts: 499
Joined: Sun Aug 25, 2013 7:24 pm
Has thanked: 1 time
Been thanked: 25 times

Re: Alocating SYSOUT dynamically in COBOL.

Postby 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

Re: Alocating SYSOUT dynamically in COBOL.

Postby 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:
Two files should not use the same ddname or environment variable name in their
SELECTclauses; otherwise, results could be unpredictable. For example, ifDISPLAY
output is directed toSYSOUT, do not useSYSOUTas the ddname or environment
variable name in theSELECTclause for a file.


I was asking for allocating the DD name SYSOUT.
From the quote it means that we can not do that, is that right?



Online
User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1275
Joined: Fri Jun 28, 2013 1:22 am
Location: East Dubuque Illinois
Has thanked: 2 times
Been thanked: 90 times

Re: Alocating SYSOUT dynamically in COBOL.

Postby 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

Re: Alocating SYSOUT dynamically in COBOL.

Postby Vibha » Fri Apr 29, 2016 12:22 pm

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



Online
User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1275
Joined: Fri Jun 28, 2013 1:22 am
Location: East Dubuque Illinois
Has thanked: 2 times
Been thanked: 90 times

Re: Alocating SYSOUT dynamically in COBOL.

Postby 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

Re: Alocating SYSOUT dynamically in COBOL.

Postby Vibha » Mon Jul 10, 2017 4:57 pm

Thanks everyone.




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

Who is online

Users browsing this forum: CommonCrawl [Bot] and 2 guests