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

REXX code : LMOPEN DATAID giving dataid as ISR00014


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
srikanth_cts

New User


Joined: 27 Feb 2008
Posts: 25
Location: Phoenix, AZ,USA

PostPosted: Wed Oct 19, 2011 6:04 am
Reply with quote

Hi friends,
I am working on a REXX code to delete a member in pds with members starting with 'PA'. The below is the code

Code:

ADDRESS ISPEXEC                                       
"LMINIT DATASET('"INDS"') DATAID("DATA1") ENQ(EXCLU)"
SAY RC                                               
IF RC = 0 THEN DO                                     
"LMOPEN DATAID("DATA1") OPTION(OUTPUT)"               
END                                                   
IF RC = 0 THEN DO                                     
"LMMDEL DATAID("DATA1") MEMBER('"PA"')"               
END                                                   
"LMCLOSE DATAID("DATA1")"                             
"LMFREE DATAID("DATA1")"                             


Here INDS I am pulling from an ISPF panel I had created.

The issue I am facing is that the LMOPEN is not identifying the dataid created by LMINIT. Instead its picking some IDs like this : ISR00017, ISR00014 and the same by LMMDEL too. So, its not deleting the members I intended to.

Please find below the messages I am getting in trace:

Code:

ADDRESS ISPEXEC                                                   
"LMINIT DATASET('"INDS"') DATAID("DATA1") ENQ(EXCLU)"             
  "LMINIT DATASET('"                                               
  "INSRI01.TEST11.PROCLIB"                                         
  "LMINIT DATASET('INSRI01.TEST11.PROCLIB"                         
  "') DATAID("                                                     
  "LMINIT DATASET('INSRI01.TEST11.PROCLIB') DATAID("               
  "DATA1"                                                         
  "LMINIT DATASET('INSRI01.TEST11.PROCLIB') DATAID(DATA1"         
  ") ENQ(EXCLU)"                                                   
  "LMINIT DATASET('INSRI01.TEST11.PROCLIB') DATAID(DATA1) ENQ(EXCLU
"LMOPEN DATAID(ISR00017"                 
") OPTION(OUTPUT)"                       
"LMOPEN DATAID(ISR00017) OPTION(OUTPUT)"
    "LMMDEL DATAID("DATA1") MEMBER('"PA"')" 
      "LMMDEL DATAID("                       
      "ISR00017"                             
      "LMMDEL DATAID(ISR00017"               
      ") MEMBER('"                           
      "LMMDEL DATAID(ISR00017) MEMBER('"     
      "LLB"                                 
      "LMMDEL DATAID(ISR00017) MEMBER('LLB" 
      "')"                                   
      "LMMDEL DATAID(ISR00017) MEMBER('LLB')"
 RC(8) +++                                   




By any chance any one of you came across this situation ? Kindly help.


Warm regards

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

Global Moderator


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

PostPosted: Wed Oct 19, 2011 8:08 am
Reply with quote

RC(8) is "The member was not found". Perhaps you should be looking there for the problem.
Back to top
View user's profile Send private message
srikanth_cts

New User


Joined: 27 Feb 2008
Posts: 25
Location: Phoenix, AZ,USA

PostPosted: Wed Oct 19, 2011 10:12 am
Reply with quote

Hi Superk,
Thanks for the reply. I double checked the input dataset for the members starting with 'LLB' as in the code. Many members are present.
My doubt is whether the LMINIT is correctly associating the input dataset with the dataid specified and the LMMDEL is searching for the correct dataset to delete the members.
I will once again check in the direction you showed.


Regards
Srikant
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Wed Oct 19, 2011 10:48 am
Reply with quote

"LMMDEL DATAID("DATA1") MEMBER('"PA"')"
Back to top
View user's profile Send private message
srikanth_cts

New User


Joined: 27 Feb 2008
Posts: 25
Location: Phoenix, AZ,USA

PostPosted: Wed Oct 19, 2011 11:02 am
Reply with quote

PA in the LMMDEL is the pattern I am pulling from the ISPF panel..

