Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Getting RC as '-3' for LMCOPY

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
yuvaraj C

New User


Joined: 01 Jan 2008
Posts: 14
Location: IBM-India

PostPosted: Thu Nov 06, 2008 12:31 pm    Post subject: Getting RC as '-3' for LMCOPY
Reply with quote

Hi,


I have a requirement which should accept datasets from the user for copy.

I have written a logic in REXX which is as follows:

SAY 'PLEASE SELECT ANY ONE OF THE FOLLOWING OPTIONS'
SAY "1.GENERAL COPY"
SAY "2.FOR PROJECT"
PULL OPT1
IF OPT1 = 1 THEN
DO
SAY 'PLEASE ENTER THE INPUT DATASET NAME'
PULL DS1
SAY 'PLEASE ENTER THE OUTPUT DATASET NAME'
PULL DS2
ADDRESS ISPEXEC
"LMINIT DATAID(INDD1) DATASET('DS1')"
"LMINIT DATAID(OUTDD1) DATASET('DS2')"
"LMCOPY FROMID("INDD1") TODATAID("OUTDD1")"
SIGNAL VALID
END

ELSE
SAY 'LOGIC NOT CODED'
VALID:
IF RC = 0 THEN
DO
SAY 'THE COPY IS SUCCESSFUL'
"LMFREE DATAID("INDD1")"
"LMFREE DATAID("OUTDD1")"
EXIT
END
ELSE
SAY 'COPY UNSUCCESSFUL'
"LMFREE DATAID("INDD1")"
"LMFREE DATAID("OUTDD1")"
EXIT

When I executed the above logic by giving 2 input datasets I got the following error message:

13 *-* "LMINIT DATAID(INDD1) DATASET('DS1')"
+++ RC(-3) +++
14 *-* "LMINIT DATAID(OUTDD1) DATASET('DS2')"
+++ RC(-3) +++
15 *-* "LMCOPY FROMID('INDD1') TODATAID('OUTDD1')"
+++ RC(-3) +++
COPY UNSUCCESSFUL
30 *-* "LMFREE DATAID('INDD1')"
+++ RC(-3) +++
31 *-* "LMFREE DATAID('OUTDD1')"


Can somebody help me on this?

Thanks,
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: Thu Nov 06, 2008 12:40 pm    Post subject:
Reply with quote

This works for me, but may need a bit of adaption to meet your own needs.

Code:

"ISPEXEC LMINIT DATAID(INLIB)  DATASET('"DSN_FROM"')   ENQ(SHR)"
"ISPEXEC LMINIT DATAID(OULIB)  DATASET('"DSN_TO"')     ENQ(SHR)"
"ISPEXEC LMOPEN DATAID("INLIB")  OPTION(INPUT)"           
"ISPEXEC LMCOPY FROMID("INLIB") FROMMEM("ZLMEMBER") ,     
                TODATAID("OULIB") REPLACE"                 
RCX = RC                                                   
SAY "RETURN CODE FOR MEMBER COPY "ZLMEMBER" WAS "RCX       
"ISPEXEC LMCLOSE DATAID("INLIB")"                         
"ISPEXEC LMCLOSE DATAID("OULIB")"                         
"ISPEXEC LMFREE  DATAID("INLIB")"                         
"ISPEXEC LMFREE  DATAID("OULIB")"                         
Back to top
View user's profile Send private message
yuvaraj C

New User


Joined: 01 Jan 2008
Posts: 14
Location: IBM-India

PostPosted: Thu Nov 06, 2008 2:15 pm    Post subject: Reply to: Getting RC as '-3' for LMCOPY
Reply with quote

Hi,

As per the example which you have given,I have modified the logic as below:

ADDRESS ISPEXEC
"ISPEXEC LMINIT DATAID(INDD1) DATASET('"DS1"') ENQ(SHR)"
"ISPEXEC LMINIT DATAID(OUTDD1) DATASET('"DS2"') ENQ(SHR)"
"ISPEXEC LMCOPY FROMID("INDD1") TODATAID("OUTDD1")"
SIGNAL VALID
END
ELSE
SAY 'LOGIC NOT CODED'
VALID:
IF RC = 0 THEN
DO
SAY 'THE COPY IS SUCCESSFUL'
ADDRESS ISPEXEC
"ISPEXEC LMFREE DATAID("INDD1")"
"ISPEXEC LMFREE DATAID("OUTDD1")"
EXIT
END

ELSE
SAY 'COPY UNSUCCESSFUL'
ADDRESS ISPEXEC
"ISPEXEC LMFREE DATAID("INDD1")"
"ISPEXEC LMFREE DATAID("OUTDD1")"
EXIT

But still it's giving the error as follows:

