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

Modify the shareoptions of VSAM in Define Parameters


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

New User


Joined: 30 Jun 2010
Posts: 37
Location: hyderabad

PostPosted: Wed Feb 26, 2020 6:28 pm
Reply with quote

Hi All,

I have the requirement to modify the share options to (2,3) for hundreds of Parm cards.

I'm able not to handle this situation since people can code it multiple of ways similar to below.

Below are few possible ways of coding the share options which i identified so far.

Input can be any of the below format.
Ex 1: SHR (3 3) -
Ex 2: STAGE SHR (1 3) NERAS -
Ex 3: SHAREOPTIONS(2 3) -
Ex 4: SHR(3,3) -
EX 5: SHR (1,3) -

Output should be like this (If share options are not 2 3 then need to change to 2 3):
Ex 1: SHR (2 3) -
Ex 2: STAGE SHR (2 3) NERAS -
Ex 3: SHAREOPTIONS(2 3) -
Ex 4: SHR(2,3) -
EX 5: SHR (2,3) -

There are many ways people can code the share options but my requirement is to identify share options and modify/rewrite the share options to SHR (2,3).

Please someone can help me to fix this.

**I did google for any example before posting but no luck. My apologize if it is duplicate**.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Wed Feb 26, 2020 7:00 pm
Reply with quote

What have you tried? What problems do you face? Surely it is simple enough - you only have to check each record for either SHR or SHAREOPTIONS and then overlay the current option with the new option. And don't forget to write an audit report.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2140
Location: USA

PostPosted: Wed Feb 26, 2020 8:35 pm
Reply with quote

chavinash2004 wrote:
Please someone can help me to fix this.


Hint: try to use REXX statement PARSE

You may also need to use other accompanying statements, like: If, Else, Do, End, Call, something else.

P.S.
A ready-to-use code for your own job can be provided at extra charge.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1333
Location: Bamberg, Germany

PostPosted: Wed Feb 26, 2020 9:08 pm
Reply with quote

You can use IEBPTPCH to UNLOAD the Library. In the PS Dataset use a simple Edit with RegEx to change the SHAREOPTIONS parameter to 'SHR (2 3)' or whatever is needed. Final Step is to rebuild the Library using IEBUPDTE.

To find the possible variants of SHR/SHROPTIONS parameter try the following RegEx:
Code:
f r'(SHR|SHAREOPTIONS)[ ]*\([ ]*[1-4]([ ]+|[ ]*,[ ]*)[34][ ]*\)'
Back to top
View user's profile Send private message
chavinash2004

New User


Joined: 30 Jun 2010
Posts: 37
Location: hyderabad

PostPosted: Wed Feb 26, 2020 9:17 pm
Reply with quote

Thank for your reply Nic.

The process which we tried:
1. Find the SHR or SHAREOPTIONS and delete the line.
2. add the new line with SHR (2,3).

Logic to delete:

STRINGA='SHR'
STRINGB='SHAREOPTIONS'

PARSE VAR LINE VAR3 '(' VAR4

IF VAR3 = STRINGA | VAR3 = STRINGB then do
ISREDIT "DELETE &J"
LASTLN = LASTLN - 1
END
END


Logic to add the line after NONINDEXED/INDEXED/NUMBERED:

"ISREDIT LINE_AFTER " LN "= DATALINE" ATTR1
LN = LN + 1
LASTLN = LASTLN + 1

The above logic will not work in below scenario since we need capture the left and right attributes and not able to proceed further.

STAGE SHR (2 3) NERAS -

Please help me to fix this
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2140
Location: USA

PostPosted: Wed Feb 26, 2020 9:45 pm
Reply with quote

chavinash2004 wrote:
The process which we tried:
1. Find the SHR or SHAREOPTIONS and delete the line.
2. add the new line with SHR (2,3).


If the library members have not been strictly normalized, some lines with SHR/SHAREOPTIONS may also contain other parameters; they all will be silently lost after applying this approach.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1333
Location: Bamberg, Germany

PostPosted: Wed Feb 26, 2020 11:05 pm
Reply with quote

Input:
Code:
****** ****************************
000001 SHR (3 3) -                 
000002 STAGE SHR (1 3) NERAS -     
000003 SHAREOPTIONS(2 3) -         
000004 SHR(3,3) -                 
000005 SHR (1,3) -                 
000006   SHR    ( 3   4 )         
000007   SHR  (3 , 4 )             
000008  SHAREOPTIONS (    1 , 4)   
****** ****************************

