| IBM MAINFRAME HELP & SUPPORT FORUMS Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
|
| View previous topic :: View next topic |
| Author |
Message |
chidams78
Joined: 29 May 2006
Posts: 59
Location: India
|
| Posted: Mon Aug 25, 2008 11:02 pm Post subject: ISPF edit macro - Spacing out a variable issue |
|
|
My reqt is to space out the MGMTCLAS=R2 in the PROC using ISPF edit macro
The MGMTCLAS=R2 comes in the PROC in the below 3 cases.
First case
//SORTOUT DD DSN=UNV.TST.FILE,DISP=(,CATLG,DELETE),
// UNIT=DISK,MGMTCLAS=R2,
// DCB=(RECFM=FB,LRECL=10,BLKSIZE=0),
// SPACE=(TRK,(10,10),RLSE)
Second case
//SORTOUT DD DSN=UNV.TST.FILE,DISP=(,CATLG,DELETE),
// UNIT=DISK,
// MGMTCLAS=R2,
// DCB=(RECFM=FB,LRECL=10,BLKSIZE=0),
// SPACE=(TRK,(10,10),RLSE)
Third case
//TSTXXXX PROC CONDA='0,NE',MGMTCLAS='MGMTCLAS=R2',
The below code spaces out MGMTCLAS=R2 for the first and third case.
Code: "ISREDIT C ',MGMTCLAS=R2' '' ALL"
"ISREDIT C 'MGMTCLAS=R2,' '' ALL"
But I am not sure how to deal the second case as it comes like this
//SORTOUT DD DSN=UNV.TST.FILE,DISP=(,CATLG,DELETE),
// UNIT=DISK,
//
// DCB=(RECFM=FB,LRECL=10,BLKSIZE=0),
// SPACE=(TRK,(10,10),RLSE)
I am thinking of the option to read the MGMTCLAS=R2 line (if exists) and then check whether the byte just before 'M' is having spaces or comma. If comma means the above code will work out. If spaces means, we need to check whether the byte after 'R2' is having spaces or comma. If spaces means then put comment for the same line.
I think there might be some other better way to handle this.
Please help
Thanks
Chidam |
|
| Back to top |
|
dick scherrer
Joined: 23 Nov 2006
Posts: 8733
Location: 221 B Baker St
|
| Posted: Mon Aug 25, 2008 11:46 pm Post subject: |
|
|
Hello,
As long as it will not be the last parameter on the DD, you could change "// MGMTCLAS=R2, " to "//* XXXTCLAS=R2, " and then issue the other change commands. |
|
| Back to top |
|
chidams78
Joined: 29 May 2006
Posts: 59
Location: India
|
| Posted: Mon Aug 25, 2008 11:55 pm Post subject: |
|
|
It can be the last parameter or with some other parameter in the same line. So we won't be able to comment out the line.
Any idea how to solve this issue
Thanks
Chidam |
|
| Back to top |
|
enrico-sorichetti
Joined: 14 Mar 2007
Posts: 3168
Location: italy
|
| Posted: Tue Aug 26, 2008 12:07 am Post subject: Reply to: ISPF edit macro - Spacing out a variable issue |
|
|
I guess You might need to build a jcl parser, to isolate keywords and relative parameters,
take a look at ...
http://ibmmainframes.com/viewtopic.php?t=32494&highlight=parser
and use the drop_tabl variable to list the jcl keywords You want to drop from Your jcl
the sample posted works on a pc win/linux/mac osx with regina rexx
should be straightforward to change the I/O linein/lineout logic with the
"ISREDIT (DATA) = LINE ..."
"ISREDITE LINE AFTER ... = DATA" logic |
|
| Back to top |
|
dick scherrer
Joined: 23 Nov 2006
Posts: 8733
Location: 221 B Baker St
|
| Posted: Tue Aug 26, 2008 12:22 am Post subject: |
|
|
Hello,
My suggestion was for when it is the only parameter on the line. Then it should be ok to make the line a comment. This also requires that this not be the very last parameter on the DD statement.
Your examples show that the SPACE parameter is the last DD parameter.
If that rule will not always be true, then you are looking at some kind of parser as Enrico suggests. |
|
| Back to top |
|
chidams78
Joined: 29 May 2006
Posts: 59
Location: India
|
| Posted: Tue Aug 26, 2008 1:23 am Post subject: |
|
|
I think we understood it wrongly...
I mean by "Spacing out" as not the parameter SPACE used in DD statement. I mean that after conversion, i don't want to have the parameter MGMTCLAS=R2 in the DD statement.
The code that I have mentioned will take care of case 1 and 3 but case 2 will have problem as I had mentioned.
Please let me know whether this my reqt is clear.
I am looking to solve this issue in REXX macro |
|
| Back to top |
|
Pedro
Joined: 01 Sep 2006
Posts: 536
Location: work
|
| Posted: Tue Aug 26, 2008 1:58 am Post subject: Reply to: ISPF edit macro - Spacing out a variable issue |
|
|
A clearer term is 'blank out' or 'null out'.
I think you should code it in phases. I mean, handle all of the second case before working on the first or third case.
1. Find where it is last in list (blank before and after):
Code: Address ISREDIT
"F ' MGMTCLAS=R2' "
Then back up and remove comma from previous line.
Delete the line you found.
2. Find where it is middle of list (blank before and comma and blank after):
Code: Address ISREDIT
"F ' MGMTCLAS=R2', "
Delete the line you found.
I think you need to worry about &MGMTCLAS within the proc. |
|
| Back to top |
|
chidams78
Joined: 29 May 2006
Posts: 59
Location: India
|
| Posted: Tue Aug 26, 2008 2:22 am Post subject: |
|
|
Pedro,
Thanks for the logic.
If we are issuing a FIND command for MGMTCLAS=R2 with spaces before and after the variable, the Return Code will just tell whether this is present in the PROC or not.
But how can we find whether MGMTCLAS=R2 comes in the last of the list |
|
| Back to top |
|
dick scherrer
Joined: 23 Nov 2006
Posts: 8733
Location: 221 B Baker St
|
| Posted: Tue Aug 26, 2008 2:46 am Post subject: |
|
|
Hello,
Quote: The code that I have mentioned will take care of case 1 and 3 but case 2 will have problem as I had mentioned. Is your case2 described exactly? If your posted case is exactly what will be in the jcl, then i believe you can use the change i mentioned - from "// MGMTCLAS=R2, " to "//* XXXTCLAS=R2, ".
After the change, your jcl would look like:
Code: //SORTOUT DD DSN=UNV.TST.FILE,DISP=(,CATLG,DELETE),
// UNIT=DISK,
//* XXXTCLAS=R2,
// DCB=(RECFM=FB,LRECL=10,BLKSIZE=0),
// SPACE=(TRK,(10,10),RLSE)
You would issue this "longer" change before any others. The XXX prevents a hit on some other change.
If you believe this will not work, please clarify. |
|
| Back to top |
|
chidams78
Joined: 29 May 2006
Posts: 59
Location: India
|
| Posted: Tue Aug 26, 2008 3:02 am Post subject: |
|
|
D sch,
Thanks for the reply. I think the code that you had mentioned as
Code: ISREDIT C ' MGMTCLAS=R2, ' '//* XXXTCLAS=R2, '
will take care of case 2 only.
And the below code takes care of case 1 and 3
Code: "ISREDIT C ',MGMTCLAS=R2' '' ALL"
"ISREDIT C 'MGMTCLAS=R2,' '' ALL"
Am i right....
Sorry, I didnt understand this statement
"The XXX prevents a hit on some other change. "
Note: You mean itz a normal comment statement, right |
|
| Back to top |
|
chidams78
Joined: 29 May 2006
Posts: 59
Location: India
|
| Posted: Tue Aug 26, 2008 3:07 am Post subject: |
|
|
Now I got it..Thanks...
We need to issue the code in this order
Code: ISREDIT C ' MGMTCLAS=R2, ' '//* XXXTCLAS=R2, ' ALL
ISREDIT C ',MGMTCLAS=R2' '' ALL
ISREDIT C 'MGMTCLAS=R2,' '' ALL
The first one will take care of case 2 and the remaining others will take care of case 1 and 3. Since the forst command changes MGMT to XXXT, the second and third line of code wont impact that, right |
|
| Back to top |
|
dick scherrer
Joined: 23 Nov 2006
Posts: 8733
Location: 221 B Baker St
|
| Posted: Tue Aug 26, 2008 3:13 am Post subject: |
|
|
Hello,
Quote: Now I got it..Thanks...
We need to issue the code in this order You're welcome :)
Yes, i believe you're quite close. . . .
Code: ISREDIT C ' MGMTCLAS=R2, ' '//* XXXTCLAS=R2, ' ALL needs the //'s
Code: ISREDIT C '// MGMTCLAS=R2, ' '//* XXXTCLAS=R2, ' ALL
Good luck and someone will be here if there are questions. |
|
| Back to top |
|
chidams78
Joined: 29 May 2006
Posts: 59
Location: India
|
| Posted: Tue Aug 26, 2008 3:49 am Post subject: |
|
|
| The only problem with that is, the code will solve the case 2, only if the blank spaces between // and MGMTCLAS=R2 is same in the PROC and in our code. Otherwise it won't consider that. Am i right |
|
| Back to top |
|
dick scherrer
Joined: 23 Nov 2006
Posts: 8733
Location: 221 B Baker St
|
| Posted: Tue Aug 26, 2008 4:33 am Post subject: |
|
|
Hello,
Yes, they would need to exactly match.
That is why i asked if your case2 was exact. . . |
|
| Back to top |
|
chidams78
Joined: 29 May 2006
Posts: 59
Location: India
|
| Posted: Tue Aug 26, 2008 8:07 pm Post subject: |
|
|
| We can't be sure that all the procs are like case 2. The blank spaces between // and MGMTCLAS may differ from one PROC to another |
|
| Back to top |
|
| |
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM
|