13 *-* "ISPEXEC LMINIT DATAID(INDD1) DATASET('"DS1"') ENQ(SHR)"
+++ RC(-3) +++
14 *-* "ISPEXEC LMINIT DATAID(OUTDD1) DATASET('"DS2"') ENQ(SHR)"

+++ RC(-3) +++
15 *-* "ISPEXEC LMCOPY FROMID("INDD1") TODATAID("OUTDD1")"
+++ RC(-3) +++
COPY UNSUCCESSFUL
32 *-* "ISPEXEC LMFREE DATAID("INDD1")"
+++ RC(-3) +++
33 *-* "ISPEXEC LMFREE DATAID("OUTDD1")"
+++ RC(-3) +++


Could you help me to resolve this?

Thanks
Back to top
View user's profile Send private message
superk

Moderator Team Head


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

PostPosted: Thu Nov 06, 2008 6:59 pm    Post subject: Reply to: Getting RC as '-3' for LMCOPY
Reply with quote

Yuvaraj, I ran a slightly tweaked copy of your code and it worked fine:

Code:

/* REXX */
Say "Please select any one of the following options"
Say "1.General Copy"
Say "2.For Project"
Pull opt1
If opt1 = 1 Then
  Do
    Say "Please enter the input dataset name"
    Pull ds1
    Say "Please enter the output dataset name"
    Pull ds2
    Address ISPEXEC
    "LMINIT DATAID(indd1) DATASET('"ds1"')"
    "LMINIT DATAID(outdd1) DATASET('"ds2"')"
    "LMCOPY FROMID("indd1") FROMMEM(*)",
    "TODATAID("outdd1") REPLACE"
    retcode = rc
    Signal VALID
  End
Else Say "Logic not coded"
Exit 0

VALID:
If retcode = 0 Then
  Do
    Say "The copy is successful"
    "LMFREE DATAID("indd1")"
    "LMFREE DATAID("outdd1")"
    Exit 0
  End
Else
  Do
    Say "The copy is unsuccessful"
    "LMFREE DATAID("indd1")"
    "LMFREE DATAID("outdd1")"
    Exit 0
  End


The RC(-3) when you call an ISPF Service should be of concern, since that usually means that you don't have ISPF Services available. Could you run this little bit of diagnostic code and post your results?

Code:

/* REXX */
Parse Source src
Parse Var src . . execname ddname dsname . env adrspc user .
Say execname ddname env adrspc
Exit 0
Back to top
View user's profile Send private message
yuvaraj C

New User


Joined: 01 Jan 2008
Posts: 14
Location: IBM-India

PostPosted: Thu Nov 06, 2008 7:42 pm    Post subject: Reply to: Getting RC as '-3' for LMCOPY
Reply with quote

Hi,

I ran the diagnostic code,please find the results below:

READY
EXEC 'R05905.LIB.REXX(DIAG)' EXEC
DIAG SYS00125 TSO TSO/E
READY


Could you let me know how to proceed further?


Thanks,
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10310
Location: italy

PostPosted: Thu Nov 06, 2008 7:55 pm    Post subject: Reply to: Getting RC as '-3' for LMCOPY
Reply with quote

anything using ISPF services must run under ISPF
try to run it under ispf option 6
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10310
Location: italy

PostPosted: Thu Nov 06, 2008 8:03 pm    Post subject: Reply to: Getting RC as '-3' for LMCOPY
Reply with quote

but I think that the approach is wrong...
why keep a terminal locked and the user waiting for a copy to terminate

all the interactive task should be analyzed correctly,
why run a copy in foreground when batch is better suited..

nothing prevents You from building interactively the JCl and submit a batch
to carry onthe copy.

also from a usability point of view
the correct approach is to use ISPF dialogs and not let the user hanging
on a request for a dataset name

a good model to start with ( and simplify it of course ) is the 3.3 ISPF option

provide fields for ...
input datset,
output dataset
allocation parameters if new
after having checked everything You would submit
a batch job to carry on the copy

better looking approach an more inline with state of the art technologies
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 Question on LMCOPY rohanthengal TSO/ISPF 13 Thu Feb 12, 2015 6:16 pm
No new posts Multiple LMCOPY resulting incorrect copy k.junaid83 CLIST & REXX 1 Tue Sep 02, 2014 7:22 pm
No new posts Query on SMCOPY/LMCOPY srinut123 TSO/ISPF 2 Tue Jul 16, 2013 6:40 pm
No new posts LMCOPY to Temporary dataset Bill Woodger CLIST & REXX 19 Mon Mar 19, 2012 12:41 am
No new posts LMCOPY and ISRSUPC not working as exp... Nandananilchintala TSO/ISPF 5 Wed Aug 19, 2009 2:39 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us