Code:
c r'(SHR|SHAREOPTIONS)[ ]*\([ ]*[1-4]([ ]+|[ ]*,[ ]*)[34][ ]*\)' 'SHR (2 3)' all

Output:
Code:
****** ***************************
==CHG> SHR (2 3) -               
==CHG> STAGE SHR (2 3) NERAS -   
==CHG> SHR (2 3) -               
==CHG> SHR (2 3) -               
==CHG> SHR (2 3) -               
==CHG>   SHR (2 3)               
==CHG>   SHR (2 3)               
==CHG>  SHR (2 3)                 
****** ***************************
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Thu Feb 27, 2020 11:38 am
Reply with quote

Joerg, what a brilliant solution!
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Thu Feb 27, 2020 11:49 am
Reply with quote

I seem to recall that DEFINE CLUSTER parameters can be abbreviated. Perhaps there may be more abbreviations that you have not yet seen. Look for SHA as a word prefix.

Please correct me if I am wrong about the abbreviations.
Back to top
View user's profile Send private message
chavinash2004

New User


Joined: 30 Jun 2010
Posts: 37
Location: hyderabad

PostPosted: Thu Feb 27, 2020 2:16 pm
Reply with quote

Joerg,

I tried to invoke your command thru rexx but it's not working.

Code:
ADDRESS TSO                                                         
ADDRESS ISREDIT                                                     
                                                                   
ISREDIT "c r'(SHR|SHAREOPTIONS)                                     
         [ ]*\([ ]*[1-4]([ ]+|[ ]*,[ ]*)[34][ ]*\)' 'SHR (2 3)' all"


I'm not even getting any error.

Coded for you
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1333
Location: Bamberg, Germany

PostPosted: Thu Feb 27, 2020 2:29 pm
Reply with quote

This works for me.
Code:
/* REXX */                                                     
address "ISREDIT"                                             
"macro"                                                       
                                                               
"c r'(SHR|SHAREOPTIONS)"!!,                                   
"[ ]*\([ ]*[1-4]([ ]+|[ ]*,[ ]*)[34][ ]*\)' 'SHR (2 3)' all"   
                                                               
exit
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1333
Location: Bamberg, Germany

PostPosted: Thu Feb 27, 2020 2:43 pm
Reply with quote

@Pedro: Abbreviations for the IDCAMS keyword can be included in the Edit Change command. Should not be a bigger problem. icon_cool.gif
Back to top
View user's profile Send private message
chavinash2004

New User


Joined: 30 Jun 2010
Posts: 37
Location: hyderabad

PostPosted: Thu Feb 27, 2020 3:13 pm
Reply with quote

Thank you Joerg.

I tried with input
Code:
000001 SHR (3 3) -                       
000002        STAGE SHR (1 3) NERAS -     
000003        SHAREOPTIONS(2 3) -         
000004        SHR(3,3) -                 
000005        SHR(2,3) -                 
000006        SHR(4,3) -                 
000007        SHR(4,4) -                 
000008        SHR(3,3) -                 
000009        SHR (1,3) -                 
000010          SHR    ( 3   4 )         
000011          SHR  (3 , 4 )             
000012         SHAREOPTIONS (    1 , 4)   
000013         SHAREOPTIONS (    2 , 1)   
000014         SHAREOPTIONS (    1 , 2)   
000015         SHAREOPTIONS (    1 , 3)   
000016         SHAREOPTIONS ( 4 , 4)     
000017         SHAREOPTIONS ( 2 , 4)     
000018         SHAREOPTIONS ( 4, 3)       

Output:
Code:
000001 SHR (2 3) -                       
000002        STAGE SHR (2 3) NERAS -   
000003        SHAREOPTIONS(2 3) -       
000004        SHR(3,3) -                 
000005        SHR(2,3) -                 
000006        SHR(4,3) -                 
000007        SHR(4,4) -                 
000008        SHR(3,3) -                 
000009        SHR (2 3) -               
000010          SHR (2 3)               
000011          SHR (2 3)               
000012         SHR (2 3)                 
000013         SHAREOPTIONS (    2 , 1) 
000014         SHAREOPTIONS (    1 , 2) 
000015         SHR (2 3)                 
000016         SHR (2 3)                 
000017         SHR (2 3)                 
000018         SHR (2 3)                 


