Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Go Back (F3) has to be automized

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
View previous topic :: :: View next topic  
Author Message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 159
Location: India

PostPosted: Tue May 06, 2014 12:30 pm    Post subject: Go Back (F3) has to be automized
Reply with quote

Hi All,
I have created a macro where the delete step will be inserted automatically in each member in a PDS when i give my PDS name. Though the delete step is inserteing properly in each JCL i will have to press F3 for each member until all the JCL members are completed. Is there any way where i can automate this process also... Please give me a suggestion where i can do this process automatically.
Please see my code below :

Code:

SAY "ENTER THE PDS NAME:"
PULL PDS
PDS = STRIP(PDS)
  X=SYSDSN("'"PDS"'")
  IF X = 'OK' THEN DO
  X = OUTTRAP('ML.')
   "LISTDS '"PDS"' MEMBERS"
    DO I=7 TO ML.0
       ML.I=STRIP(ML.I)
       ADDRESS ISPEXEC "EDIT DATASET('"PDS"("ML.I")') MACRO(DELSTP)"
    END
 X = OUTTRAP('OFF')
 END
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Tue May 06, 2014 12:48 pm    Post subject: Reply to: Go Back (F3) has to be automized
Reply with quote

if You had looked at the many edit macros posted You would not have had the need to ask
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 159
Location: India

PostPosted: Tue May 06, 2014 5:05 pm    Post subject: Re: Reply to: Go Back (F3) has to be automized
Reply with quote

enrico-sorichetti wrote:
if You had looked at the many edit macros posted You would not have had the need to ask


I searched for the same and got some information... Now what happens is If the delete step is not already present then the that paricular member is getting inserted with delete step and that member is not viewed but if already the delete step is present then that member is view. so that i will have to press F3 again to process with the next member. icon_sad.gif can you correct me where i am going wrong in my code.

Code:

SAY "ENTER THE PDS NAME:"
PULL PDS
PDS = STRIP(PDS)
  X=SYSDSN("'"PDS"'")
  IF X = 'OK' THEN DO
  X = OUTTRAP('ML.')
   "LISTDS '"PDS"' MEMBERS"
    DO I=7 TO ML.0
       ML.I=STRIP(ML.I)
       ADDRESS ISPEXEC "EDIT DATASET('"PDS"("ML.I")') MACRO(DELSTP)"
    END
 X = OUTTRAP('OFF')
 END

my Delete step macro is shown below :

Code:

/*REXX*/
TRACE(?R)
"ISREDIT MACRO"
TEMP="NEW,CATLG,DELETE"
TEMP2=",CATLG,DELETE"
SETVAR="SET"
CNTVAR=0
K=0
I=1
J=1
"ISREDIT SEEK ALL WORD '"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
CALL CHANGQUAL
/* THIS SUBPROGRAM INSERTS THE DELETE STEP IN THE JCL */
ERR=0
PRSNT=0
MTCH=0
NMTCH=0
INSLIN=K
TEMP1="EXEC"
"ISREDIT FIND FIRST WORD '"TEMP1"'"
IF RC=0 THEN DO
"ISREDIT (IDLN) = LINE .ZCSR"
"ISREDIT (IDNUM) = LINENUM .ZCSR"
"ISREDIT (NBR) = LINENUM .ZCSR"
 IF INDEX(IDLN,"IDCAMS") \=0 THEN DO
       R=1
        IDNUM=IDNUM+1
        CALL  ADDDEL
     END
     ELSE
       CALL INSERTSTP
 INSERTSTP:
 NBR2=NBR
 NBR1=NBR-1
 DO WHILE NBR1 > 0
 "ISREDIT CURSOR = "NBR1" 1"
 "ISREDIT (LN1) = LINE " NBR1
 SUBVAL=SUBSTR(LN1,1,3)
  IF SUBVAL == "//*" THEN DO
      CNTVAR=CNTVAR+1
      NBR2=NBR1
      NBR1=NBR1-1
  END
 ELSE
   LEAVE
