View previous topic :: View next topic
|
Author |
Message |
chidams78 Currently Banned New User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
Hi all,
By means of ISREDIT macro, I am puting ' // ' before the proc step that we don't want to execute, which is not needed for testing purpose.
In the below example,we don't want to execute the step containing PGM=DPD111, so we will be puting // before that PROC STEP2 by means of ISREDIT macro. The concern here is, some of the PROC symbolic variables i.e., CONDB and GDG are used exclusively for STEP2 which we are not executing. So when we JEM or JSCAN the job, we will be getting the error as " Symbolic variables declared but not used in the PROC". So how we can get to know and delete the symbolic variables which are not used.
Example PROC
------------
//TST1101 PROC CONDA='0,NE',CONDB='0,NE',GDG='(+1)'
//STEP1 EXEC PGM=SORT,COND=(&CONDA)
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=TST#TT.TEST.FILE,DISP=SHR
//SORTOUT DD DSN=TST#TT.TEST.FILE.SORTED,
// DISP=(,CATLG,DELETE)
// SPACE=(TRK,(1,1),RLSE),
// DCB=(RECFM=FB,LRECL=160,BLKSIZE=0)
//SYSIN DD DSN=TTT.CHIDU.CTLLIB(CHIDUCTL),DISP=SHR
//*
//
//STEP2 EXEC PGM=DPD111,COND=(&CONDB)
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//MPIN DD DSN=TST#TT.TEST.FILE.SORTED,DISP=SHR
//MPOUT DD DSN=TST#TT.TEST.AUGFILE(&GDG),
// DISP=(,CATLG,DELETE),UNIT=DISK,
// SPACE=(TRK,(2,1),RLSE),
// DCB=(RECFM=FB,LRECL=100,BLKSIZE=0)
//SYSOUT DD SYSOUT=*
The logic that comes to my mind is
Once after puting the // before the STEP2, read each line from STEP2 downwards and get the symbolic variables in a ISREDIT variable. Check that symbolic variable from the top of the PROC till STEP2 and if the occurance is zero, then blank out that symbolic variable.
Could you please help me in finding out the unused symbolic variables with some other good idea.
Rgds
Chidams |
|
Back to top |
|
|
chidams78 Currently Banned New User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
Hi,
I had put JSCAN on the following JCLand for this error for the unused symbolic variables
==MSG> .JAAA 8 DSS2190E - PROC SYMBOLIC
VARIABLE "CONDB " NOT USED IN PROC
==MSG> .JAAA 8 DSS2190E - PROC SYMBOLIC VARIABLE "GDG "
NOT USED IN PROC
Rgds
Chidam |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
If you are testing, perhaps it is easier to make a new member.
And in the new member, you can delete the unused parms from the PROC statement. |
|
Back to top |
|
|
chidams78 Currently Banned New User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
The concern here is how can we find the unused symbolic variables in the PROC. Itz not that the symbolic variable is totally unused but the fact that we had put // till the step that we want to execute, which inturn forces us to delete the declared symbolic variable exclusively used after // statement. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
Quote: |
how can we find the unused symbolic variables in the PROC |
Not sure I understand your concern. It seems clear that you got messages that told you which variables to remove. Just remove them now.
Code: |
==MSG> .JAAA 8 DSS2190E - PROC SYMBOLIC
VARIABLE "CONDB " NOT USED IN PROC
==MSG> .JAAA 8 DSS2190E - PROC SYMBOLIC VARIABLE "GDG "
NOT USED IN PROC |
|
|
Back to top |
|
|
chidams78 Currently Banned New User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
Hi Pedro,
Ya..my concern is through ISPF macro, how can we find the unused symbolic variables in the PROC
Thanks
Chidam |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
1. find " PROC " then get the line and parse out the parms into a stem variable, perhaps 'a_parm.x'
2. Find '// ' in column 1. put a label at that line, perhaps call it .end
3. loop through your stem, and issue "FIND '"a_parm.x"' .zfirst .end"
4. If you find it, good! if not found, remove from the PROC statement. |
|
Back to top |
|
|
chidams78 Currently Banned New User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
Thanks Pedro
I had put the code to validate as you told but not able to get the symbolic variables in stem concept
//INS2204 PROC CONDA='0,NE', COND6='0,NE',CONDB='0,NE',CONDC='0,NE',
// COND4='7,LT',CONDQ='7,LT',CONDS='7,LT'
Code
-------
Code: |
"ISREDIT CURSOR = 1 1"
"ISREDIT (LINE) = LINENUM .ZCSR"
"ISREDIT LABEL .ZCSR = .A 0"
"ISREDIT F '// '"
"ISREDIT (LINE) = LINENUM .ZCSR"
"ISREDIT LABEL (LINE) = .B 0"
"ISREDIT CURSOR = 1 1"
"ISREDIT (LINE) = LINENUM .ZCSR"
"ISREDIT FIND .A .B 'CONDQ' ALL" [color=blue] /* Here need to get the variable dynamically [/color]"ISREDIT (FINDS) = FIND_COUNTS"
IF FINDS > 1
<do nothing>
ELSE
<delete the symbolic variable from the declaration in the PROC |
Plz help |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
Something like this (untested):
The example saves the proc variable names to a rexx stem variable called a_parm
Code: |
x = 0
a_parm. = ''
"(aline) = LINE .zcsr"
parse var aline . 'PROC ' theparms
theparms = strip(theparms)
Do while (theparms /= '') /*while more parms */
parse var theparms parm "=' . "'," theparms
if parm /= '' THen
Do /* found parm */
x = x+1
a_parm.x = parm
End /* found parm */
End /* while more parms*/ |
|
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
sorry my last post was intended for a different thread, but cannot see that thread at the moment???? |
|
Back to top |
|
|
chidams78 Currently Banned New User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
Hi Pedro,
No probs..
You mean to say that the above code snippet that you had provided is not for this thread.. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
I think my browser was messed up after my first post today, so I only thought it was the wrong thread. It is the correct thread. |
|
Back to top |
|
|
chidams78 Currently Banned New User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
Hi Pedro,
Instead of reading each declared symbolic parameter from the PROC, and checking it out whether it is used in the PROC by puting the label range, will it be good if we follow the belwo approach
1. Put a label at the beginning of the line .START
1. Find if '// ' is there. Put a label for that .MID
2. Put a label at the end of the line .END
3. Read the first line from .MID and get the symbolic variable into a REXX variable and search it between .START and .MID.
4. If the occurance is 1, then blank out that symbolic variable else leave it as such.
By this way we don't have to check for all the symbolic variables.
Whether this approach holds good.
For the step3 that I had mentioned, I am not able to get the symbolic variable into a REXX variable. Symbolic variables can either come in between & and ) or & and .
Any idea how to retrive those into REXX variable |
|
Back to top |
|
|
chidams78 Currently Banned New User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
The approach that I had told in my last post will not work out because we will be getting only the symbolic variable name and won't be getting the value of that. For blanking out purpose, we need to blank out both symbolic variable and its value, right.
So I think the above approach specified by me won't work out. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
See my earlier post from: Sat Aug 30, 2008 10:36 pm |
|
Back to top |
|
|
chidams78 Currently Banned New User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
Pedro,
Ya..I had now followed the logic suggested by you.
But I am not able to blank out the symbolic variable. I think there is some flaws in the code that I had written. Could you please look into this
The reqt is to blank out the symbolic variables from the PROC.
For Eg., in the below PROC, assume that the symbolic variables CONDB, CONDG and CONDN are used after // line and needs to be blanked out.
//TST2123 PROC CONDA='0,NE',COND6='0,NE',CONDB='0,NE',CONDC='0,NE',
// COND4='7,LT',CONDE='7,LT',CONDF='7,LT',CONDG='7,LT',
// CONDI='7,LT',CONDJ='7,LT',CONDL='7,LT',CONDN='7,LT',
// CONDP='7,LT',CONDQ='7,LT',CONDALL='7,LT'
The code that I had written is
Code: |
"ISREDIT LABEL .ZLAST = .C 0" /* labelling the last line
"ISREDIT CURSOR = 1 1"
"ISREDIT (LINE) = LINENUM .ZCSR"
"ISREDIT LABEL .ZCSR = .A 0" /*labelling the first line
"ISREDIT F '// '"
"ISREDIT (LINE) = LINENUM .ZCSR"
"ISREDIT LABEL (LINE) = .B 0" /*labelling the line at // line
"ISREDIT CURSOR = 1 1"
"ISREDIT (LINE) = LINENUM .ZCSR"
X = 0
APARM. = ' '
"ISREDIT (ALINE) = LINE .ZCSR"
PARSE VAR ALINE 'PROC' THEPARMS /*reading the first line
THEPARMS = STRIP(THEPARMS)
DO WHILE (THEPARMS <> ' ') /* for more parms
PARSE VAR THEPARMS PARM1 "=" PARM2 "'," THEPARMS
IF PARM1 <> ' ' THEN
DO
X = X + 1
APARM.X = PARM1
"ISREDIT CURSOR = 1 1"
"ISREDIT (LINE) = LINENUM .ZCSR"
"ISREDIT FIND .A .B &PARM1 ALL" /* searching the parm between first line and line having //
"ISREDIT (FINDS) = FIND_COUNTS" /* taking the count
IF FINDS > 1 THEN /* for count > 1 blank out parm
"ISREDIT (LINE) = LINENUM .ZCSR"
ELSE DO
PARMFL = PARM1||PARM2 /* cocatenating the parm with its value
"ISREDIT CURSOR = 1 1"
"ISREDIT C &PARMFL ''" /* blanking out the parm with value. Here it errored saying comma
is there in the parm value
END
END
END |
1. I am not able to blank out using the symbolic variable as it contains comma (').
2.Also how to read each line by line (reading all symbolic variables) till the EXEC step
Appreciate your help |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
Whenever I have data that conflicts with macro syntax, I temporarily change to a different value, run the macro instructions, then change it back to original character. Use a character that is not otherwise used in the data.
For example:
Code: |
Address ISREDIT
"C '7D'x 'A1'x ALL"
/* do your macro logic*/
/* be sure to use ~ instead of ' in the parse */
"C 'A1'x '7D'x ALL"
|
My earlier suggestion was to find ' PROC ', I do not see where you are doing that. When you do, process that line. If it ends with comma, process the next line too. |
|
Back to top |
|
|
chidams78 Currently Banned New User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
The following code which is already put forth finds for the PROC in the first line, right
Code: |
PARSE VAR ALINE 'PROC' THEPARMS |
As for the conversion of inverted comma to ~, I had already did that but I am not able to do conversion for the parm value stored in PARMFL.
I will concatenate the symbolic variable and its value to PARMFL and then will blankout the same from the PROC.
I can convert " ' " to '~' in the PROC but the string stored in the PARMFL also needs to be converted to the same format, right.
Could you plz help how to achieve that |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
For finding it, I was expecting Address ISREDIT "FIND 'PROC'". It might not be in the first line.
Quote: |
not able to do conversion for the parm value stored in PARMFL |
Not sure what you mean. All values in the file should have been converted before PARMFL was assigned a value.
My suggestion was this:
Code: |
Address ISREDIT
"C '7D'x 'A1'x ALL"
/* do your macro logic*/
/* be sure to use ~ instead of ' in the parse */
"C 'A1'x '7D'x ALL" |
Which will convert everything before you start searching / parsing / anything. Sorry if I was not clear.
You statement to blank out should be:
Code: |
"ISREDIT C '" || PARMFL || "' ''" |
|
|
Back to top |
|
|
chidams78 Currently Banned New User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
Thanks Pedro...
After conversion of inverted comma to ~ char, the parm in PROC looks like CONDA~0,NE~, and the the PARMFL which has the extracetd parm and its value also looks like CONDA~0,NE~.
But when i tried to blank out this parm,
Code: |
"ISREDIT C &PARMFL ' ' " |
i got an error saying
Invalid parameter
Check for misspelled keywords or too many bounds (numeric) parameters.
This is because of the ~ (special char).
I didnt understand the code that you mentioned as
"ISREDIT C '" || PARMFL || "' ''"
Please help |
|
Back to top |
|
|
chidams78 Currently Banned New User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
Hi all,
Any idea how to blank out the variable with special char.
Eg : need to blank out CONDA~0,NE~.
I am storing this symbolic variable in a REXX variable PARMFL and tried to issue the below command which results in error.
Code: |
"ISREDIT C &PARMFL ' ' " |
Please help.
Thanks
Chidam |
|
Back to top |
|
|
chidams78 Currently Banned New User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
Got the solution for the above query...:-)
We need to convert the charcter string to Picture and then convert it.
Code: |
"ISREDIT C P'&PARMFL' ' ' " |
Thanks
Chidam |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
You missed this in one of my earlier appends:
Code: |
"ISREDIT C '" || PARMFL || "' ''" |
|
|
Back to top |
|
|
harikiranr
New User
Joined: 08 Sep 2008 Posts: 4 Location: Chennai
|
|
|
|
Hello,
I believe that you don't want to run the second step.
so you can make CONDB='0,LE'. this will make the step to be bypassed every time.
Thanks,
Hari |
|
Back to top |
|
|
|