MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Creating a New Member via REXX
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Jan 16, 2003 12:45 am    Post subject: Creating a New Member via REXX Reply with quote

Can we create a new Member inside a PDS using REXX routine. When I tried, I got an error. But when I create a PS (Not as a Member) then I don't get any error. Is there any way to create a Member from REXX?

Please advise

Thanks & Regards,
Navin. J
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Thu Jan 16, 2003 1:16 am    Post subject: Reply with quote

Sure. Lots of ways... what did you try and what error did you get?
Back to top
View user's profile Send private message Visit poster's website
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Jan 16, 2003 3:13 am    Post subject: Reply with quote

Here is my code
PSNAME Will contain the Member Name as 'TSONJAY.REXX.TEMP(MEM1)'

Code:

"ALLOC FI(OUTFILE) DA("PSNAME") NEW UNIT(SYSDA)",
"SP(10, 10) TRA DSORG(PS) DIR(0) BLKSIZE(8000)",
"LRECL(80) RECFM(F B) REUSE"                     


Here is the error I got

Code:

    IKJ56893I DATA SET TSONJAY.REXX.TEMP NOT ALLOCATED+                             
    IGD17101I DATA SET TSONJAY.REXX.TEMP NOT DEFINED BECAUSE DUPLICATE NAME EXISTS
IN CATALOG                                                                       
    RETURN CODE IS 8 REASON CODE IS 38 IGG0CLEH                                     
    ***                                               
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Thu Jan 16, 2003 4:02 am    Post subject: Reply with quote

Ahhh. OK. Wink The problem is that the data set exists. The data set (the actual PDS) only needs to be created once. Once it exists, you can add or delete members to/from it. Basically, once it exists, you should allocate it SHR or OLD, not NEW. If you include a member name, EXECIO (or anything else that writes to the file) will automatically create the member you specified in the allocation.

There are, as I mentioned, many other ways to create a member other than EXECIO. For example, you can use ISPF's various services (LMPUT, EDIT, etc), you can use the TSO COPY command (but that has many things to watch out for so I wouldn't recommend it), you can use CLIST built in I/O statements, call IEBGENER or any other program to write to the member. You can also call any of the other standard utilities to create members (IEBwhatever).
Back to top
View user's profile Send private message Visit poster's website
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Jan 16, 2003 4:21 am    Post subject: Reply with quote

yes, semigeezer. It works when I specified SHR instead of NEW. Thanks.

Actually, I had given it as SHR initially, but that time I got some other error somewhere else, I think when I tried to write to that file but Mistakenly I thought its b'cas of NEW keyword and I changed it.

Thank you very much.
Back to top
View user's profile Send private message
Mike
Beginner


Joined: 03 Dec 2002
Posts: 114
Topics: 0
Location: Sydney, Australia

PostPosted: Thu Jan 16, 2003 3:26 pm    Post subject: Reply with quote

For mass creation of members I frequently use IEBUPDTE aka IEBwhatever Smile.
_________________
Regards,
Mike.
Back to top
View user's profile Send private message
DaveyC
Moderator


Joined: 02 Dec 2002
Posts: 151
Topics: 3
Location: Perth, Western Australia

PostPosted: Thu Jan 16, 2003 8:38 pm    Post subject: Reply with quote

You always did love a punch card Mike Laughing
_________________
Dave Crayford
Back to top
View user's profile Send private message Send e-mail
miboy
Beginner


Joined: 10 Jan 2003
Posts: 13
Topics: 0

PostPosted: Wed Jan 22, 2003 9:32 am    Post subject: Reply with quote

Code:

/* REXX */                                                     
PDS = 'XXXX.TEMP.PDS1'                                       
MEMBER = 'MBR2'                                                 
                                                               
IF  SYSDSN("'"PDS"'") <> 'OK' THEN                             
  DO                                                           
    "ALLOC F(PDS) DA('"PDS"') NEW UNIT(SYSDA)",                 
    "SP(10, 10) TRA DSORG(PO) DIR(10) BLKSIZE(8000)",           
    "LRECL(80) RECFM(F B)"                                     
    "FREE F(PDS)"                                               
  END                                                           
                                                               
IF  SYSDSN("'"PDS"("MEMBER")'") = 'OK' THEN                     
  DO                                                           
    SAY 'MEMBER ALREADY EXISTS, CANNOT ADD...'                 
    EXIT                                                       
  END                                                           
                                                               
"ISPEXEC CONTROL ERRORS RETURN"                                 
"ISPEXEC LMINIT DATAID(DATAID) DATASET('"PDS"') ENQ(SHRW)"     
"ISPEXEC LMOPEN DATAID("DATAID") OPTION(OUTPUT)"               
"ISPEXEC LMPUT DATAID("DATAID") MODE(INVAR)",                   
         " DATALOC(DATAVAR) DATALEN(80)"                       
