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
 

 

How to create a VSAM file using Rexx?

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

New User


Joined: 02 Apr 2008
Posts: 11
Location: Chennai

PostPosted: Fri Aug 22, 2008 5:16 pm    Post subject: How to create a VSAM file using Rexx?
Reply with quote

Hi All,

Can anybody help me by giving the code/clear idea to create a VSAM file using Rexx.
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: Fri Aug 22, 2008 5:42 pm    Post subject: Reply to: How to create a VSAM file using Rexx?
Reply with quote

You can call the TSO DEFINE CLUSTER command.
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Fri Aug 22, 2008 5:47 pm    Post subject:
Reply with quote

Just TSO/E Command ALLOCATE
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: Fri Aug 22, 2008 6:31 pm    Post subject:
Reply with quote

Why would you want to use REXX instead of good ole IDCAMS ?
Back to top
View user's profile Send private message
kabyab

New User


Joined: 31 Aug 2005
Posts: 34
Location: Pune, India

PostPosted: Wed Aug 27, 2008 4:05 pm    Post subject: Reply to: How to create a VSAM file using Rexx?
Reply with quote

Hi expat, I have a similar requirement where in I have to create 240 VSAM datasets required in 240 different JCLs. I am creating those 240 JCLs through REXX.
If there is anyway to create the VSAM Clusters through REXX then it will be great. I can create them through IDCAMS but I was thinking of REXX option.
Back to top
View user's profile Send private message
J.P.R.Kumar

New User


Joined: 02 Apr 2008
Posts: 11
Location: Chennai

PostPosted: Wed Aug 27, 2008 4:14 pm    Post subject: Reply to: How to create a VSAM file using Rexx?
Reply with quote

I found the solution for my requirement, the same is below

ADDRESS TSO
"ALLOC DS(HANITST) RECORG(KS) LRECL(500) KEYLEN(8) NEW"

DS - DATASET NAME
RECORG - ORGANISATION TYPE

IF we have to be more specific, then we can also use the rexx functions and include space parametres like clusters etc...
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Wed Aug 27, 2008 4:16 pm    Post subject:
Reply with quote

heu !!!! That was ( 22-08-2008) in my post no ?l
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 Aug 27, 2008 4:20 pm    Post subject:
Reply with quote

Something like this
Code:

/* REXX *** DELETE DEFINE VSAM CLUSTER                               */
                                                                       
A = " DELETE 'CLUSTER NAME' "                                           
A                                                                       
                                                                       
A = " DEFINE CLUSTER(NAME (CLUSTER NAME) "                             
A = A " VOL(*) NOREUSE TRACKS(8 1) "                                   
A = A " INDEXED  KEYS(12 0) RECSZ(80 80 )) "                           
A = A " DATA(CISZ(20480))"                                             
A                                                                       


Or, you could use your REXX to generate all of the VSAM defines into a dataset and only run one IDCAMS.
Back to top
View user's profile Send private message
kabyab

New User


Joined: 31 Aug 2005
Posts: 34
Location: Pune, India

PostPosted: Wed Aug 27, 2008 6:11 pm    Post subject:
Reply with quote

Thanks everyone for the help. I was in a bit of hurry to finish off my assignment so I took an easy way out by coding as follows to create multiple empty VSAM files.

Here my inputs would be
1. 8600 - start cycle
2. 8605 - end cycle
3. KB8675.DBN.REXX.C&CYCL.VSAM.OUTPUT - o/p VSAM dataset
4. KB8675.OUTPUT.VSAM1 - as reference VSAM whose properties have been used to create further cycle noded VSAMs.

Code:

/* REXX exec to increment cycle by 1 each time until ecycle is reached*/
SAY "enter start cycle no: "                                           
pull scycl                                                             
SAY "enter end cycle no: "                                             
pull ecycl                                                             
                                                                       
SAY "enter the o/p VSAM Dataset name with C&CYCL"                       
pull output                                                             
                                                                       
SAY "enter the reference VSAM Dataset name"                             
pull reference                                                         
                                                                       
limit = ecycl - scycl + 1                                               
say "limit= " limit                                                     
do cntcycl=0 to limit by 1 until ncycl = ecycl                         
   ncycl=scycl+cntcycl                                                 
   say "newcycl = "ncycl                                               
                                                                       
/*PARSE OUTPUT NAME TO CREATE AN OUTPUT CYCLE NODED VSAM FILE*/         
/*REFERENCE VSAM FILE SHOULD BE PRSENT PRIOR TO RUNNING THIS*/         
   parse upper value output with lftside ."&CYCL" rgtside               
                                                                       
   pdshaystk = output                                                   
   pdsneedle = "&CYCL"                                                 
   pdsovrlay = ncycl                                                   
/* say "pdshaystk = "pdshaystk                                         
   say "pdsneedle = "pdsneedle                                         
   say "pdsovrlay = "pdsovrlay                                         
*/                                                                     
   pdsoffset = pos(pdsneedle,pdshaystk)                                 
   if pdsoffset = 0 then                                               
      pdsnewstk = pdshaystk                                             
   else do                                                             
      if length(pdsneedle)=length(pdsovrlay) then                       
         pdsnewstk = overlay(pdsovrlay,pdshaystk,pdsoffset)             
      else                                                             
         pdsnewstk = substr(pdshaystk,1,pdsoffset-1) || pdsovrlay ||,   
         substr(pdshaystk,pdsoffset+length(pdsneedle))                 
      end                                                               
   say "*** pdsnewstk= " pdsnewstk                                     
   say " Allocating new VSAM file "pdsnewstk                           
   ADDRESS TSO                                                         
   "ALLOC DSN('"pdsnewstk"') LIKE('"reference"')"                       
end                                                                     
say "goodbye"                                                           
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts Underlying DB2 VSAM LDS - SMF recording vasanthz All Other Mainframe Topics 6 Thu Jan 05, 2017 4:20 am
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm


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