Code:

ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
 ********************DELETE PDS MEMBERS MATCHING PATTERN********************
                                                                           
 COMMAND ===> ______________________________________________________________
                                                                           
 ENTER DETAILS BELOW:                                                       
                                                                           
   PATTERN OF JOBNAME       ===> LLB_____                                   
   PDS NAME TO BE SEARCHED  ===> INSRI01.TEST11.PROCLIB______________       
   OUTPUT DATASET           ===> INSRI01.TES11.TEST__________________       
                                                                           
                                                                           

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

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Wed Oct 19, 2011 11:17 am
Reply with quote

Quote:
PA in the LMMDEL is the pattern I am pulling from the ISPF panel..

Your last comment is just useless, it is clear what the PA stands for

looks like
You did care to use the MODEL facility
or read the ISPF manual here
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/ISPZPM70
not the latest one, more than enough for the task

Quote:
My doubt is whether the LMINIT is correctly associating the input dataset with the dataid specified and the LMMDEL is searching for the correct dataset to delete the members.

YES/YES
Back to top
View user's profile Send private message
srikanth_cts

New User


Joined: 27 Feb 2008
Posts: 25
Location: Phoenix, AZ,USA

PostPosted: Wed Oct 19, 2011 12:50 pm
Reply with quote

I found the issue. Problem with the LMMDEL utility is that it can delete the member from a PDS only if the complete name is specified. It cant delete all the PDS members that are starting with the given pattern(as I did in my REXX code). That is the reason why it is giving RC 8 saying member not found.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Wed Oct 19, 2011 1:04 pm
Reply with quote

Quote:
I found the issue. Problem with the LMMDEL utility is that it can delete the member from a PDS only if the complete name is specified. It cant delete all the PDS members that are starting with the given pattern(as I did in my REXX code). That is the reason why it is giving RC 8 saying member not found.
plain horse manure !
refrain from posting wrong conclusions icon_evil.gif
Back to top
View user's profile Send private message
srikanth_cts

New User


Joined: 27 Feb 2008
Posts: 25
Location: Phoenix, AZ,USA

PostPosted: Wed Oct 19, 2011 1:49 pm
Reply with quote

Well , thats the conclusion I came to after testing the program with hard coded values. Try out yourself.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Wed Oct 19, 2011 2:03 pm
Reply with quote

Quote:
thats the conclusion I came to after testing the program with hard coded values


well... Your testing was wrong or at least incomplete
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Wed Oct 19, 2011 2:19 pm
Reply with quote

completely clueless aren' t You !

with my first reply with the LMMDEL statement in large font
I hoped to make You notice that the statement as written is just plain wrong
not as You wrote it
"LMMDEL DATAID("DATA1") MEMBER('"PA"')"
but it should be
"LMMDEL DATAID("DATA1") MEMBER("PA")"

the way You wrote it does not give any <syntax> error, it just issues a return code 8 for member not found

and as far as
Quote:
LMOPEN DATAID giving dataid as "ISR00014"

the dataid is just an ISPF internal <handle> to the dataset being processed

and since Your profile says Mainframe Skills: Pure Mainframe; nothing else!
I should have expected Your discomfort in reading the manual where it clearly states

Quote:
2.36.3 Parameters


data-id
The data ID associated with the data set from which a member is to be deleted. The data ID has been generated by the LMINIT service. The maximum length of this parameter is 8 characters.
member-name
The member name or pattern of the members to be deleted. An asterisk (*) indicates that all members are to be deleted. The maximum length of this parameter is 8 characters.
Where member-name is the name of a primary member, the primary name and all associated alias names are deleted. Where member-name is an alias member, only the alias name and its directory entry are deleted.

Where a member pattern has been specified for the LMMDEL service, these rules apply:

All primary members whose name matches the member pattern are deleted.
All aliases that are associated with a primary member whose name matches the member pattern are deleted, even if the alias name itself does not match the member pattern.
All aliases whose name matches the member pattern are deleted, even if the alias is associated with a primary member whose name does not match the member pattern.
Back to top
View user's profile Send private message
srikanth_cts

New User


Joined: 27 Feb 2008
Posts: 25
Location: Phoenix, AZ,USA

PostPosted: Wed Oct 19, 2011 2:42 pm
Reply with quote

I had modified the code and tested it after your first reply. I got what you intended. But unsure of the reason why the code is not picking the pattern.

