Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Modify the shareoptions of VSAM in Define Parameters
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
chavinash2004

New User


Joined: 30 Jun 2010
Posts: 24
Location: hyderabad

PostPosted: Wed Feb 26, 2020 6:28 pm    Post subject: Modify the shareoptions of VSAM in Define Parameters
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: 2312
Location: Hampshire, UK

PostPosted: Wed Feb 26, 2020 7:00 pm    Post subject: Reply to: Modify the shareoptions of VSAM in Define Parameters
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

Active Member


Joined: 29 Apr 2008
Posts: 712
Location: Maryland

PostPosted: Wed Feb 26, 2020 8:35 pm    Post subject: Re: Modify the shareoptions of VSAM in Define Parameters
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

Active User


Joined: 15 Aug 2015
Posts: 147
Location: Germany

PostPosted: Wed Feb 26, 2020 9:08 pm    Post subject:
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: 24
Location: hyderabad

PostPosted: Wed Feb 26, 2020 9:17 pm    Post subject: Reply to: Modify the shareoptions of VSAM in Define Parameters
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

Active Member


Joined: 29 Apr 2008
Posts: 712
Location: Maryland

PostPosted: Wed Feb 26, 2020 9:45 pm    Post subject: Re: Reply to: Modify the shareoptions of VSAM in Define Parameters
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

Active User


Joined: 15 Aug 2015
Posts: 147
Location: Germany

PostPosted: Wed Feb 26, 2020 11:05 pm    Post subject:
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

Senior Member


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

PostPosted: Thu Feb 27, 2020 11:38 am    Post subject: Reply to: Modify the shareoptions of VSAM in Define Parameters
Reply with quote

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

Senior Member


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

PostPosted: Thu Feb 27, 2020 11:49 am    Post subject: Reply to: Modify the shareoptions of VSAM in Define Parameters
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: 24
Location: hyderabad

PostPosted: Thu Feb 27, 2020 2:16 pm    Post subject: Reply to: Modify the shareoptions of VSAM in Define Parameters
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

Active User


Joined: 15 Aug 2015
Posts: 147
Location: Germany

PostPosted: Thu Feb 27, 2020 2:29 pm    Post subject:
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

Active User


Joined: 15 Aug 2015
Posts: 147
Location: Germany

PostPosted: Thu Feb 27, 2020 2:43 pm    Post subject:
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: 24
Location: hyderabad

PostPosted: Thu Feb 27, 2020 3:13 pm    Post subject: Reply to: Modify the shareoptions of VSAM in Define Parameters
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

Active User


Joined: 15 Aug 2015
Posts: 147
Location: Germany

PostPosted: Thu Feb 27, 2020 3:20 pm    Post subject:
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: 24
Location: hyderabad

PostPosted: Thu Feb 27, 2020 3:33 pm    Post subject: Reply to: Modify the shareoptions of VSAM in Define Parameters
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

Active User


Joined: 15 Aug 2015
Posts: 147
Location: Germany

PostPosted: Thu Feb 27, 2020 3:46 pm    Post subject:
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: 24
Location: hyderabad

PostPosted: Thu Feb 27, 2020 3:57 pm    Post subject:
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: 2312
Location: Hampshire, UK

PostPosted: Thu Feb 27, 2020 4:02 pm    Post subject: Reply to: Modify the shareoptions of VSAM in Define Parameters
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: 24
Location: hyderabad

PostPosted: Thu Feb 27, 2020 4:14 pm    Post subject:
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: 1344
Location: Israel

PostPosted: Thu Feb 27, 2020 4:45 pm    Post subject:
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Rexx to create VSAM define statements Dinesh Mani CLIST & REXX 10 Fri Nov 29, 2019 9:26 pm
No new posts REXX VSAM Harold Barnes CLIST & REXX 3 Sat Oct 05, 2019 2:38 pm
No new posts CICS VSAM file max volumes socker_dad JCL & VSAM 4 Tue Aug 20, 2019 1:28 am
No new posts Unable to delete dataset - VSAM datas... netcrawler JCL & VSAM 20 Fri Jul 26, 2019 2:06 pm
No new posts VSAM Spacce allocated and used -->... upendrasri CLIST & REXX 18 Sat Mar 09, 2019 3:54 pm

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