View previous topic :: View next topic
|
Author |
Message |
chavinash2004
New User
Joined: 30 Jun 2010 Posts: 37 Location: hyderabad
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
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 |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2145 Location: USA
|
|
|
|
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 |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1337 Location: Bamberg, Germany
|
|
|
|
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 |
|
|
chavinash2004
New User
Joined: 30 Jun 2010 Posts: 37 Location: hyderabad
|
|
|
|
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 |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2145 Location: USA
|
|
|
|
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 |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1337 Location: Bamberg, Germany
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2594 Location: Silicon Valley
|
|
|
|
Joerg, what a brilliant solution! |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2594 Location: Silicon Valley
|
|
|
|
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 |
|
|
chavinash2004
New User
Joined: 30 Jun 2010 Posts: 37 Location: hyderabad
|
|
|
|
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 |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1337 Location: Bamberg, Germany
|
|
|
|
This works for me.
Code: |
/* REXX */
address "ISREDIT"
"macro"
"c r'(SHR|SHAREOPTIONS)"!!,
"[ ]*\([ ]*[1-4]([ ]+|[ ]*,[ ]*)[34][ ]*\)' 'SHR (2 3)' all"
exit |
|
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1337 Location: Bamberg, Germany
|
|
|
|
@Pedro: Abbreviations for the IDCAMS keyword can be included in the Edit Change command. Should not be a bigger problem. |
|
Back to top |
|
|
chavinash2004
New User
Joined: 30 Jun 2010 Posts: 37 Location: hyderabad
|
|
|
|
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 |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1337 Location: Bamberg, Germany
|
|
|
|
Show us your version of the MACRO and please use Code Tags. |
|
Back to top |
|
|
chavinash2004
New User
Joined: 30 Jun 2010 Posts: 37 Location: hyderabad
|
|
|
|
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 |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1337 Location: Bamberg, Germany
|
|
|
|
Might be because of different Codepages. Please replace !! with || in your Change command to concat both strings without an additional space. |
|
Back to top |
|
|
chavinash2004
New User
Joined: 30 Jun 2010 Posts: 37 Location: hyderabad
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
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 |
|
|
chavinash2004
New User
Joined: 30 Jun 2010 Posts: 37 Location: hyderabad
|
|
|
|
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 |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 |
|
|
chavinash2004
New User
Joined: 30 Jun 2010 Posts: 37 Location: hyderabad
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2594 Location: Silicon Valley
|
|
|
|
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 |
|
|
chavinash2004
New User
Joined: 30 Jun 2010 Posts: 37 Location: hyderabad
|
|
|
|
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 |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1337 Location: Bamberg, Germany
|
|
Back to top |
|
|
chavinash2004
New User
Joined: 30 Jun 2010 Posts: 37 Location: hyderabad
|
|
|
|
Okay Joerg. Thanks a lot for your help. |
|
Back to top |
|
|
|