"ISPEXEC LMMADD DATAID("DATAID") MEMBER("MEMBER")"             
"ISPEXEC LMFREE DATAID("DATAID")"                               
                                                               


Phantom,

The rexx code above will add a new member....

variable PDS will be ur PDS to hold the new member
variable MEMBER will be ur new member

Hope this helps
Miboy Smile
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Jan 23, 2003 6:06 am    Post subject: Reply with quote

Thanks miboy, Its working now.

thanks
Navin. J
Back to top
View user's profile Send private message
vikramdr
Beginner


Joined: 15 Feb 2003
Posts: 15
Topics: 11

PostPosted: Thu Mar 06, 2003 1:37 am    Post subject: Reply with quote

Hi,

U can create a member in a PDS using rexx. Following is the command..


"ALLOC F(LVERR) DA('"abcd.abcd(mem)"') SHR REUSE"
"EXECIO * DISKW LVERR(STEM MSG_FILE_STEM. FINIS"

The first line will allocate a DD which can be used in the rexx program. One important poin to be noted is, when allocating a PDS it should be always in SHR more. U cannot open in MOD. If u open in MOD and the member is already existing, and if u try to write to that member u will get and abend.

When opened in SHR mode and the member is already existing, the old content is lost and new content will be written. If the member is not exisiting already, new member will be created.

Thanks and regards,
Vikram.
_________________
Vikram
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Mar 06, 2003 5:11 am    Post subject: Reply with quote

Vikram,

Thanks for your valuable suggestions. I tried all your suggestions and they are working fine.

Thanks for your help.
Phantom
Back to top
View user's profile Send private message
modak
Beginner


Joined: 09 Apr 2004
Posts: 14
Topics: 3

PostPosted: Sat May 08, 2004 3:05 am    Post subject: Reply with quote

I am confused. Can anybody help me out...

when I am trying Phantom & Vikrams ay of creating a new member, my rexx codes ends up with RC=0 but NO new member is created...When I tried mboy way of doing it It cretaed a new member.

MY code is

member_path = 'TSOID.REXX.CNT(DDNAMES)'
mem=ddnames

Quote:


"ALLOC FI(NEWMEM) DA(" ''''member_path'''' ")",
"DSORG(PO) SPACE(2,2) TRACKS DIR(0) LRECL(80) BLKSIZE(8000)",
"RECFM(F,B) SHR UNIT(DEVPK) REUSE"

OR

"ALLOC F(NEWMEM) DA('TSOID.REXX.CNT(DDNAMES)') SHR REUSE"
"EXECIO * DISKW LVERR(STEM MSG_FILE_STEM. FINIS"
Back to top
View user's profile Send private message
modak
Beginner


Joined: 09 Apr 2004
Posts: 14
Topics: 3

PostPosted: Sat May 08, 2004 3:14 am    Post subject: Reply with quote

I tried keeping DSORG(PS) also
Back to top
View user's profile Send private message
Maton_Man
Beginner


Joined: 30 Jan 2004
Posts: 123
Topics: 0

PostPosted: Sun May 09, 2004 10:47 pm    Post subject: Reply with quote

In general, when writing to a any dataset, including a new PDS member, you should use OLD rather than SHR. Also, DSORG=PS will always give you a flat file, never a PDS.

Your ALLOC statement has parms specified as if you were going to allocate a new dataset but you are specifying SHR and REUSE as if it already exists. Which is true?

If your PDS already exists then allocate thus:

"ALLOC FI(PDS) DA('MY.PDS(NEWMEM)') OLD"

If you are creating your PDS as part of your first write process then allocate along these lines, obviously changing your space allocation to what you need:

"ALLOC FI(PDS) DA('MY.PDS(NEWMEM)') NEW DSORG(PO) SPACE(10) TRACKS DIR(100) RECFM(F B) LRECL(80) BLKSIZE(3120)"

You may have SDB in which case BLKSIZE(0) may be more appropriate.

If you are creating a PDSE then allocate along these lines:

"ALLOC FI(PDSE) DA('MY.PDSE(NEWMEM)') NEW DSORG(PO) SPACE(10) TRACKS RECFM(F B) LRECL(80) BLKSIZE(3120) DSNTYPE(LIBRARY)"
_________________
My opinions are exactly that.
Back to top
View user's profile Send private message
modak
Beginner


Joined: 09 Apr 2004
Posts: 14
Topics: 3

PostPosted: Sun May 09, 2004 11:05 pm    Post subject: Reply with quote

Thanks mato_man

I tried two options

Quote:

/* REXX */
"ALLOC FI(NEWMEM) DA('CKT9386.EXEC1(DDNAMES)') OLD"




and

Quote:

/* REXX */

"ALLOC FI(NEWMEM) DA('CKT9386.EXEC1(DDNAMES)') OLD"
"EXECIO * DISKW LVERR(STEM MSG_FILE_STEM. FINIS"



both returned RC=0 but didn't work either..I couldnt create a new mamber.

Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group