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

How to create a PDS member in REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
banuradha

New User


Joined: 20 Dec 2006
Posts: 19
Location: India

PostPosted: Fri Jan 12, 2007 12:32 pm
Reply with quote

Hi all ,

How to create a PDS member using REXX

LISTDS function helps us list the members.But I need to create members
in a same PDS using REXX.
Back to top
View user's profile Send private message
Sahoo

New User


Joined: 08 Jun 2006
Posts: 53

PostPosted: Fri Jan 12, 2007 12:37 pm
Reply with quote

DSN = A.b.c(Memname)

If you have already created a PDs and trying to create a member in it.

"alloc dataset('"dsn"') fi(outdd) shR ",

else

dsn = A.B.C

"alloc dataset('"dsn"') fi(outdd) new ",
"space(2,1) cylinders ",
"LRECL(150) ",
"dsorg(PS) ",
"recfm(F B) ",
"dir(10) "
Back to top
View user's profile Send private message
amitava
Warnings : 1

Active User


Joined: 30 Oct 2005
Posts: 186
Location: India

PostPosted: Fri Jan 12, 2007 12:52 pm
Reply with quote

Hi banuradha,
You have not cleared your query or otherwise I am not getting it. Do you want to create a balnk member in the PDS or you want to write something in a new member of your PDS. However, if you want to write something in a member of your PDS, you can follow the code -

Code:

/*REXX*/
ADDRESS TSO
dsnname = '[i]PDS Name[/i]' || '(' || [i]memname[/i] || ')'
"ALLOC DA('"dsnname"') F(LOGICAL) SHR"
"EXECIO * DISKW (STEM DATA. FINIS"
"FREE F(LOGICAL)"


- Where DATA is a stem having the data to be written to that member of your PDS.

If you want to create an empty member, then you can use the following code in this way also -

Code:

/*REXX*/
ADDRESS TSO
DROP DATA.
DATA.0 = 1
dsnname = '[i]PDS Name[/i]' || '(' || [i]memname[/i] || ')'
"ALLOC DA('"dsnname"') F(LOGICAL) SHR"
"EXECIO * DISKW (STEM DATA. FINIS"
"FREE F(LOGICAL)"
Back to top
View user's profile Send private message
banuradha

New User


Joined: 20 Dec 2006
Posts: 19
Location: India

PostPosted: Fri Jan 12, 2007 1:24 pm
Reply with quote

No,I need to create 5 empty members by just running the REXX.The code u suggested is not helping me.The PDS name will not be created already.I have to create the PDS and then , have to create those members.
Back to top
View user's profile Send private message
amitava
Warnings : 1

Active User


Joined: 30 Oct 2005
Posts: 186
Location: India

PostPosted: Fri Jan 12, 2007 3:22 pm
Reply with quote

Hi banuradha,
Then you have to use the corresponding code for allocating the PDS, right! That'sthe thing is incorporated in the code, so the code will not run, obviously. However, look the following code for allocation of a PDS :-
Code:

/*REXX*/
ADDRESS TSO
"ALLOC DA('"Your Dataset Name-PDS"') F(LOGICAL) NEW SPACE(10,20) DIR(100) TRACKS"
"FREE F(LOGICAL)"
RETURN

N.B :- This code will create the PDS only so you have to incorporate previous code after it.

However, in the previous code, I used and to indicate the letters in italics.


So the total code wil be like -
[code]
/*REXX*/
ADDRESS TSO
"ALLOC DA('"Your Dataset Name-PDS"') F(LOGICAL) NEW SPACE(10,20) DIR(100) TRACKS"
"FREE F(LOGICAL)"

DROP DATA.
DATA.0 = 1
dsnname = 'Your Dataset Name-PDS' || '(' || Member Name || ')'
"ALLOC DA('"dsnname"') F(LOGICAL) SHR"
"EXECIO * DISKW (STEM DATA. FINIS"
"FREE F(LOGICAL)"
RETURN
[\code]
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 Jan 12, 2007 6:11 pm
Reply with quote

Here's one exec with four different methods. Please note that there is no REXX facility for directly dealing with the concept of a PDS, but rather an appropriate TSO, ISPF, or batch method must be employed.

Code:

/* REXX */                                                   
"DELETE MY.NEW.PDS1"                                         
"DELETE MY.NEW.PDS2"                                         
"DELETE MY.NEW.PDS3"     
"DELETE MY.NEW.PDS4"                                     
"ALLOC DA(MY.NEW.PDS1) NEW REU RECFM(F B) LRECL(80)",       
"DIR(255) SPACE(10,10) TRACKS UNIT(SYSDA)"                   
"ALLOC DA(MY.NEW.PDS2) NEW REU RECFM(F B) LRECL(80)",       
"DIR(255) SPACE(10,10) TRACKS UNIT(SYSDA)"                   
"ALLOC DA(MY.NEW.PDS3) NEW REU RECFM(F B) LRECL(80)",       
"DIR(255) SPACE(10,10) TRACKS UNIT(SYSDA)"   
"ALLOC DA(MY.NEW.PDS4) NEW REU RECFM(F B) LRECL(80)",       
"DIR(255) SPACE(10,10) TRACKS UNIT(SYSDA)"                   
                                                             
Do n = 1 To 5                                               
  "ALLOC DD(#"n") DA(MY.NEW.PDS1(#"n")) SHR REU"             
  Push " "                                                   
  "EXECIO 1 DISKW #"n" (FINIS"                               
  "FREE DD(#"n")"                                           
End                                                         
"LISTDS MY.NEW.PDS1 MEMBERS"                                 
                                                             
"ALLOC DD(sysprint) DUMMY REU"                               
"ALLOC DD(sysut2) DA(MY.NEW.PDS2) SHR REU"                   
"ALLOC DD(sysin) NEW REU RECFM(F B) LRECL(80) UNIT(VIO)"             
Do n = 1 To 5                                                         
  Queue './ ADD NAME=#'n                                             
  Queue ' '                                                           
End                                                                   
"EXECIO "Queued()" DISKW sysin (FINIS"                               
"CALL *(IEBUPDTE) 'NEW'"                                             
"FREE DD(sysprint sysut2 sysin)"                                     
"LISTDS MY.NEW.PDS2 MEMBERS"                                         
"DELSTACK"                                                           
                                                                     
Do n = 1 To 5                                                         
  "ISPEXEC EDIT DATASET(MY.NEW.PDS3(#"n")) MACRO(MYMAC)"             
End                                                                   
"LISTDS MY.NEW.PDS3 MEMBERS"       
                                                                       
"ISPEXEC LMINIT DATAID(did) DATASET(MY.NEW.PDS4) ENQ(EXCLU)"           
"ISPEXEC LMOPEN DATAID("did") OPTION(OUTPUT)"                         
line = ' '                                                             
Do n = 1 To 5                                                         
  "ISPEXEC LMPUT DATAID("did") MODE(INVAR) DATALOC(line) DATALEN(80)" 
  "ISPEXEC LMMADD DATAID("did") MEMBER(#"n")"                         
End                                                                   
"ISPEXEC LMFREE DATAID("did")"                                         
"LISTDS MY.NEW.PDS4 MEMBERS"                                                                             
                                                                     
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 Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top