/* REXX */ /* */ /* AUTHOR: Mark Zelden */ /* */ /* Last Updated 08/23/2007 */ /***************************************************************/ /* SW Edit Macro - Switch from VIEW to EDIT or visa versa */ /***************************************************************/ /* Execution syntax: */ /* */ /* SW or SW FORCE (FORCE may be abbreviated, e.g. SW F) */ /* */ /* Note: */ /* If data has been changed you must either SAVE the data */ /* first or use the FORCE option. Any changes made will be */ /* lost when using FORCE. FORCE me be abbeviated using one */ /* or more of its characters, for example: SW F. */ /* */ /* Also note that using this macro on a sequential data set */ /* requires the use of XVIEW and XEDIT also available from */ /* CBT file 434 and my web site. */ /* */ /***************************************************************/ Address ISREDIT "MACRO (opt)" "(DSN) = DATASET" "(MBR) = MEMBER" "(SES) = SESSION" "(DCHG) = DATA_CHANGED" OPT = Translate(OPT) /* ensure upper case */ If ses = 'EDIF' | ses = 'VIIF' then do zedsmsg = 'Can''t switch from' ses zedlmsg = 'This macro can''t be used when the session is' , 'using the ISPF' ses 'interface.' Address ISPEXEC "SETMSG MSG(ISRZ001)" /* msg - with alarm */ Exit 12 End If OPT <> '' & Abbrev('FORCE',OPT,1) <> 1 then do zedsmsg = 'Invalid option' zedlmsg = 'The only valid option is "FORCE". FORCE may be' , 'abbreviated using one or more of its characters.' Address ISPEXEC "SETMSG MSG(ISRZ001)" /* msg - with alarm */ Exit 12 End If DCHG = 'NO' | , (DCHG = 'YES' & Abbrev('FORCE',OPT,1) = 1) then do If MBR <> '' then do If ses = 'VIEW' then "EDIT" mbr else "VIEW" mbr If RC = 4 then RC = 0 If RC <> 0 then do Address ISPEXEC "SETMSG MSG("ZERRMSG")" Exit 8 End End /* if MBR */ Else do "(VOL) = VOLUME" If ses = 'VIEW' then Address TSO "%XEDIT '"dsn"'" vol else Address TSO "%XVIEW '"dsn"'" vol End "CANCEL" /* cancel out of mbr originally edited/viewed */ End /* if DCHG = 'YES' & Abbrev('FORCE',OPT,1) = 1 */ Else do zedsmsg = 'Data changed: SAVE/FORCE' zedlmsg = 'If data has been changed you must either SAVE the data' , 'first or use the FORCE option. Any changes made will be', 'lost when using FORCE. FORCE may be abbreviated using' , 'one or more of its characters, for example: SW F.' Address ISPEXEC "SETMSG MSG(ISRZ001)" /* msg - with alarm */ Exit 12 End