IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

ISREDIT macro command doubt


IBM Mainframe Forums -> TSO/ISPF
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2546
Location: Silicon Valley

PostPosted: Tue Feb 11, 2014 10:12 pm
Reply with quote

Use the PARSE statement.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Feb 11, 2014 10:18 pm
Reply with quote

Pedro wrote:
Use the PARSE statement.

"Use the parse, Luke!" icon_biggrin.gif
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Tue Feb 11, 2014 10:19 pm
Reply with quote

yes wrote a syntax with PARSE statement as below :

PARSE VALUE '"RES"' WITH PRE '(' POST ')'
SAY POST
POST1=SUBSTR(POST,2)
SAY POST1
IF DATATYPE(POST1) == NUM
ITERATE
END

dont know whether this will work or not...will try this tommorow and let you know people.....

in the above code i have taken POST variable if it is a GDG it will have wither + or - sign in first position so i removed that by using SUBSTR and the checking whether it is a NUMERIC or CHARACTER...if it is NUMERIC then it shows that it is GDG and so it will iterate through the loop.

But i tried with PARSE statement earlier today for the same issue if in case it is PS file then it would not have any open or close parenthesis... then in that case i should move my dataset to the stem variable....

here in above case it will just iterate through the loop if it is GDG but what if it is a PS file......what line should i add here in the code for that....
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2546
Location: Silicon Valley

PostPosted: Tue Feb 11, 2014 11:34 pm
Reply with quote

I think you should use PARSE VAR instead of PARSE VALUE.

You discard the first character of the POST variable, but I think that first character is the most important part.

Your code will fail when it is PDS like this:
Code:
DSN=my.pds(A12)

It will fail because it will proceed as though it was a GDG.

Quote:
but what if it is a PS file......what line should i add here in the code for that....

What happens when you try it? What is in your POST variable when you have a sequential dataset?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Feb 11, 2014 11:47 pm
Reply with quote

installing on Your PC open object REXX available here
sourceforge.net/projects/oorexx/

will let You prototype ALL the computing logic of Your rexx scripts on Your PC
Back to top
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Wed Feb 12, 2014 7:05 am
Reply with quote

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
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Wed Feb 12, 2014 11:14 am
Reply with quote

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...... icon_sad.gif

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
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Wed Feb 12, 2014 11:40 am
Reply with quote

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
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Wed Feb 12, 2014 11:46 am
Reply with quote

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
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Wed Feb 12, 2014 12:51 pm
Reply with quote

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
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Wed Feb 12, 2014 1:04 pm
Reply with quote

Please post your Full code to help you further.
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Wed Feb 12, 2014 1:05 pm
Reply with quote

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
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Wed Feb 12, 2014 1:08 pm
Reply with quote

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
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Wed Feb 12, 2014 1:17 pm
Reply with quote

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
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Wed Feb 12, 2014 3:09 pm
Reply with quote

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
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2546
Location: Silicon Valley

PostPosted: Wed Feb 12, 2014 8:06 pm
Reply with quote

Please use a different forum thread when you ask a different question.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2546
Location: Silicon Valley

PostPosted: Wed Feb 12, 2014 8:16 pm
Reply with quote

Please provide a sample of your data.
Back to top
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Thu Feb 13, 2014 7:22 am
Reply with quote

You may use Translate built-in function to achieve your desire output.

You can find Here how to use Translate.
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Tue Feb 18, 2014 11:47 am
Reply with quote

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
View user's profile Send private message
TheMFKid

New User


Joined: 20 Nov 2013
Posts: 91
Location: India

PostPosted: Tue Feb 18, 2014 11:55 am
Reply with quote

You were asking the same question in another post.


www.ibmmainframes.com/viewtopic.php?p=320554&highlight=#320554
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Tue Feb 18, 2014 12:01 pm
Reply with quote

TheMFKid wrote:
You were asking the same question in another post.


www.ibmmainframes.com/viewtopic.php?p=320554&highlight=#320554


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..... icon_smile.gif
Back to top
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Tue Feb 18, 2014 1:43 pm
Reply with quote

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
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Tue Feb 18, 2014 2:23 pm
Reply with quote

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
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Tue Feb 18, 2014 2:26 pm
Reply with quote

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
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Tue Feb 18, 2014 2:48 pm
Reply with quote

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..... icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF Goto page 1, 2, 3  Next

 


Similar Topics
Topic Forum Replies
No new posts RACF - Rebuild SETROPTS command which... All Other Mainframe Topics 3
No new posts Routing command Address SDSF to other... TSO/ISPF 2
No new posts DTL - how to define key with stacked ... TSO/ISPF 3
No new posts LTJ command CA Products 4
No new posts Query on edit primary command CLIST & REXX 5
Search our Forums:

Back to Top