Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Unique dataset creation

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
hariibm

New User


Joined: 05 Feb 2007
Posts: 61
Location: Chennai

PostPosted: Tue Oct 12, 2010 1:19 pm    Post subject: Unique dataset creation
Reply with quote

Hi,

I am coding a REXX utility/macro and it creates an output file.

What would be the best approach to ensure that it creates the unique dataset every time this utility is run.

Regards,
Harikrishna.
Back to top
View user's profile Send private message

hariibm

New User


Joined: 05 Feb 2007
Posts: 61
Location: Chennai

PostPosted: Tue Oct 12, 2010 1:23 pm    Post subject:
Reply with quote

Please note this utility can be run multiple times in a day.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Oct 12, 2010 2:01 pm    Post subject:
Reply with quote

your ALLOCAT command will return an error when you attempt to allocate a file as new, when it already exists.
so code to re-enter you name generating algorithm.

but then again, I assume you meant 'unique dataset name'.
If not, I apologize for dropping by this thread.
Back to top
View user's profile Send private message
kacks7

New User


Joined: 22 Sep 2010
Posts: 33
Location: chennai(india)

PostPosted: Tue Oct 12, 2010 2:05 pm    Post subject:
Reply with quote

hi hariibm,
use the date and time combination for the qualifiers of your dataset.
Back to top
View user's profile Send private message
hariibm

New User


Joined: 05 Feb 2007
Posts: 61
Location: Chennai

PostPosted: Tue Oct 12, 2010 2:10 pm    Post subject:
Reply with quote

Hello Dick Brenholtz,
Yes, exactly. My macro is failing when I am trying to run second time.
I am creating the dataset like below:
userid.mon+days.xxx
ie, If userid = YAF8, Mon = Oct, days = 285, then the dataset would be YAF8.OCT285.XXX

I want this utility to create a different dataset next time when it is run and it should not give any error. so please let me know how to create a unique dataset.

It is ok if the existing dataset can be used. But the ALLOCAT command try to create new. please guide how to go ahead.

Regards,
Hari
Back to top
View user's profile Send private message
notonly4u

New User


Joined: 26 Apr 2005
Posts: 87
Location: Hyderabad

PostPosted: Tue Oct 12, 2010 2:14 pm    Post subject:
Reply with quote

Can't GDGs be used?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Oct 12, 2010 2:30 pm    Post subject:
Reply with quote

one second you say unique - where Kacks7's suggestion is appropriate
and the next you say that you can reuse existing DS, which means you can use a disposition of MOD.

what actually is the use of the DS? and don't say output of the REXX.

USERID as HLQ isolates the DS to each user.
if there is a requirement for multiple DS to exist, date & time are easy ways to name a file.
If there is no need to maintain multiple DS for each user, make it a standard name (fixed name), and use MOD.

or you could do what many 3rd party tools do:

create a temporary dataset,
invoke a Browse or VIEW
and leave it to the user to make a copy if there is a requirement to save the file.

notonly4U,
though GDG's could be used,
a gdg base would be required for every user
Back to top
View user's profile Send private message
hariibm

New User


Joined: 05 Feb 2007
Posts: 61
Location: Chennai

PostPosted: Tue Oct 12, 2010 2:32 pm    Post subject:
Reply with quote

No. GDGs can't be used.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Oct 12, 2010 2:57 pm    Post subject:
Reply with quote

Any particular reason why a GDS is inappropriate ?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Oct 12, 2010 3:56 pm    Post subject:
Reply with quote

one of the things I enjoy about this forum is that it does reflect a microcosm of the world.

87 questions have been asked of the TS,
and what does he provide as a response?.
hariibm wrote:
No. GDGs can't be used.


the TS only wants suggestions that empower his solution to work.
as usual,
don't confuse me with facts,
just tell me what I want to hear
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Tue Oct 12, 2010 4:52 pm    Post subject: Reply to: Unique dataset creation
Reply with quote

Well, if I had to do this, and I wanted to assure unique dataset names, I'd consider using some or all of the following within the nodes:

- Current Date (MMDDYY or YYYYDDD or Base Date).
- Current Time (HHMMSS or # of seconds since midnight).
- System ID if it might run on different LPAR's.
- If the process was running as a batch job, I also might include the jobname, jobid, account.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Oct 13, 2010 2:05 am    Post subject:
Reply with quote

Hello,

If one becomes really really creative when generating a unique dataset name it may be very difficult to reference the dataset later. . .
Back to top
View user's profile Send private message
Kurt Deininger

New User


Joined: 13 Jul 2010
Posts: 19
Location: Frankfurt/Germany

PostPosted: Wed Oct 13, 2010 3:00 pm    Post subject:
Reply with quote

Hi Hariibm,

A simple solution would be to create a file having a counter being updated each time(set it to zero after creation):

Code:

/* REXX */                                                             
   trace r                                                             
   address tso "alloc fi(temp) da(version) shr reuse"                   
   address tso "execio 1 diskr temp (open stem vers. finis)"           
   address tso "free fi(temp)"                                         
   vers.1=vers.1+1                                                     
   version=vers.1                                                       
   address tso "alloc fi(temp) da(version) shr reuse"                   
   address tso "execio 1 diskw temp (open stem vers. finis)"           
   address tso "free fi(temp)"                                         
   uniqnam="whatever"right(version,4,0)                                 
EXIT                                                                   


which yieds:

Code:

  3 *-* address tso "alloc fi(temp) da(version) shr reuse"       
    >>>   "alloc fi(temp) da(version) shr reuse"                 
  4 *-* address tso "execio 1 diskr temp (open stem vers. finis)"
    >>>   "execio 1 diskr temp (open stem vers. finis)"           
  5 *-* address tso "free fi(temp)"                               
    >>>   "free fi(temp)"                                         
  6 *-* vers.1=vers.1+1                                           
    >>>   "1"                                                     
  7 *-* version=vers.1                                           
    >>>   "1"                                                     
  8 *-* address tso "alloc fi(temp) da(version) shr reuse"       
    >>>   "alloc fi(temp) da(version) shr reuse"                 
  9 *-* address tso "execio 1 diskw temp (open stem vers. finis)"
    >>>   "execio 1 diskw temp (open stem vers. finis)"           
 10 *-* address tso "free fi(temp)"                               
    >>>   "free fi(temp)"                                         
 11 *-* uniqnam="whatever"right(version,4,0)                     
    >>>   "whatever0001"                                         
 12 *-* EXIT                                                     


and so on
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Oct 13, 2010 4:12 pm    Post subject:
Reply with quote

Again I ask ................................
expat wrote:
Any particular reason why a GDS is inappropriate ?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm
No new posts Allocate dataset withour BLKSIZE Susanta CLIST & REXX 2 Thu Sep 22, 2016 11:51 am
No new posts Command UNIQUE CONSTRAINT on any tabl... rohanthengal DB2 2 Thu Aug 18, 2016 3:48 pm
No new posts dataset copy question - REPRO or some... atulxp TSO/ISPF 2 Wed Aug 03, 2016 10:56 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us