END
"ISREDIT CURSOR = "NBR2" 1"
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
   IF INDEX(OUTPUT.I,'&') \= 0 THEN
     CALL CHANGQ
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
ADDDEL :
DO UNTIL SUBSTR(IDLN,1,2) == "/*"
"ISREDIT CURSOR = "IDNUM" 1"
"ISREDIT (IDLN) = LINE .ZCSR"
  IF INDEX(IDLN,"DELETE") \= 0 THEN DO
    INDEL.R = IDLN
    INDEL.R=STRIP(INDEL.R)
    PSTSPC=WORD(INDEL.R,2)
    INDEL.R = PSTSPC
    PRSNT=PRSNT+1
    IDNUM=IDNUM+1
    T=R
    R=R+1
  END
  ELSE DO
        ERR=ERR+1
        IDNUM=IDNUM+1
  END
END
DO W=1 TO K
  DO U=1 TO T
     IF COMPARE(OUTPUT.W,INDEL.U) == 0 THEN DO
       MTCH=MTCH+1
       LEAVE
     END
     ELSE
       NMTCH=NMTCH+1
  END
   IF NMTCH==T THEN DO
   C=R
   INDEL.R = OUTPUT.W
   R=R+1
   END
   NMTCH=0
   MTCH=0
 END
 Y=1
 DO WHILE C > T
    IF INDEX(INDEL.Y , '&') \= 0 THEN
           CALL CHANGQ
 OUTT='       ' || DELETE ||' ' || INDEL.C
 "ISREDIT (LNNM) = LINENUM .ZCSR"
 LNNM=LNNM-1
 "ISREDIT CURSOR = "LNNM" 1"
 "ISREDIT LINE_BEFORE .ZCSR = '"OUTT"' "
C=C-1
Y=Y+1
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 WORD '"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 WORD '"TEMP2"' "
END
RETURN
/* CHANGES ALL THE SYMBOLIC PARAMETER TO NORMAL VARIABLES */
CHNGSYMB:
L=1
DO WHILE CNTR > 0
IF RC=0 THEN DO
       "ISREDIT (LIN2) = LINE .ZCSR"
       IF INDEX(LIN2,'MAXCC=0') \= 0 THEN DO
         CNTR=CNTR-1
         RETURN
       END
       "ISREDIT (LIN21) = LINENUM .ZCSR"
       LINDIF=LIN21-1
       "ISREDIT (LINSET) = LINE " LINDIF
       IF INDEX(LINSET,'UPDATE') \= 0 THEN DO
         CNTR=CNTR-1
         RETURN
       END
       STEM1.L = STRIP(LIN2)
       PARSE VAR STEM1.L '//' 'SET' STEM2.L '=' STEM3.L
       STEM2.L=STRIP(STEM2.L)
       STEM3.L=STRIP(STEM3.L)
       FNDQ=STEM3.L
       IF INDEX(FNDQ,'&') \= 0 THEN DO
       CALL CHANGQ
       END
       LEN=LENGTH(STEM3.L)
       STR=SUBSTR(STEM3.L,LEN,1)
       IF STR = ',' THEN
            STEM3.L=SUBSTR(STEM3.L,1,LEN-1)
       L=L+1
       S=L
END
       "ISREDIT FIND NEXT WORD '"SETVAR"' "
       RETCODE=RC
       IF RETCODE=4 THEN DO
        IF CNTR=1 THEN DO
         CALL SINGLESET
         LEAVE
        END
       END
       CNTR=CNTR-1
END
RETURN
CHANGQUAL:
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)
  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)
    END
END
RETURN
/* CHANGE ALL QUALIFIERS ONLY WHEN SINGLE SET IS PRESENT */
SINGLESET:
NUMB=0
L=S
DO WHILE L>0 THEN
     "ISREDIT (NUMB) = LINENUM .ZCSR"
     "ISREDIT (SGLMAX) = LINE .ZCSR"
     IF INDEX(SGLMAX,'MAXCC') \= 0 THEN
        RETURN
     IF INDEX(SGLMAX,'UPDATE') \= 0 THEN
        RETURN
     NUMB=NUMB+1
     "ISREDIT CURSOR = "NUMB" 1"
     "ISREDIT (STMT) = LINE .ZCSR"
     STEM3.L=STRIP(STMT)
     LEN=LENGTH(STEM3.L)
  IF SUBSTR(STEM3.L,LEN,1) = ',' THEN DO
     PARSE VAR STEM3.L '//' STEM2.L '=' STEM3.L ','
     STEM2.L=STRIP(STEM2.L)
     L=L+1
  END
  ELSE
    LEAVE
