'set novalue on' /* force KEXX and its way of SIGNAL ON NOVALUE */ /* Usage: MACRO EXTRACT argument */ /* Examples: MACRO EXTRACT /color arrow/=/arb/ */ /* MACRO EXTRACT /block/macro ascii/last */ /* Option: SYNONYM EXTract 3 MACRO EXTRACT */ /* Purpose: Command EXTract works only within macros, not */ /* on the command line. Macro EXTRACT shows the */ /* possible results of command EXTract. Operands */ /* have to be delimited and can be abbreviated: */ /* MACRO EXTRACT /SYN/=/MACRO ASCII/VAR/ */ /* reports SYNONYM.1, EQUALSIGN.1, and EXTRACT.1, */ /* but not VARBLANK.1, just like command EXTract. */ /* Special: Macro EXTRACT uses 'nomsg query VAR' to get the */ /* variable names set by 'command extract /VAR/', */ /* (e.g. VARBLANK.0 etc.). But 'nomsg query REXX' */ /* reports error 153 (rc 99) if no external REXX */ /* interpreter is loaded. This is now handled as */ /* special case, similar problems are reported. */ /* Caveat: Kedit 5.0 DIALOG shows only upto 10 lines and */ /* certain long results like MACRO EXTRACT /ATTR/ */ /* or MACRO EXTRACT /RING/ won't work as expected. */ /* See also: KHELP EXTRACT, KHELP QUERY MACRO, KHELP = */ /* Requires: Kedit 5.0 or KeditW 1.0 (Frank Ellermann, 2000) */ /* (2004) */ LONG = 20 ; if version.1() = 'KEDIT' then LONG = 13 LINE = '' ; WORD = '' WHAT = '' ; STOP = left( strip( arg( 1 )), 1 ) if \ datatype( STOP, 'A' ) then parse arg (STOP) WHAT if WHAT <> '' then do until WHAT = '' parse var WHAT NEXT (STOP) WHAT 'nomsg query' NEXT ; WORD = translate( word( NEXT, 1 )) if rc = 0 then do /* RING and MACRO are okay */ I = translate( word( lastmsg.1(), 1 )) if abbrev( I || ' ' , WORD ) then WORD = I if abbrev( 'SYNONYM ', WORD, 3 ) then WORD = 'SYNONYM' end /* WORD = variable name */ else if rc <> 5 then do /* query REXXversion error */ I = 'REXXVERSION' /* (if REXX not available) */ if abbrev( I || ' ' , WORD, 4 ) then WORD = I end 'extract' STOP || NEXT || STOP if WORD = '=' then WORD = 'EQUALSIGN' else if rc = 5 then WORD = 'EXTRACT' else if rc = 0 then nop else leave I = VALUE( WORD || '.0' ) if datatype( I, 'w' ) then do I = 0 to I NEXT = WORD || '.' || I LINE = LINE || d2c(10) || left( NEXT, LONG ) VALUE( NEXT ) end else do /* variable name not found */ STOP = "'command EXTRACT" STOP || NEXT || STOP || "'" 'emsg' STOP 'has not set variable' WORD || '.0' ; exit 4 end /* REXXVERSION error fixed */ if WORD = 'EXTRACT' then leave /* rc 5 terminates EXTRACT */ end else 'extract' arg( 1 ) /* show any error message */ if WORD = 'EXTRACT' then say WORD 'rc 5' WHAT = 'EXTRACT' strip( arg( 1 )) 'dialog' delimit( strip( LINE,, d2c(10))) 'title' delimit( WHAT ) exit rc VALUE: 'novalue off' ; interpret 'VALUE =' arg( 1 ) 'novalue on' ; return VALUE