Only few got changed. Looks like the code is not working if there is no space between SHR and '('.

Below is the example:
Code:
000004        SHR(3,3) -                 
000005        SHR(2,3) -                 
000006        SHR(4,3) -

Coded for you
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1333
Location: Bamberg, Germany

PostPosted: Thu Feb 27, 2020 3:20 pm
Reply with quote

Show us your version of the MACRO and please use Code Tags.
Back to top
View user's profile Send private message
chavinash2004

New User


Joined: 30 Jun 2010
Posts: 37
Location: hyderabad

PostPosted: Thu Feb 27, 2020 3:33 pm
Reply with quote

below is the code:

Code:
ADDRESS ISREDIT                                             
"MACRO"                                                     
"c r'(SHR|SHAREOPTIONS)"!!,                                   
"[ ]*\([ ]*[1-4]([ ]+|[ ]*,[ ]*)[34][ ]*\)' 'SHR (2 3)' all"
   ADDRESS ISPEXEC "ISREDIT SAVE"                           
   ADDRESS ISPEXEC "ISREDIT END"                           
exit               

Input:
000001 SHR (3 3) -                       
000002        STAGE SHR (1 3) NERAS -   
000003        SHAREOPTIONS(2 3) -       
000004        SHR(3,3) -                 
000005        SHR(2,3) -                 
000006        SHR(4,3) -                 
000007        SHR(4,4) -                 
000008        SHR(3,3) -                 
000009        SHR (1,3) -               
000010          SHR    ( 3   4 )         
000011          SHR  (3 , 4 )           
000012         SHAREOPTIONS (    1 , 4) 
000013         SHAREOPTIONS (    2 , 1) 
000014         SHAREOPTIONS (    1 , 2) 
000015         SHAREOPTIONS (    1 , 3) 
000016         SHAREOPTIONS ( 4 , 4)     
000017         SHAREOPTIONS ( 2 , 4)     
000018         SHAREOPTIONS ( 4, 3)     


Output:
Code:
000001 SHR (2 3) -                       
000002        STAGE SHR (2 3) NERAS -   
000003        SHAREOPTIONS(2 3) -       
000004        SHR(3,3) -                 
000005        SHR(2,3) -                 
000006        SHR(4,3) -                 
000007        SHR(4,4) -                 
000008        SHR(3,3) -                 
000009        SHR (2 3) -               
000010          SHR (2 3)               
000011          SHR (2 3)               
000012         SHR (2 3)                 
000013         SHAREOPTIONS (    2 , 1) 
000014         SHAREOPTIONS (    1 , 2) 
000015         SHR (2 3)                 
000016         SHR (2 3)                 
000017         SHR (2 3)                 
000018         SHR (2 3)                 

Hope this helps
Coded for you
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1333
Location: Bamberg, Germany

PostPosted: Thu Feb 27, 2020 3:46 pm
Reply with quote

Might be because of different Codepages. Please replace !! with || in your Change command to concat both strings without an additional space.
Back to top
View user's profile Send private message
chavinash2004

New User


Joined: 30 Jun 2010
Posts: 37
Location: hyderabad

PostPosted: Thu Feb 27, 2020 3:57 pm
Reply with quote

Hi Nic & Joerg,

I also tried different approach.

Code:
STRINGA='SHR'           
STRINGB='SHAREOPTIONS' 

PARSE VAR LINE VAR3 '(' VAR4 ')' VAR5
IF VAR3 = STRINGA | VAR3 = STRINGB then d
   NEWLN = ' '                           
   NEWLN = VAR3||'(2,3)'||VAR5           
   NEWLN = STRIP(NEWLN)                 
END                                         
                                           
IF VAR3 ¬= STRINGA | VAR3 ¬= STRINGB then do
                                           
   LN4 = SUBWORD(VAR3,1,1)                 
   LN5 = SUBWORD(VAR3,2,1)                 
   LN6 = SUBWORD(VAR3,3,1)                 
END                                     
                                       
IF LN5 = STRINGA | LN5 = STRINGB then do
   NEWLN = ' '                         
   NEWLN = VAR3||'(2,3)'||VAR5         
   NEWLN = STRIP(NEWLN)                 
END                                     


I'm trying to replace the the values present between ( ) to (2,3) and storing in a NEWLN variable.

