/* REXX */ /* */ /* AUTHOR: Mark Zelden */ /* */ /* This edit macro allows the user to EDIT */ /* the data set located on the line that the */ /* cursor is on. */ /* */ /* The cursor can be anywhere on a line that */ /* has DSN= or DSNAME= but must be at the */ /* start of the data set name if there is */ /* no DSN= or DSNAME=. */ /* */ /* Last updated on 10/15/2002 */ /* TRACE ?R */ Address ISREDIT "MACRO" Address ISPEXEC "CONTROL ERRORS RETURN" Address ISPEXEC "VGET ZENVIR" ZIVER = Substr(ZENVIR,6,1) /* get ISPF version */ If ZIVER >= 4 then do /* check ISPF version */ Address ISPEXEC "VGET ZPCFMCN PROFILE" /* get confirm setting */ If ZPCFMCN == '/' then CONF = 'YES' Else CONF = 'NO' End /* if ZIVER */ /***********************************************/ /* BEGIN PROCESSING */ /***********************************************/ "(row,col) = CURSOR" "(data1) = LINE " row /* data1 = cursor line */ /**********************************/ /* Find start of data set name */ /**********************************/ dsnstart = Pos('DSN=',data1) /* look for DSN= */ If dsnstart = 0 then do /* no DSN = */ dsnstart = Pos('DSNAME=',data1) /* look for DSNAME= */ If dsnstart = 0 then do /* no DSN= or DSNAME= */ "CURSOR = " row col /* cursor pos */ If col < 1 then dsnstart = 1 /* needed for ZE line cmd */ Else dsnstart = col /* assume cursor on DSN */ End Else dsnstart = dsnstart + 7 /* DSNAME= specified in JCL */ End /* if dsnstart = 0 */ Else dsnstart = dsnstart + 4 /* DSN = specified in JCL */ /**********************************/ /* Find end of data set name */ /**********************************/ dsnend = Pos(',',data1,dsnstart) /* look for comma at end of dsn */ If dsnend = 0 then do /* no comma found */ dsnend = Pos(' ',data1,dsnstart) /* look for blank to end DSN */ If dsnend = 0 then do /* no blank or comma at end */ zedsmsg = 'No end of DSN' zedlmsg = 'The data set name is not terminated with a' , 'space or comma.' Address ISPEXEC "SETMSG MSG(ISRZ001)" /* msg - with alarm */ "CURSOR = " row col /* put cursor back to last position */ Exit 8 End /* if dsnend = 0 */ Else dsnend = dsnend - 1 /* DSN ends with blank */ End /* if dsnend = 0 */ Else dsnend = dsnend - 1 /* DSN ends with comma */ /**********************************/ /* EDIT the data set */ /**********************************/ dsn = Substr(data1,dsnstart,dsnend-dsnstart+1) /* extract dsn */ dsn = Strip(Translate(dsn,"","'")) /* remove quotes if used */ editok = 'NOTOK' Do while editok = 'NOTOK' Address ISPEXEC "EDREC QUERY" If RC = 4 then do Address ISPEXEC "DISPLAY PANEL(ISREDM02)" DISPRC = RC Address ISPEXEC "VGET ZVERB" If DISPRC = 0 then do If ZEDCMD = '' then , Address ISPEXEC "EDREC PROCESS PASSWORD("PSWD")" If ZEDCMD = 'C' then address ISPEXEC "EDREC CANCEL" If ZEDCMD = 'D' then address ISPEXEC "EDREC DEFER" End /* if RC = 0 */ Else if DISPRC = 8 & ZVERB = 'CANCEL' then , Address ISPEXEC "EDREC CANCEL" Else do "CURSOR = " row col /* put cursor back to last position */ Exit 0 End End /* if RC = 4 */ Else editok = 'OK' End /* do while editok */ RC = 0 If editok = 'OK' & ZIVER >= 4 then do Address ISPEXEC "EDIT DATASET('"dsn"') CONFIRM("conf")" If RC = 4 then RC = 0 End If editok = 'OK' & ZIVER < 4 then do Address ISPEXEC "EDIT DATASET('"dsn"')" If RC = 4 then RC = 0 End If RC <> 0 then Address ISPEXEC "SETMSG MSG("ZERRMSG")" "CURSOR = " row col /* put cursor back to last position */ Exit 0