creating a new member in existing pds



TSO Programming, ISPF, SDF, SDSF and PDF, FTP, TCP/IP Concepts, SNA & SNA/IP etc...

creating a new member in existing pds

Postby srn123 » Thu Aug 27, 2009 5:25 pm

Hi All,

I am new to rexx coding.
Could you please give me an example of how to create a new member in an existing pds and copy the contents of one pds member to the newly created pds member?

eg. I need to create a member mem1 in pds userid.rexx.exec(already exisiting pds) and copy the contents of userid.rexx.exec(mem2) to userid.rexx.exec(mem1).

Thanks!
srn123
 
Posts: 13
Joined: Wed Aug 26, 2009 6:07 pm
Has thanked: 0 time
Been thanked: 0 time

Re: creating a new member in existing pds

Postby expat » Thu Aug 27, 2009 8:18 pm

LMCOPY expertly detailed in the ISPF manuals will do it for you.
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times

Re: creating a new member in existing pds

Postby srn123 » Fri Aug 28, 2009 10:09 am

Thanks. It is working fine. However I have one more question. I get a ISPF Dialog error when the new member already exists in the pds. If I use the replace keyword, it is working fine but I do not want to use it as I need to show an error message if the member already exists. Please find the code below to copy mem1 to mem2 -
ADDRESS ISPEXEC
"LMINIT DATAID(INDD1) DATASET('userid.rexx.exec')"
"LMINIT DATAID(OUTDD1) DATASET('userid.rexx.exec')"
"LMCOPY FROMID("INDD1") TODATAID("OUTDD1") FROMMEM(MEM1)
TOMEM(MEM2) "
IF RC\=0 THEN
SAY 'FAILED TO COPY'
ELSE
SAY 'COPIED'
"LMFREE DATAID("INDD1")"
"LMFREE DATAID("OUTDD1")"

Could you please let me know why a ispf dialog error comes and also how to eliminate it so that I get only the message 'FAILED TO COPY'
srn123
 
Posts: 13
Joined: Wed Aug 26, 2009 6:07 pm
Has thanked: 0 time
Been thanked: 0 time

Re: creating a new member in existing pds

Postby expat » Fri Aug 28, 2009 11:53 am

What happens when you hit an error with your current code.
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times

Re: creating a new member in existing pds

Postby srn123 » Fri Aug 28, 2009 3:24 pm

Below is the error screen that I get -


ISPF Dialog Error
Command ===>

******************************************************************************************
* ISRU115 *
* *
* REXX3 not replaced *
* Like-named member already exists in "to" data set. *
* *
* *
* *
* *
* *
* *
* Current dialog statement: *
* LMCOPY FROMID(ISR00002) TODATAID(ISR00003) FROMMEM(MEM1) *
* *
* Enter HELP command for further information regarding this error. *
* Press ENTER key to terminate the dialog. *
* *
* *
* *
* *
*******************************************************************************************
srn123
 
Posts: 13
Joined: Wed Aug 26, 2009 6:07 pm
Has thanked: 0 time
Been thanked: 0 time

Re: creating a new member in existing pds

Postby srn123 » Fri Aug 28, 2009 3:27 pm

In the above post, REXX3 is actually MEM2(the member that exists already in the pds) according to my second post
srn123
 
Posts: 13
Joined: Wed Aug 26, 2009 6:07 pm
Has thanked: 0 time
Been thanked: 0 time

Re: creating a new member in existing pds

Postby expat » Fri Aug 28, 2009 4:59 pm

Put this at the top of your code
"ISPEXEC CONTROL ERRORS RETURN"
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times

Re: creating a new member in existing pds

Postby srn123 » Fri Aug 28, 2009 5:18 pm

Thanks expat! it worked. Could you please let me know why the dialog error comes instead of the message 'FAILED TO COPY' and how the above line of code eliminates this?
srn123
 
Posts: 13
Joined: Wed Aug 26, 2009 6:07 pm
Has thanked: 0 time
Been thanked: 0 time

Re: creating a new member in existing pds

Postby expat » Fri Aug 28, 2009 5:54 pm

Works OK with my code
"ISPEXEC LMCOPY FROMID("INLIB") FROMMEM("ZLMEMBER") ,   
                TODATAID("OULIB")"                       
IF RC = 0                                               
   THEN  SAY ZLMEMBER "SUCCESSFUL COPY"                 
   ELSE  SAY ZLMEMBER "COPY FAILED - RETURN CODE "RC     


Or do you mean why does the previous code eliminate the ISPF error messages.
Because it returns control to the ISPF function being actioned when an error is encountered to allow for user written error handling routines.
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times


Return to TSO & ISPF

 


  • Related topics
    Replies
    Views
    Last post