View previous topic :: View next topic
|
Author |
Message |
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
yes before starting this new post i was asking my doubt over there....i had got a reply for that from sureshpathi so just replied for that post also..... |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
If you really want to proceed with IDCAMS instead of IEFBR14, here is your logic.
1. Gather all the "SET" variables and values from JCL. (it will be difficult when PROC's are involved).
2. Before writing IDCAMS step, Use TRANSLATE function to change the value from SET variables to SET values. (I mean, &VAR1. to VALUE1). |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
sureshpathi10 wrote: |
If you really want to proceed with IDCAMS instead of IEFBR14, here is your logic.
1. Gather all the "SET" variables and values from JCL. (it will be difficult when PROC's are involved).
2. Before writing IDCAMS step, Use TRANSLATE function to change the value from SET variables to SET values. (I mean, &VAR1. to VALUE1). |
Do you mean to say that I should put all the SET variable lines in a stem variable (Eg: stem1.I) and take the Variable and its value in a separate stem varaible (Eg stem2.I and stem3.I) , then i shall use the TRANSLATE function like TRANSLATE(OUTPUT.I,stem2.I,stem3.I) so that the OUTPUT.I stem variable containing the symbolic parameter qualifier present in stem2.I will be replaced into normal qualifier which is present in stem3.I
Am I right....????? |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
Yes. Exactly...
You have to do TRANSLATE function for all SET variables (put loop) for all the line you are going to write (nested loop).
don't forget to include '&' and '.'(dot) while do TRANSLATE. |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
sureshpathi10 wrote: |
Yes. Exactly...
You have to do TRANSLATE function for all SET variables (put loop) for all the line you are going to write (nested loop).
don't forget to include '&' and '.'(dot) while do TRANSLATE. |
Yeah ok.....will try this and let you know....hope I am able to create the tool with this idea..... |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
Swathi Muralidharan wrote: |
sureshpathi10 wrote: |
Yes. Exactly...
You have to do TRANSLATE function for all SET variables (put loop) for all the line you are going to write (nested loop).
don't forget to include '&' and '.'(dot) while do TRANSLATE. |
Yeah ok.....will try this and let you know....hope I am able to create the tool with this idea..... |
Hi,
I wrote a code with the idea which you gave as shown below :
Code: |
"ISREDIT FIND ALL '"'SET'"' "
"ISREDIT (CNTR) = FIND_COUNTS"
DO WHILE CNTR > 0
L=0
"ISREDIT FIND '"'SET'"' "
"ISREDIT (LINE) = CURSOR "
STEM1.L = STRIP(LINE)
PARSE VAR '"STEM2.L "' '"SET"' STEM3.L '"="' STEM4.L
STEM3.L=STRIP(STEM3.L)
STEM4.L=STRIP(STEM4.L)
L=L+1
"ISREDIT FIND NEXT'"'SET'"' "
CNTR=CNTR-1
END
P=1
DO P=1 TO OUTPUT.0
STEM5.P=OUTPUT.P
DO M=1 TO STEM3.0
STEM5.P=TRANSLATE(STEM5.P,STEM4.M,STEM3.M)
STEM5.P=TRANSLATE(STEM5.P,'&','')
STEM5.P=TRANSLATE(STEM5.P,'..','.')
M=M+1
END
P=P+1
END
|
In the above the OUTPUT stem variable contains the dataset....The step by step process will take place like below in TRANSLATE function as below :
SET HLQ=TRE
SET SS=I
SET ENV=DV05
SET JOB=PRE9TKCL
&HLQ..&SS&ENV..&JOB..CODE.JCL
&TRE..&I&DV05..&PRE9TKCL..CODE.JCL
TRE..IDV05..PRE9TKCL..CODE.JCL
TRE.IDV05.PRE9TKCL.CODE.JCL
Here I have a doubt in TRANSLATE function.... In the first translate function i will be replacing all the HLQ, SS, ENV aand JOB SET variable to its original value....but if suppose i have my dataset having the name like below:
&HLQ..&SS&ENV..&JOB..SSCODE.JCL
then if use the translate function it will also replace the SSCODE to ICODE...but it should not be changed....
How do i write the syntax in such a way that translate should happen only to those values present before &....can you please give me some idea in writing syntax to solve this problem..... |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
Swathi Muralidharan wrote: |
Swathi Muralidharan wrote: |
sureshpathi10 wrote: |
Yes. Exactly...
You have to do TRANSLATE function for all SET variables (put loop) for all the line you are going to write (nested loop).
don't forget to include '&' and '.'(dot) while do TRANSLATE. |
Yeah ok.....will try this and let you know....hope I am able to create the tool with this idea..... |
Hi,
I wrote a code with the idea which you gave as shown below :
Code: |
"ISREDIT FIND ALL '"'SET'"' "
"ISREDIT (CNTR) = FIND_COUNTS"
DO WHILE CNTR > 0
L=0
"ISREDIT FIND '"'SET'"' "
"ISREDIT (LINE) = CURSOR "
STEM1.L = STRIP(LINE)
PARSE VAR '"STEM2.L "' '"SET"' STEM3.L '"="' STEM4.L
STEM3.L=STRIP(STEM3.L)
STEM4.L=STRIP(STEM4.L)
L=L+1
"ISREDIT FIND NEXT'"'SET'"' "
CNTR=CNTR-1
END
P=1
DO P=1 TO OUTPUT.0
STEM5.P=OUTPUT.P
DO M=1 TO STEM3.0
STEM5.P=TRANSLATE(STEM5.P,STEM4.M,STEM3.M)
STEM5.P=TRANSLATE(STEM5.P,'&','')
STEM5.P=TRANSLATE(STEM5.P,'..','.')
M=M+1
END
P=P+1
END
|
In the above the OUTPUT stem variable contains the dataset....The step by step process will take place like below in TRANSLATE function as below :
SET HLQ=TRE
SET SS=I
SET ENV=DV05
SET JOB=PRE9TKCL
&HLQ..&SS&ENV..&JOB..CODE.JCL
&TRE..&I&DV05..&PRE9TKCL..CODE.JCL
TRE..IDV05..PRE9TKCL..CODE.JCL
TRE.IDV05.PRE9TKCL.CODE.JCL
Here I have a doubt in TRANSLATE function.... In the first translate function i will be replacing all the HLQ, SS, ENV aand JOB SET variable to its original value....but if suppose i have my dataset having the name like below:
&HLQ..&SS&ENV..&JOB..SSCODE.JCL
then if use the translate function it will also replace the SSCODE to ICODE...but it should not be changed....
How do i write the syntax in such a way that translate should happen only to those values present before &....can you please give me some idea in writing syntax to solve this problem..... |
I changed my code little like this.
Code: |
"ISREDIT FIND ALL '"'SET'"' "
"ISREDIT (CNTR) = FIND_COUNTS"
DO WHILE CNTR > 0
L=0
"ISREDIT FIND '"'SET'"' "
"ISREDIT (LINE) = CURSOR "
STEM1.L = STRIP(LINE)
PARSE VAR '"STEM2.L "' '"SET"' STEM3.L '"="' STEM4.L
STEM3.L=STRIP(STEM3.L)
STEM4.L=STRIP(STEM4.L)
L=L+1
"ISREDIT FIND NEXT'"'SET'"' "
CNTR=CNTR-1
END
P=1
DO P=1 TO OUTPUT.0
STEM5.P=OUTPUT.P
DO M=1 TO STEM3.0
STEM5.P=TRANSLATE(STEM5.P,STEM4.M,'&'"STEM3.M"'')
STEM5.P=TRANSLATE(STEM5.P,'..','.')
M=M+1
END
P=P+1
END
|
Hope this is right.....I still dint execute it...but i wanted to reply for the question which i asked you that is why replying you with the idea which i got.....will update you after executing this....[/code] |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
You might want to change your code something like this...
Code: |
l=0;stem1.=' ';stem2.=' ';
"isredit f 'SET'"
do while rc = 0
l=l+1
"isredit (line) = Line .zcsr"
line=strip(line)
parse var line '//' 'SET' stem1.l '=' stem2.l
stem1.l = strip(stem1.l);
stem2.l = strip(translate(stem2.l,"'",' ')); /* Value may covered with single quotes */
"isredit f 'SET'"
end
do i=1 to l
from_var='&'||stem1.i||'.'
to_var = stem2.i
do j=1 to output.0
output.j=translate(output.j,from_var,to_var)
end
end |
I've not tested this code, so there might be chance of small corrections
keep in mind that when you do "DO var=1 TO value", you don't need to increment "var" manually. it will get incremented by "DO " loop. |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
sureshpathi10 wrote: |
You might want to change your code something like this...
Code: |
l=0;stem1.=' ';stem2.=' ';
"isredit f 'SET'"
do while rc = 0
l=l+1
"isredit (line) = Line .zcsr"
line=strip(line)
parse var line '//' 'SET' stem1.l '=' stem2.l
stem1.l = strip(stem1.l);
stem2.l = strip(translate(stem2.l,"'",' ')); /* Value may covered with single quotes */
"isredit f 'SET'"
end
do i=1 to l
from_var='&'||stem1.i||'.'
to_var = stem2.i
do j=1 to output.0
output.j=translate(output.j,from_var,to_var)
end
end |
I've not tested this code, so there might be chance of small corrections
keep in mind that when you do "DO var=1 TO value", you don't need to increment "var" manually. it will get incremented by "DO " loop. |
Hi,
I tried my code with some changes in what you gave as well mine....TRANSLATE is not working (i.e) the symbolic parameters are not changed.....
the code is below:
Code: |
DO I=1 TO L
FROM_VAR='&'||STEM2.I||'.'
TO_VAR = STEM3.I
SAY "OUT LENGTH" OUTPUT.0
SAY "J VALUE" J
DO M=1 TO K
SAY "FROM" FROM_VAR
SAY "TO" TO_VAR
OUTPUT1.M=TRANSLATE(OUTPUT.M,FROM_VAR,TO_VAR)
SAY OUTPUT1.M
END
END
RETURN
|
Here K value indicates the Number of datasets present |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
Could you also post all the output you've got from 'SAY' command? |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
sureshpathi10 wrote: |
Could you also post all the output you've got from 'SAY' command? |
140 *-* DO M=1 TO K
>>> "1"
>>> "3"
141 *-* SAY "FROM" FROM_VAR
>>> "FROM &HLQ."
FROM &HLQ.
142 *-* SAY "TO" TO_VAR
>>> "TO TRE"
TO TRE
143 *-* OUTPUT1.M=TRANSLATE(OUTPUT.M,FROM_VAR,TO_VAR)
>>> "&HLQ..&SS&LNV..JCL2"
144 *-* SAY OUTPUT1.M
>>> "&HLQ..&SS&LNV..JCL2"
&HLQ..&SS&LNV..JCL2
145 *-* END
140 *-* DO M=1 TO K
141 *-* SAY "FROM" FROM_VAR
>>> "FROM &HLQ."
FROM &HLQ.
142 *-* SAY "TO" TO_VAR
>>> "TO TRE"
TO TRE
143 *-* OUTPUT1.M=TRANSLATE(OUTPUT.M,FROM_VAR,TO_VAR)
>>> "&HLQ..&SS&LNV..JCL4"
144 *-* SAY OUTPUT1.M
>>> "&HLQ..&SS&LNV..JCL4"
&HLQ..&SS&LNV..JCL4
145 *-* END
140 *-* DO M=1 TO K
141 *-* SAY "FROM" FROM_VAR
>>> "FROM &HLQ."
FROM &HLQ.
142 *-* SAY "TO" TO_VAR
>>> "TO TRE"
TO TRE
143 *-* OUTPUT1.M=TRANSLATE(OUTPUT.M,FROM_VAR,TO_VAR)
>>> "&HLQ..&SS&LNV..JCL3"
144 *-* SAY OUTPUT1.M
>>> "&HLQ..&SS&LNV..JCL3"[/code] |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
Swathi Muralidharan wrote: |
sureshpathi10 wrote: |
Could you also post all the output you've got from 'SAY' command? |
140 *-* DO M=1 TO K
>>> "1"
>>> "3"
141 *-* SAY "FROM" FROM_VAR
>>> "FROM &HLQ."
FROM &HLQ.
142 *-* SAY "TO" TO_VAR
>>> "TO TRE"
TO TRE
143 *-* OUTPUT1.M=TRANSLATE(OUTPUT.M,FROM_VAR,TO_VAR)
>>> "&HLQ..&SS&LNV..JCL2"
144 *-* SAY OUTPUT1.M
>>> "&HLQ..&SS&LNV..JCL2"
&HLQ..&SS&LNV..JCL2
145 *-* END
140 *-* DO M=1 TO K
141 *-* SAY "FROM" FROM_VAR
>>> "FROM &HLQ."
FROM &HLQ.
142 *-* SAY "TO" TO_VAR
>>> "TO TRE"
TO TRE
143 *-* OUTPUT1.M=TRANSLATE(OUTPUT.M,FROM_VAR,TO_VAR)
>>> "&HLQ..&SS&LNV..JCL4"
144 *-* SAY OUTPUT1.M
>>> "&HLQ..&SS&LNV..JCL4"
&HLQ..&SS&LNV..JCL4
145 *-* END
140 *-* DO M=1 TO K
141 *-* SAY "FROM" FROM_VAR
>>> "FROM &HLQ."
FROM &HLQ.
142 *-* SAY "TO" TO_VAR
>>> "TO TRE"
TO TRE
143 *-* OUTPUT1.M=TRANSLATE(OUTPUT.M,FROM_VAR,TO_VAR)
>>> "&HLQ..&SS&LNV..JCL3"
144 *-* SAY OUTPUT1.M
>>> "&HLQ..&SS&LNV..JCL3"[/code] |
Code: |
/*REXX*/
"ISREDIT MACRO"
TRACE (R)
TEMP="NEW,CATLG,DELETE"
TEMP2=",CATLG,DELETE"
SETVAR="SET"
K=0
I=1
J=1
"ISREDIT SEEK ALL '"TEMP"' "
"ISREDIT (TOT) = SEEK_COUNTS"
CALL NEWPGM
"ISREDIT SEEK ALL WORD '"TEMP2"'"
"ISREDIT (CNT) = SEEK_COUNTS"
CALL CATLGPGM
"ISREDIT SEEK ALL WORD '"SETVAR"' "
"ISREDIT (CNTR) = SEEK_COUNTS"
CALL CHNGSYMB
INSLIN=K
TEMP1=EXEC
"ISREDIT FIND FIRST '"TEMP1"'"
IF RC=0 THEN DO
"ISREDIT (NUM) = LINENUM .ZCSR"
NUM1=NUM-5
END
"ISREDIT CURSOR = "NUM1" 1"
"ISREDIT (LINE2) = LINE .ZCSR"
RES1=TOT+CNT+3
I=1
"ISREDIT LINE_BEFORE .ZCSR = '//JS0010 EXEC PGM=IDCAMS'"
"ISREDIT LINE_BEFORE .ZCSR = '//SYSPRINT DD SYSOUT=*'"
"ISREDIT LINE_BEFORE .ZCSR = '//SYSOUT DD SYSOUT=*'"
"ISREDIT LINE_BEFORE .ZCSR = '//SYSIN DD *'"
DO WHILE INSLIN > 0
OUT=' ' || DELETE ||' ' || OUTPUT.I
"ISREDIT LINE_BEFORE .ZCSR = '"OUT"' "
INSLIN=INSLIN-1
I=I+1
END
INS=" SET MAXCC=0"
"ISREDIT LINE_BEFORE .ZCSR = '"INS"' "
"ISREDIT LINE_BEFORE .ZCSR = '/*'"
"ISREDIT END"
EXIT
/* CALLS NEWPGM WHEN TEMP IS "NEW,CATLG,DELETE" */
NEWPGM:
I=1
COUNT=TOT
COUNT1=TOT
DO WHILE COUNT > 0
IF RC=0 THEN DO
"ISREDIT (VAL) = LINENUM .ZCSR"
VAL1=VAL-1
"ISREDIT (LINE) = LINE " VAL1
INPUT.I = STRIP(LINE)
PARSE VALUE "'"INPUT.I"'" WITH PREC ','
OUT=POS('=',PREC)
RES=SUBSTR(PREC,OUT+1)
PARSE VALUE "'"RES"'" WITH PRE '(' POST ')'
IF POST = "" THEN DO
OUTPUT.I=RES
K=K+1
COUNT=COUNT-1
I=I+1
J=I
END
ELSE DO
IF DATATYPE(POST) == NUM THEN DO
NOP
COUNT=COUNT-1
END
ELSE DO
OUTPUT.I=RES
K=K+1
COUNT=COUNT-1
I=I+1
J=I
END
END
END
"ISREDIT FIND NEXT '"TEMP"' "
END
RETURN
/* CALLS CATLGPGM WHEN TEMP IS ",CATLG,DELETE" */
CATLGPGM:
COUNT=CNT
COUNT1=CNT
DO WHILE COUNT > 0
IF RC=0 THEN DO
"ISREDIT (VAL) = LINENUM .ZCSR"
VAL1=VAL-1
"ISREDIT (LINE) = LINE " VAL1
INPUT.J = STRIP(LINE)
PARSE VALUE "'"INPUT.J"'" WITH PREC ','
OUT=POS('=',PREC)
RES=SUBSTR(PREC,OUT+1)
OUTPUT.J=RES
PARSE VALUE "'"RES"'" WITH PRE '(' POST ')'
IF POST = "" THEN DO
OUTPUT.J=RES
K=K+1
COUNT=COUNT-1
J=J+1
END
ELSE DO
IF DATATYPE(POST) == NUM THEN DO
NOP
COUNT=COUNT-1
END
ELSE DO
OUTPUT.J=RES
K=K+1
COUNT=COUNT-1
J=J+1
END
END
END
"ISREDIT FIND NEXT '"TEMP2"' "
END
RETURN
/* CHANGES ALL THE SYMBOLIC PARAMETER TO NORMAL VARIABLES */
CHNGSYMB:
L=0
DO WHILE CNTR > 0
IF RC=0 THEN DO
L=L+1
"ISREDIT (LIN2) = LINE .ZCSR"
STEM1.L = STRIP(LIN2)
PARSE VAR STEM1.L '//' 'SET' STEM2.L '=' STEM3.L
STEM2.L=STRIP(STEM2.L)
STEM3.L=STRIP(STEM3.L)
"ISREDIT FIND NEXT '"SETVAR"' "
CNTR=CNTR-1
END
DO I=1 TO L
SAY "L VALUE" L
FROM_VAR='&'||STEM2.I||'.'
TO_VAR = STEM3.I
SAY "J VALUE" J
DO M=1 TO K
SAY "FROM" FROM_VAR
SAY "TO" TO_VAR
OUTPUT.M=TRANSLATE(OUTPUT.M,FROM_VAR,TO_VAR)
SAY OUTPUT.M
END
END
RETURN
|
Above is entire code...... |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
Could you changes from
Code: |
OUTPUT1.M=TRANSLATE(OUTPUT.M,FROM_VAR,TO_VAR) |
to
Code: |
OUTPUT1.M=TRANSLATE(OUTPUT.M,TO_VAR,FROM_VAR) |
|
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
sureshpathi10 wrote: |
Could you changes from
Code: |
OUTPUT1.M=TRANSLATE(OUTPUT.M,FROM_VAR,TO_VAR) |
to
Code: |
OUTPUT1.M=TRANSLATE(OUTPUT.M,TO_VAR,FROM_VAR) |
|
I changed it and the final output which i am getting is like this:
Code: |
DELETE TRV T TV04 JCV2
DELETE TRV T TV04 JCV4
DELETE TRV T TV04 JCV3
|
|
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
Sorry.. My bad.. TRANSLATE function would change the string char by char....
can you try with this code ?
Code: |
DO I=1 TO L
SAY "L VALUE" L
FROM_VAR='&'||STEM2.I||'.'
TO_VAR = STEM3.I
SAY "J VALUE" J
DO M=1 TO K
SAY "FROM" FROM_VAR
SAY "TO" TO_VAR
POS1=POS(FROM_VAR,OUTPUT.M);
IF POS1 > 1 THEN
OUTPUT.M=SUBSTR(OUTPUT.M,1,POS1-1)||TO_VAR||SUBSTR(OUTPUT.M,POS1+LENGTH(FROM_VAR))
IF POS1 = 1 THEN
OUTPUT.M=TO_VAR||SUBSTR(OUTPUT.M,LENGTH(FROM_VAR)+1)
SAY OUTPUT.M
END
END |
|
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
sureshpathi10 wrote: |
Sorry.. My bad.. TRANSLATE function would change the string char by char....
can you try with this code ?
Code: |
DO I=1 TO L
SAY "L VALUE" L
FROM_VAR='&'||STEM2.I||'.'
TO_VAR = STEM3.I
SAY "J VALUE" J
DO M=1 TO K
SAY "FROM" FROM_VAR
SAY "TO" TO_VAR
POS1=POS(FROM_VAR,OUTPUT.M);
IF POS1 > 1 THEN
OUTPUT.M=SUBSTR(OUTPUT.M,1,POS1-1)||TO_VAR||SUBSTR(OUTPUT.M,POS+LENGTH(FROM_VAR))
ELSE
OUTPUT.M=TO_VAR||SUBSTR(OUTPUT.M,LENGTH(FROM_VAR)+1)
SAY OUTPUT.M
END
END |
|
Yes you are right i analysed it and came to a conclusion just now and you replied the same....it is changing whereever the letter is found....i asked about that in yesterday's post itself but for got it afterwards...will check this code and let you know.... |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
There is a small change in my previous post.. I edited it....
Code: |
DO I=1 TO L
SAY "L VALUE" L
FROM_VAR='&'||STEM2.I||'.'
TO_VAR = STEM3.I
SAY "J VALUE" J
DO M=1 TO K
SAY "FROM" FROM_VAR
SAY "TO" TO_VAR
POS1=POS(FROM_VAR,OUTPUT.M);
IF POS1 > 1 THEN
OUTPUT.M=SUBSTR(OUTPUT.M,1,POS1-1)||TO_VAR||SUBSTR(OUTPUT.M,POS1+LENGTH(FROM_VAR))
IF POS1 = 1 THEN
OUTPUT.M=TO_VAR||SUBSTR(OUTPUT.M,LENGTH(FROM_VAR)+1)
SAY OUTPUT.M
END
END |
|
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
sureshpathi10 wrote: |
There is a small change in my previous post.. I edited it....
Code: |
DO I=1 TO L
SAY "L VALUE" L
FROM_VAR='&'||STEM2.I||'.'
TO_VAR = STEM3.I
SAY "J VALUE" J
DO M=1 TO K
SAY "FROM" FROM_VAR
SAY "TO" TO_VAR
POS1=POS(FROM_VAR,OUTPUT.M);
IF POS1 > 1 THEN
OUTPUT.M=SUBSTR(OUTPUT.M,1,POS1-1)||TO_VAR||SUBSTR(OUTPUT.M,POS1+LENGTH(FROM_VAR))
IF POS1 = 1 THEN
OUTPUT.M=TO_VAR||SUBSTR(OUTPUT.M,LENGTH(FROM_VAR)+1)
SAY OUTPUT.M
END
END |
|
The output comes properly but it comes as TRE.&SSDV04.JCL1
The problem is it checks for &SS. which is not found so POS1is 0 and hence no changes takes place....instead of using POS can i use INDEX or anyother syntax...???? |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
Even 'INDEX' function will work same as this.
I'm not sure, whether symbolic parameter can come without '.' at end.
But still, you may check one more time for without '.'
Code: |
DO I=1 TO L
FROM_VAR='&'||STEM2.I||'.'
TO_VAR = STEM3.I
DO M=1 TO K
POS1=POS(FROM_VAR,OUTPUT.M);
IF POS1 > 1 THEN
OUTPUT.M=SUBSTR(OUTPUT.M,1,POS1-1)||TO_VAR||SUBSTR(OUTPUT.M,POS1+LENGTH(FROM_VAR))
IF POS1 = 1 THEN
OUTPUT.M=TO_VAR||SUBSTR(OUTPUT.M,LENGTH(FROM_VAR)+1)
SAY OUTPUT.M
END
FROM_VAR='&'||STEM2.I
DO M=1 TO K
POS1=POS(FROM_VAR,OUTPUT.M);
IF POS1 > 1 THEN
OUTPUT.M=SUBSTR(OUTPUT.M,1,POS1-1)||TO_VAR||SUBSTR(OUTPUT.M,POS1+LENGTH(FROM_VAR))
IF POS1 = 1 THEN
OUTPUT.M=TO_VAR||SUBSTR(OUTPUT.M,LENGTH(FROM_VAR)+1)
SAY OUTPUT.M
END
END |
|
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
sureshpathi10 wrote: |
Even 'INDEX' function will work same as this.
I'm not sure, whether symbolic parameter can come without '.' at end.
But still, you may check one more time for without '.'
Code: |
DO I=1 TO L
FROM_VAR='&'||STEM2.I||'.'
TO_VAR = STEM3.I
DO M=1 TO K
POS1=POS(FROM_VAR,OUTPUT.M);
IF POS1 > 1 THEN
OUTPUT.M=SUBSTR(OUTPUT.M,1,POS1-1)||TO_VAR||SUBSTR(OUTPUT.M,POS1+LENGTH(FROM_VAR))
IF POS1 = 1 THEN
OUTPUT.M=TO_VAR||SUBSTR(OUTPUT.M,LENGTH(FROM_VAR)+1)
SAY OUTPUT.M
END
FROM_VAR='&'||STEM2.I
DO M=1 TO K
POS1=POS(FROM_VAR,OUTPUT.M);
IF POS1 > 1 THEN
OUTPUT.M=SUBSTR(OUTPUT.M,1,POS1-1)||TO_VAR||SUBSTR(OUTPUT.M,POS1+LENGTH(FROM_VAR))
IF POS1 = 1 THEN
OUTPUT.M=TO_VAR||SUBSTR(OUTPUT.M,LENGTH(FROM_VAR)+1)
SAY OUTPUT.M
END
END |
|
Hi,
Thanks a lot for helping me....Now the code is working fine...without your help i could have done this tool.....would have stuck up with the one code that works without symbolic parameter.....thanks..... now will try to insert the step in this below mentioned case :
when a cursor is placed in a line and enter key is pressed the delete step should be inserted.... At present the step will be inserted 5 lines before the first EXEC....now will try to change it.... |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
Please create a new topic with more information for any further questions.. |
|
Back to top |
|
|
|