/* Edit Macro: ONLY.SPF Purpose: Performs converse of EXCLUDE command, where the current edit session is searched and all lines that DO NOT contain the specified search criterion are excluded. Usage: Takes any valid arguments as specified for the FIND command except ALL. Note: As coded, the macro below is unneccessarily complex. Most of the code below is for error checking and displaying responses as short messages in the upper right hand corner of the screen. The real code that does the work is: 'isredit macro(string)' 'isredit exclude all' 'isredit find all' string */ 'isredit macro' parse arg string if (string="") then do /* need to have at least one parameter */ zedsmsg = "NO PARAMETER SPECIFIED" zedlmsg = "THE ONLY MACRO REQUIRES A SEARCH PARAMETER" 'ispexec setmsg msg(isrz000)' return; end /* check for leading quote without closing qoute or quote only */ if ((substr(string,1,1) = "'") & (substr(string,length(string),1) <> "'")), | ((substr(string,1,1) = '"') & (substr(string,length(string),1) <> '"')), | (string = "'" & length(string) = 1) | (string = '"' & length(string) = 1) then do /* MISSING CLOSE QUOTE */ 'ispexec setmsg msg(isre031)' return; end else do 'isredit exclude all' 'isredit find all 'string end /* count the number of values found */ 'isredit (fcount1, fcount2) = find_counts' if fcount1+0 = 1 then do zedsmsg = '1 LINE DISPLAYED' zedlmsg = "ONLY "string" CAUSED 1 LINE TO BE SHOWN" end else do zedsmsg = fcount1+0 'LINES DISPLAYED' zedlmsg = "ONLY "string" CAUSED "fcount1+0" LINES TO BE SHOWN" end /* display short message as set up by the ZEDSMSG/ZEDLMSG combo */ 'ispexec setmsg msg(isrz000)'