View previous topic :: View next topic
|
Author |
Message |
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
Find all for ",CATLG,DELETE".
For each occurrence,
1. Get data from that line
2. check it matches to your string.
3. if match, the process or go for next. |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
Hi,
I tried my code with the below parse statement and it was working fine but now I am stuck with the error of UNEXPECTED THEN or ELSE...I couldnt find where i am going wrong......
DO WHILE COUNT > 0
IF RC=0 THEN DO
"ISREDIT (VAL) = LINENUM .ZCSR"
VAL1=VAL-1
SAY VAL1
"ISREDIT (LINE) = LINE " VAL1
INPUT.I = STRIP(LINE)
PARSE VALUE "'"INPUT.I"'" WITH PREC ','
OUT=POS('=',PREC)
RES=SUBSTR(PREC,OUT+1)
SAY RES
PARSE VALUE "'"RES"'" WITH PRE '(' POST ')'
SAY POST
IF POST = "" THEN DO
OUTPUT.I=RES
COUNT=COUNT-1
I=I+1
J=I
ELSE DO
IF DATATYPE(POST) == NUM THEN DO
NOP
ELSE DO
OUTPUT.I=RES
COUNT=COUNT-1
I=I+1
J=I
END
END
"ISREDIT FIND NEXT '"TEMP"' "
END
END |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
Please use CODE tag for all program statements.
You are missing an 'END' for below statement
Code: |
IF POST = "" THEN DO
OUTPUT.I=RES
COUNT=COUNT-1
I=I+1
J=I |
|
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
Just for the thought,
You can code like below to simplify the process
Code: |
parse var INPUT.I '//' ddname 'DD' 'DSN=' dsname ',' others |
|
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
sureshpathi10 wrote: |
Just for the thought,
You can code like below to simplify the process
Code: |
parse var INPUT.I '//' ddname 'DD' 'DSN=' dsname ',' others |
|
Hi,
I tried the syntax which you suggested but it says symbol expected..... |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
Please post your Full code to help you further. |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
Hi All,
Thank you all for helping me in creating this tool....Finaaly I created a tool that which inserts the delete steps in a jcl.....
But this can be done only when the Dataset name is given properly. If in case the dataset is specified using Symbolic parameter using SET statement in JCL like DSN=&HLQ..&JOB.JCL
This delete step will not work....can someone please give me some idea of how do i achieve that and insert the delete step in this case..... |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
If you use IEFBR14 utility to delete your dataset, you don't need to worry about Symbolic parameter as its part of your JCL.
Code: |
//stepname EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//ddname DD DSN=dsname,
// DISP=(OLD,DELETE,DELETE)
/* |
|
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
sureshpathi10 wrote: |
If you use IEFBR14 utility to delete your dataset, you don't need to worry about Symbolic parameter as its part of your JCL.
Code: |
//stepname EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//ddname DD DSN=dsname,
// DISP=(OLD,DELETE,DELETE)
/* |
|
But I cannot use IEFBR14 as i want to have the delete all the file used in JCL at once so that i will IDCAMS like this...
//stepname EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
DELETE dsname1
DELETE dsname2
DELETE dsname3
SET MAXCC=0
/*
I will insert the above step using my rexx tool by finding the DSNAME in the JCL....if in this case my DSNAME has using symbolic parameter what should i do...... |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
Hi,
I have dataset name &HLQ..&SS&ENV..&JOB..JCL in my stem variable OUTPUT.I now i wanna change all HLQ to some name similarly SS and ENV....how do i achieve this using CHANGE ALL syntax of ISREDIT MACROS can some one give me some idea.....please.... |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Please use a different forum thread when you ask a different question. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Please provide a sample of your data. |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
You may use Translate built-in function to achieve your desire output.
You can find Here how to use Translate. |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
sureshpathi10 wrote: |
You may use Translate built-in function to achieve your desire output.
You can find Here how to use Translate. |
Hi,
I will explain you clearly with an example:
Take for example my JCL is as below at first :
Code: |
//USERID JOB CLASS=B,MSGCLASS=X,NOTIFY=USERID
//*
//*
// SET HLQ=TRE
// SET SS=I
// SET ENV=DTH
//*
//*
//************************************************
//* THIS STEP IS USED TO COPY THE INPUT FILE TO
//* OUTPUT FILE
//************************************************
//STEP1 EXEC PGM=SORT
//SORTIN DD DSN=&HLQ..&SS&ENV..CODEIN.JCL,DISP=SHR
//SORTOUT DD DSN=&HLQ..&SS&ENV..CODE1.JCL,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(1,2),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
/*
//
|
and now when i insert the delete step using my rexx tool i want my jcl to look like this shown below:
Code: |
//USERID JOB CLASS=B,MSGCLASS=X,NOTIFY=USERID
//*
//*
// SET HLQ=TRE
// SET SS=I
// SET ENV=DTH
//*
//JS0010 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
DELETE TRE.IDTH.CODE1.JCL
SET MAXCC=0
/*
//*
//************************************************
//* THIS STEP IS USED TO COPY THE INPUT FILE TO
//* OUTPUT FILE
//************************************************
//STEP1 EXEC PGM=SORT
//SORTIN DD DSN=&HLQ..&SS&ENV..CODEIN.JCL,DISP=SHR
//SORTOUT DD DSN=&HLQ..&SS&ENV..CODE1.JCL,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(1,2),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
/*
//
|
How do i change the symbolic parameters in the DSN to normal one so that the actual dataset name is used in inserting into the delete step....my rexx tool now inserts the delete step properly if there is no symbolic parameter is specified in the DSN in JCL....please help me in achieving this..... |
|
Back to top |
|
|
TheMFKid
New User
Joined: 20 Nov 2013 Posts: 91 Location: India
|
|
Back to top |
|
|
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 |
|
|
|