I had read through the manual many times over before posting my conclusion. I think you are right that my testing is incomplete. Need to check more.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Wed Oct 19, 2011 4:16 pm
Reply with quote

process used to test ... before replying

created a dataset ( PDS) ENRICO.TEST.DELETE
created a few members AA01, AA02, AA03, ..., BB01, BB02, B03

created the following
Code:

 EDIT       ENRICO.ISPF.EXEC(LMMDEL00) - 01.00              Columns 00001 00072
 Command ===>                                                  Scroll ===> CSR 
 ****** ***************************** Top of Data ******************************
 000001 /*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 000002 /*                                                                   */
 000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 000004 Trace "O"                                                               
 000005 _isp= 1;  _isr = 0 ;                                                   
 000006 Parse Source _sys _how _cmd .                                           
 000007                                                                         
 000008 If ( _isp = 1 ) & ,                                                     
 000009    ( Sysvar(SYSISPF) \= "ACTIVE" ) Then Do                             
 000010    Say left(_cmd,8)"- Ispf is not active. Command not executed"         
 000011    exit 4                                                               
 000012 End                                                                     
 000013                                                                         
 000014 call $ispex "CONTROL ERRORS RETURN"                                     
 000015                                                                         
 000016 if  ( _isr = 1 ) & ,                                                   
 000017     ( $isred("MACRO (ARGS) NOPROCESS ") \= 0 ) then do                 
 000018     zedsmsg = "Invocation ERROR"                                       
 000019     zedlmsg = left(_cmd,8)"- Must be invoked as a MACRO"               
 000020     call $ispex "SETMSG MSG(ISRZ001)"                                   
 000021     exit 4                                                             
 000022 end                                                                     
 000023                                                                         
 000024 fn = "TESTING"                                                         
 000025 ds = "ENRICO.TEST.DELETE"                                               
 000026 mb = "aa*"                                                             
 000027                                                                         
 000028 service = left("LMINIT",8)                                             
 000029 f_rc = $ispex(service "DATAID(ID) DATASET("ds") ENQ(SHRW) ")           
 000030 If f_rc /= 0 Then Do                                                   
 000031    zerrsm = left(fn,5) "-" service "error"                             
 000032    zerrlm = left(_commnd,8)"- Rc("f_rc") from" service                 
 000033    call   $ispex "SETMSG MSG(ISRZ002) "                                 
 000034    exit 4                                                               
 000035 End                                                                     
 000036                                                                         
 000037 service = left("LMOPEN",8)                                             
 000038 f_rc = $ispex(service "DATAID("id") OPTION(OUTPUT) ")                   
 000039 If f_rc /= 0 Then Do                                                   
 000040    zerrsm = left(fn,5) "-" service "error"                             
 000041    zerrlm = left(_commnd,8)"- Rc("f_rc") from" service                 
 000042    call   $ispex "SETMSG MSG(ISRZ002) "                                 
 000043    exit 4                                                               
 000044 End                                                                     
 000045                                                                         
 000046 service = left("LMMDEL",8)                                             
 000047 f_rc = $ispex(service" DATAID("id") MEMBER("mb")   ")                   
 000048 If f_rc /= 0 Then Do                                                   
 000049    zerrsm = left(fn,5) "-" service "error"                             
 000050    zerrlm = left(_commnd,8)"- Rc("f_rc") from" service                 
 000051    call   $ispex "SETMSG MSG(ISRZ002) "                                 
 000052    exit 4                                                               
 000053 End                                                                     
 000054                                                                         
 000055 call   $ispex "LMCLOSE DATAID("id") "                                   
 000056 call   $ispex "LMFREE  DATAID("id") "                                   
 000057 call   $ispex "SETMSG  MSG(ISRZ002) "                                   
 000058                                                                         
 000059 Exit 0                                                                 
 000060                                                                         
 000061 /* */                                                                   
 000062 $tsoex:                                                                 
 000063    tso_0tr = trace("O")                                                 
 000064    Address TSO arg(1)                                                   
 000065    tso_0rc = rc                                                         
 000066    trace value(tso_0tr)                                                 
 000067    return tso_0rc                                                       
 000068                                                                         
 000069 /* */                                                                   
 000070 $ispex:                                                                 
 000071    isp_tr = trace("O")                                                 
 000072    Address ISPEXEC arg(1)                                               
 000073    isp_rc = rc                                                         
 000074    trace value(isp_tr)                                                 
 000075    return isp_rc                                                       
 000076                                                                         
 000077 /* */                                                                   
 000078 $isred:                                                                 
 000079    isr_tr = trace("O")                                                 
 000080    Address ISREDIT arg(1)                                               
 000081    isr_rc = rc                                                         
 000082    trace value(isr_tr)                                                 
 000083    return isr_rc                                                       


