IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to create a VSAM file using Rexx?


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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

Global Moderator


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

PostPosted: Fri Aug 22, 2008 5:42 pm
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: 459
Location: Belgium

PostPosted: Fri Aug 22, 2008 5:47 pm
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: 8797
Location: Welsh Wales

PostPosted: Fri Aug 22, 2008 6:31 pm
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
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
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: 459
Location: Belgium

PostPosted: Wed Aug 27, 2008 4:16 pm
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: 8797
Location: Welsh Wales

PostPosted: Wed Aug 27, 2008 4:20 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top