END
PARSE VAR STEM3.L '//' STEM2.L '=' STEM3.L ','
     STEM2.L=STRIP(STEM2.L)
     STEM3.L=STRIP(STEM3.L)
RETURN
CHANGQ:
ZM=L-1
DO Z=1 TO ZM
   STRG='&'||STEM2.Z||'.'
   POSTN=POS(STRG,STEM3.L)
   IF POSTN = 1 THEN
      STEM3.L=STEM3.Z||SUBSTR(STEM3.L,LENGTH(STRG)+1)
   IF POSTN > 1 THEN
      STEM3.L=SUBSTR(STEM3.L,1,POSTN-1)||STEM3.Z||SUBSTR(STEM3.L,POSTN+,
                 LENGTH(STRG))
END
ZMT=L-1
DO LT=1 TO ZMT
  STRG='&'||STEM2.LT
  POSTN=POS(STRG,STEM3.L);
   IF POSTN = 1 THEN
      STEM3.L=STEM3.LT||SUBSTR(STEM3.L,LENGTH(STRG)+1)
   IF POSTN > 1 THEN
      STEM3.L=SUBSTR(STEM3.L,1,POSTN-1)||STEM3.LT||SUBSTR(STEM3.L,POSTN,
                 +LENGTH(STRG))
END
RETURN
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Tue May 06, 2014 5:18 pm    Post subject:
Reply with quote

Here is a hint....

What command does pf3 perform?

When you want to issue other commands (like find for example),
what format do you use?

Maybe you want to issue the pf3 command just before you exit your macro?
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 159
Location: India

PostPosted: Tue May 06, 2014 5:29 pm    Post subject:
Reply with quote

daveporcelan wrote:
Here is a hint....

What command does pf3 perform?

When you want to issue other commands (like find for example),
what format do you use?

Maybe you want to issue the pf3 command just before you exit your macro?


I tried using IF ZPFKEY='PF03' then EXIT,By initializing ZPFKEY to PF03 before... but what happens is it comes out of the entire PDS after processing the macro in the first member.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Tue May 06, 2014 5:48 pm    Post subject: Reply to: Go Back (F3) has to be automized
Reply with quote

the coding as posted is pretty difficult to understand ...

You forgot about

- proper alignment
- proper indentations
- the existence of lower case letters
- ... ... ...

so do not expect anybody to go thru it

the only reason for having to hit PF3 is that the edit macro ends
without issuing an
Address ISREDIT "END"

REVIEW THE FLOW OF THE MACRO
BEHAVIOR TESTED AND VERIFIED
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Tue May 06, 2014 9:28 pm    Post subject: Reply to: Go Back (F3) has to be automized
Reply with quote

I know that You will not appreciate it ...
but in the code You posted

there is an Address ISREDIT END missing
( or the coding is FUBAR )

in subroutine/function ADDDEL

Quote:
"ISREDIT LINE_BEFORE .ZCSR = '"OUTT"' "
C=C-1
Y=Y+1
END
EXIT
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 159
Location: India

PostPosted: Wed May 07, 2014 11:57 am    Post subject: Re: Reply to: Go Back (F3) has to be automized
Reply with quote

enrico-sorichetti wrote:
I know that You will not appreciate it ...
but in the code You posted

there is an Address ISREDIT END missing
( or the coding is FUBAR )

in subroutine/function ADDDEL

Quote:
"ISREDIT LINE_BEFORE .ZCSR = '"OUTT"' "
C=C-1
Y=Y+1
END
EXIT


Ya I missed it my mistake dint look at the macro properly was looking like the problem will be with the rexx code alone.... Thank you so much..... icon_smile.gif icon_smile.gif Completed my tool....Once again thanks for helping.....
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Need a JCL to change the volume back ... Manikandesvaran D JCL & VSAM 10 Tue Oct 14, 2014 9:06 pm
No new posts Parse a String and divide it by 2 and... magesh23586 CLIST & REXX 6 Fri Feb 07, 2014 11:34 pm
No new posts Setting check pending status back for... gylbharat DB2 7 Wed Jul 17, 2013 2:30 pm
No new posts Passing data from Rexx to Cobol and r... dsivapradeep CLIST & REXX 9 Fri Mar 22, 2013 12:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us