before
Code:

 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
   Menu  Functions  Confirm  Utilities  Help                                   
 ——————————————————————————————————————————————————————————————————————————————
 DSLIST            ENRICO.TEST.DELETE                        Row 00001 of 00006
 Command ===>                                                  Scroll ===> CSR 
            Name     Prompt       Size   Created          Changed          ID   
 _________ AA01                      1  2011/10/19  2011/10/19 12:40:11  ENRICO
 _________ AA02                      1  2011/10/19  2011/10/19 12:40:18  ENRICO
 _________ AA03                      1  2011/10/19  2011/10/19 12:40:27  ENRICO
 _________ BB01                      1  2011/10/19  2011/10/19 12:40:40  ENRICO
 _________ BB02                      1  2011/10/19  2011/10/19 12:40:40  ENRICO
 _________ BB03                      1  2011/10/19  2011/10/19 12:40:40  ENRICO
           **End**                                                             


after

Code:
 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
   Menu  Functions  Confirm  Utilities  Help                                   
 ——————————————————————————————————————————————————————————————————————————————
 DSLIST            ENRICO.TEST.DELETE                        Row 00001 of 00003
 Command ===>                                                  Scroll ===> CSR 
            Name     Prompt       Size   Created          Changed          ID   
 _________ BB01                      1  2011/10/19  2011/10/19 12:40:40  ENRICO
 _________ BB02                      1  2011/10/19  2011/10/19 12:40:40  ENRICO
 _________ BB03                      1  2011/10/19  2011/10/19 12:40:40  ENRICO
           **End**                                                             


