Generate a ddname dynamically



IBM's Command List programming language & Restructured Extended Executor

Generate a ddname dynamically

Postby Gilles » Mon Sep 29, 2008 6:46 pm

In a typical batch job, all temporary datasets are allocated to system generated ddnames that look like SYS00098. Is there a built in function you can call in REXX, either batch or interactive, that will return you a unique ddname not in use in the current job/environment ? I know I could try to write a simple function that would return a random string of numbers I could append to the SYS prefix and check if it's in use but I was wondering if it's already built in and I've never found it.

Thanks.
Gilles
 
Posts: 16
Joined: Mon Sep 29, 2008 6:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Generate a ddname dynamically

Postby Bill Dennis » Mon Sep 29, 2008 8:22 pm

Not sure about any existing service but if you do your own I'd suggest using a prefix other than SYS to avoid confusion and possible duplication.
Regards,

Bill Dennis

Disclaimer: My comments on this forum are my own and do not represent the opinions or suggestions of any other person or business entity.
Bill Dennis
 
Posts: 278
Joined: Thu May 15, 2008 9:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Generate a ddname dynamically

Postby ritwik.das » Tue Feb 10, 2009 12:41 pm

Hi Gilles,

I was going through old posts and found your one. Not sure whether you still need this but here is a solution that worked for me -

DDNAME = "SYS" || RANDOM(1,99999)

RAN is a built-in function that'll generate a random number between 1 and 99999.
Thanks & Regards!
Ritwik
ritwik.das
 
Posts: 13
Joined: Wed Jul 16, 2008 10:27 am
Has thanked: 0 time
Been thanked: 0 time

Re: Generate a ddname dynamically

Postby Bill Dennis » Tue Feb 10, 2009 7:44 pm

Just do an ALLOC giving only DSNAME and the system assigns the next SYSxxxxxx DDname for you.
Regards,

Bill Dennis

Disclaimer: My comments on this forum are my own and do not represent the opinions or suggestions of any other person or business entity.
Bill Dennis
 
Posts: 278
Joined: Thu May 15, 2008 9:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Generate a ddname dynamically

Postby latfgtot » Wed Feb 25, 2009 5:10 am

I always use the time offset in seconds to do this e.g. ddname = "D"||TIME("s")
latfgtot
 
Posts: 1
Joined: Wed Feb 25, 2009 5:02 am
Has thanked: 0 time
Been thanked: 0 time


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post