I'm using below logic to write the line but getting error " Invalid variable name " .

Code:
ATTR3 = NEWLN
"ISREDIT LINE_AFTER " LN "= DATALINE" ATTR3
LN = LN + 1                                 
LASTLN = LASTLN + 1                         
"ISREDIT SHIFT )    " LN P1-1               

******************************************************************************
*                                                                            *
* Command in error . : ISREDIT LINE_AFTER  9 = DATALINE SHR       (2,3)      *
*                                                                            *
* Invalid variable name                                                      *
* Name may be 1-8 alphanumeric characters long; first character not numeric. *
*                                                                            *
*   Error message ID . : ISRE121                                             *
*                                                                            *
*   Last return code . : 20                                                  *
*                                                                            *
*   Macro executing  . : MACROH                                              *
*                                                                            *
* Press ENTER key to terminate the macro.                                    *
*                                                                            *
*                                                                            *
*                                                                            *

Coded for you - do it yourself from now on
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Thu Feb 27, 2020 4:02 pm
Reply with quote

You were asked to use the code tags - you did not. Ignoring requests to present your data properly leads to your problem being ignored. Use them from now on or have the topic locked.
Back to top
View user's profile Send private message
chavinash2004

New User


Joined: 30 Jun 2010
Posts: 37
Location: hyderabad

PostPosted: Thu Feb 27, 2020 4:14 pm
Reply with quote

Joerg.Findeisen wrote:
Might be because of different Codepages. Please replace !! with || in your Change command to concat both strings without an additional space.


Thank you Joerg. It worked. Please help what is the issue with other code.

Hi Nic,

I will make sure to use the code tags from now.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Thu Feb 27, 2020 4:45 pm
Reply with quote

chavinash2004 wrote:
I also tried different approach.

Code:
STRINGA='SHR'           
STRINGB='SHAREOPTIONS' 

PARSE VAR LINE VAR3 '(' VAR4 ')' VAR5
IF VAR3 = STRINGA | VAR3 = STRINGB then do

Can you guess what will happen if LINE contains:
Code:
    FILE(XYZDD) SHR(3 3)   -



chavinash2004 wrote:
I'm using below logic to write the line but getting error " Invalid variable name " .

Code:
ATTR3 = NEWLN
"ISREDIT LINE_AFTER " LN "= DATALINE" ATTR3
LN = LN + 1                                 
LASTLN = LASTLN + 1

FYI, the correct syntax is:
Code:
"ISREDIT LINE_AFTER " LN "= DATALINE '" ATTR3"'"
Back to top
View user's profile Send private message
chavinash2004

New User


Joined: 30 Jun 2010
Posts: 37
Location: hyderabad

PostPosted: Thu Feb 27, 2020 5:55 pm
Reply with quote

Thank You Marso, Joerg & Nic.

Hi Marso,

Actually Nic suggested the below approach but i'm not able to do it.

*****you only have to check each record for either SHR or SHAREOPTIONS and then overlay the current option with the new option. And don't forget to write an audit report.*****

Thanks a lot once again.
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Thu Feb 27, 2020 9:53 pm
Reply with quote

Quote:
And don't forget to write an audit report.


I suggest to keep a backup copy of the data set then use Superc to compare the new and the old. The list of changes is your 'audit report'.
Back to top
View user's profile Send private message
chavinash2004

New User


Joined: 30 Jun 2010
Posts: 37
Location: hyderabad

PostPosted: Fri Feb 28, 2020 8:48 am
Reply with quote

Sure, Pedro and also thanks for the suggestion.


Please let me know if you can help with any REXX code to compare the PDS members and write a report. We are changing around 1000 parms.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1333
Location: Bamberg, Germany

PostPosted: Fri Feb 28, 2020 10:47 am
Reply with quote

@chavinash2004: ibmmainframes.com/about38892.html but better run ISPF SUPERC/E in Batch to have a real report.
Back to top
View user's profile Send private message
chavinash2004

New User


Joined: 30 Jun 2010
Posts: 37
Location: hyderabad

PostPosted: Fri Feb 28, 2020 10:54 am
Reply with quote

Okay Joerg. Thanks a lot for your help.
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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Starting a PROC with parameters from ... CLIST & REXX 6
No new posts VSAM LISTCAT INFORMATION JCL & VSAM 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts DTL - how to define key with stacked ... TSO/ISPF 3
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top