there is one thing weird ( I' ll investigate as soon as I have a bit of time )
the message about member not found is issued by the LMMDEL service itself
and the return code is still 0
Back to top
View user's profile Send private message
srikanth_cts

New User


Joined: 27 Feb 2008
Posts: 25
Location: Phoenix, AZ,USA

PostPosted: Wed Oct 19, 2011 5:44 pm
Reply with quote

Enrico, thanks a ton for taking time to write the program and test it. I will check from my side what I am missing in my code.

Regards
Srikant
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Wed Oct 19, 2011 5:56 pm
Reply with quote

lmmdel, and probably other services dealing with <members>/<patterns>

<member> not found behavior

if the <pattern> is not found ISPF sets the message and RC = 0
if the <member> is not found ISPF does not set the message and RC = 8

to investigate further and check the ISPF apar status
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Wed Oct 19, 2011 6:07 pm
Reply with quote

here is the same REXX with the proper error cleanup
Code:
 EDIT       ENRICO.ISPF.EXEC(LMMDEL00) - 01.09              Columns 00001 00072
 Command ===>                                                  Scroll ===> CSR 
 ****** ***************************** Top of Data ******************************
 000001 /*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 000002 /*                                                                   */
 000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 000004 Trace "O"                                                               
 000005 _isp= 1;  _isr = 0 ;                                                   
 000006 Parse Source _sys _how _cmd .                                           
 000007                                                                         
 000008 If ( _isp = 1 ) & ,                                                     
 000009    ( Sysvar(SYSISPF) ¬= "ACTIVE" ) Then Do                             
 000010    Say left(_cmd,8)"- Ispf is not active. Command not executed"         
 000011    exit 4                                                               
 000012 End                                                                     
 000013                                                                         
 000014 call $ispex "CONTROL ERRORS RETURN"                                     
 000015                                                                         
 000016 if  ( _isr = 1 ) & ,                                                   
 000017     ( $isred("MACRO (ARGS) NOPROCESS ") \= 0 ) then do                 
 000018     zedsmsg = "Invocation ERROR"                                       
 000019     zedlmsg = left(_cmd,8)"- Must be invoked as a MACRO"               
 000020     signal setmsg                                                       
 000021 end                                                                     
 000022                                                                         
 000023 fn = "TEST"                                                             
 000024 ds = "ENRICO.TEST.DELETE"                                               
 000025 mb = "aa*"                                                             
 000026                                                                         
 000027 service = left("LMINIT",8)                                             
 000028 f_rc = $ispex(service "DATAID(ID) DATASET("ds") ENQ(SHRW) ")           
 000029 If f_rc ¬= 0 Then Do                                                   
 000030    zerrsm = service "Rc("f_rc")"                                       
 000031    zerrlm = left(_commnd,8)"- Rc("f_rc") from" service                 
 000032    signal setmsg                                                       
 000033 End                                                                     
 000034                                                                         
 000035 service = left("LMOPEN",8)                                             
 000036 f_rc = $ispex(service "DATAID("id") OPTION(OUTPUT) ")                   
 000037 If f_rc ¬= 0 Then Do                                                   
 000038    zerrsm = service "Rc("f_rc")"                                       
 000039    zerrlm = left(_commnd,8)"- Rc("f_rc") from" service                 
 000040    signal free                                                         
 000041 End                                                                     
 000042                                                                         
 000043 service = left("LMMDEL",8)                                             
 000044 f_rc = $ispex(service" DATAID("id") MEMBER("mb")   ")                   
 000045 If f_rc ¬= 0 Then Do                                                   
 000046    zerrsm = service "Rc("f_rc")"                                       
 000047    zerrlm = left(_commnd,8)"- Rc("f_rc") from" service                 
 000048    signal close                                                         
 000049 End                                                                     
 000050                                                                         
 000051 close :                                                                 
 000052     call   $ispex "LMCLOSE DATAID("id") "                               
 000053 free  :                                                                 
 000054     call   $ispex "LMFREE  DATAID("id") "                               
 000055 setmsg:                                                                 
 000056     call   $ispex "SETMSG  MSG(ISRZ002) "                               
 000057                                                                         
 000058 Exit 0                                                                 
 000059                                                                         
 000060 /* */                                                                   
 000061 $tsoex:                                                                 
 000062    tso_0tr = trace("O")                                                 
 000063    Address TSO arg(1)                                                   
 000064    tso_0rc = rc                                                         
 000065    trace value(tso_0tr)                                                 
 000066    return tso_0rc                                                       
 000067                                                                         
 000068 /* */                                                                   
 000069 $ispex:                                                                 
 000070    isp_tr = trace("O")                                                 
 000071    Address ISPEXEC arg(1)                                               
 000072    isp_rc = rc                                                         
 000073    trace value(isp_tr)                                                 
 000074    return isp_rc                                                       
 000075                                                                         
 000076 /* */                                                                   
 000077 $isred:                                                                 
 000078    isr_tr = trace("O")                                                 
 000079    Address ISREDIT arg(1)                                               
 000080    isr_rc = rc                                                         
 000081    trace value(isr_tr)                                                 
 000082    return isr_rc                                                       
 000083                                                                         
 ****** **************************** Bottom of Data ****************************

Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2593
Location: Silicon Valley

PostPosted: Wed Oct 19, 2011 7:35 pm
Reply with quote

I think this is wrong:
Code:
"LMINIT DATASET('"INDS"') DATAID("DATA1") ENQ(EXCLU)"


The dataid in LMINIT should be the name of the variable. Other services will use the value of the variable. It works in this instance, but would not work correctly if it was in a loop.

It works because the value of an uninitialized variable is itself (but uppercase).
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Thu Oct 20, 2011 1:48 am
Reply with quote

I was too quick to cut and paste and I left a glitch around...
in all the samples posted c "_commnd" "_cmd" all
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 -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts Does anyone know rexx for VSE CLIST & REXX 3
No new posts TSO ALLOC In REXX Needs Improvement JCL & VSAM 3
No new posts REXX/CMS How to place command console... CLIST & REXX 4
No new posts Help needed in automation cics transa... CLIST & REXX 1
No new posts Reroute print output via REXX/SDSF TSO/ISPF 6
Search our Forums:

Back to Top