On Oct 18 Tom Schmidt wrote:
>You might have overlooked an interesting gem of a feature of z/OS JCL: 
>FREE=CLOSE.

>If you need to provide several alternative tables, you might be able to
> do so 
>strictly in the enveloping JCL by doing something like this:

>//SYSLIB  DD  DISP=SHR,FREE=CLOSE,DSN=USERS.INPUT(TABLEX)
>//SYSLIB  DD  DISP=SHR,FREE=CLOSE,DSN=USERS.INPUT(TABLEY)
>//SYSLIB  DD  DISP=SHR,FREE=CLOSE,DSN=USERT.MUMBLE(TABLEZ)

>Note that the DDNAME is replicated three (3) times above, for example.
  
 
>For the cost of a full OPEN/GET/CLOSE you get to read the record from
> the 
>first member and be positioned to the second member on your next 
>OPEN/GET/CLOSE.  Not high performance but pretty high function and very
 
>easy to maintain (just change the JCL).  
> 
>z/OS does not limit DDNAMES to a single appearance in a step (although
> you'd 
>be surprised how many think otherwise).  By crafty use of multiple DDs
> with 
>identical names that resolve to different datasets (even to completely 
>different data set names).  Since any DD can use traditional data sets
> or 
>PATH= it is also quite general.  
 
>Nearly every high level language supports file opens and closes so
> nearly every 
>high level language can perform this "trick".  
 
>All you need to do is stop looping through the open/close once the open
> fails.  
>(You ought to provide for error recovery if the open fails anyway so
> that might 
>not be asking too much.)  
>/snip
When I read this I thought it was pretty neat. Never had occurred to
me that this was possible ... It is still neat to know. However, as a
practical matter I could not think of an instance where it would be 
preferable to simply concatenating the data sets:

//SYSLIB  DD  DISP=SHR,DSN=USERS.INPUT(TABLEX)
//        DD  DISP=SHR,DSN=USERS.INPUT(TABLEY)
//        DD  DISP=SHR,DSN=USERT.MUMBLE(TABLEZ)

Only need one open and close.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to