Micro Focus.

But it appears I misread the Micro Focus COBOL documentation.

I already had a program that set the data set name dynamically. I thought there 
was syntax that would allow the "external" identifier (dd name) to be a data 
name, but that's not true.

So ironically, now I have an easy way to do what I want in z/OS COBOL but not 
in Micro Focus COBOL!


-----Original Message-----
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of 
Steve Thompson
Sent: Monday, May 1, 2023 12:24 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: COBOL to dynamic DD name

Whose COBOL are you using on the PC side? If it is Fujitsu's, I
think SORT is built in. I'm not sure about the MicroFocus COBOL.
I don't have one of their systems.

Steve Thompson

On 5/1/2023 10:33 AM, Schmitt, Michael wrote:
> The data I'm trying to write is mixed up in an input file, so I don't know 
> which DDs I need to write to until I get there.
>
> I know that I could change the program to do an internal sort, but what I'm 
> trying to do is an *interim* solution for testing using the *PC* version of 
> the program, which *can* write to dynamic DD names.
>
> -----Original Message-----
> From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of 
> Farley, Peter
> Sent: Friday, April 28, 2023 3:33 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: COBOL to dynamic DD name
>
> I don't think you can do that.  Unfortunately COBOL does not yet support 
> actual FILE-type variables.  COBOL files are essentially CONSTANTS in the 
> language definition.  I wish that we had PL/I's FILE variable capability, but 
> we don't.
>
> IMHO your best bet is to avoid multiple DD allocations entirely. Instead 
> start with a list of DSN's to be input (can be another separate input file) 
> and dynamically assign each DSN you wish to process to the "constant" COBOL 
> DD name in the ASSIGN clause, then FREE it (also using BPXWDYN) when you 
> finish processing each file and then start with the next DSN (if any left).
>
> You could also leave the DD names allocated as they already are and use an 
> assembler function to retrieve the JFCB (or BXWDYN) to get the DSN of each 
> assigned DD name and then use those to do a dynamic assign of each DSN to the 
> COBOL file DD name from the ASSIGN clause, but the you will have two DD names 
> assigned to the same file in the same step, which won't work unless DISP=SHR 
> for all of them.  And if any of them is a GDG (+1) from a prior step, you 
> have to mess around with getting the GDG suffix right in the dynamic allocate.
>
> I once tried to mess around with dynamically changing the DCB DD name field 
> of the closed COBOL file, but finding the DCB for a COBOL file is very 
> compiler-release dependent and is a reverse-engineering effort that can be 
> upset by IBM any time they decide to update COBOL implementation structures.  
> Messy and a maintenance nightmare, so I dropped that effort.
>
> HTH
>
> Peter
>
> -----Original Message-----
> From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of 
> Schmitt, Michael
> Sent: Friday, April 28, 2023 3:38 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: COBOL to dynamic DD name
>
> I know how to have a COBOL program on z/OS use a data set name that isn't 
> determined until runtime, via an environment variable. My question is can you 
> use one file (i.e. one select/assign and one FD) to write to different DD 
> names, that were already allocated in the JCL?
>
> I can't find a way, and in the manual the syntax for the environment variable 
> method requires a DSN or PATH, no option for a DD name.
> --
>
> This message and any attachments are intended only for the use of the 
> addressee and may contain information that is privileged and confidential. If 
> the reader of the message is not the intended recipient or an authorized 
> representative of the intended recipient, you are hereby notified that any 
> dissemination of this communication is strictly prohibited. If you have 
> received this communication in error, please notify us immediately by e-mail 
> and delete the message and any attachments from your system.
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
Regards,
Steve Thompson
VS Strategies LLC
Westfield IN
972-983-9430 cell

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN




----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to