/************************************************************************ * NAME : GET XEDIT * AUTHOR : MJS-ADIS Mark J. Short * CREATE DATE: 08/03/89 * * The macro in normal mode will do a get like documented in CMS XEDIT * Reference. * * The .options allow specialized gets for DCF, SAS, and maclibs. * * The prefix macro does a get after the line it is typed on. It will * do a GET from memory if it is entered as GET M in the prefix area or * if no filename is specified by the prompt. * ************************************************************************* * USERID : MJS-ADIS Mark J. Short * DATE : 08/22/90 * FLAG : 900822 * * DESCRIPTION: Added code to allow gettms to do other types than 'SCRIPT' * Put in a MSG for RC=3, spill/trunc warning ************************************************************************* * USERID : MJS-ADIS Mark J. Short * DATE : 12/16/91 * FLAG : 911216 * * DESCRIPTION: Changed to use windowing functions * added recall for filename, filetype, filemode, etc... ************************************************************************* * USERID : MJS-ADIS Mark J. Short * DATE : 03/18/92 * FLAG : 031892 * * DESCRIPTION: msg for rc=4 no more storage ************************************************************************/ trace 'o' /* 082290 start */ arg subfunc getfile getfiletype . 1 args 1 . maclib member '(' . /* 082290 end */ arg pref func pline op extra grc = 0 'EXTRACT/MACRO/LINE/CURLINE/CURSOR/MSGMODE/SIZE/FNAME/FTYPE/FMODE/' oldsize = size.1 Select when subfunc = '?' then Call Help /* 082290 start */ when subfunc = '.DCF' then 'MACRO GETTMS' getfile getfiletype /* 082290 end */ when subfunc = '.MAC' then 'MACRO GMAC' maclib member when subfunc = '.TMS' then 'MACRO GETTMS' getfile when subfunc = '.DCFX' then 'MACRO GETDOC' getfile 'X' when subfunc = '.SAS' then 'MACRO SASGET' getfile 'N' when subfunc = '.SASR' then 'MACRO SASGET' getfile 'R' when subfunc = '.CAL' then do address command 'ERASE $TEMP $CAL A' address command 'EXEC GETCAL' delword(args,1,1) 'MACRO GET $TEMP $CAL A' address command 'ERASE $TEMP $CAL A' end otherwise do /* normal get */ parse source . . . . . byname . if find('G GETM',byname) > 0 then op = 'M' if pref = 'PREFIX' & func = 'SET' & datatype(pline,'W') then do "extract/curline/cursor/msgmode/size/" /* following allows it to be used from a pfkey */ if pline = '' then pline = cursor.3 if pline < 0 then exit 3 ":"pline if op = 'M' then do "GET" address command "EXEC CLICKER GET MEMORY" grc = rc end else do parse upper value, GETFNWIN() with gfn '15'x gft '15'x gfm, '15'x gst '15'x gle if gfn]]gft]]gfm = '' then do gst = '' gle = '' end else do if gfn = '' & (gft <> '' ] gfm <> '') then gfn = fname.1 if gfn <> '' & gft = '' then gft = ftype.1 if gft <> '' & gfm = '' then gfm = fmode.1 if gst = '' then gst = 1 if gle = '' then gst = '*' end fnftfm =, strip(gfn) strip(gft) strip(gfm) strip(gst) strip(gle) if gfm <> "CANCEL" then "GET" fnftfm else do "msgmode" msgmode.1 address xedit "MSG Get was cancelled" end grc = rc end end else do /* we will eventually get to this point */ parse var args tfn tft tfm rargs if tfn = '=' then tfn = fname.1 if tft = '=' then tft = ftype.1 if tfm = '=' then tfm = fmode.1 targs = tfn tft tfm rargs = subword(args,4) goodpick = 1 if index(targs,'*') > 0 then do getlist = BLDFILEL(targs) if getlist <> '' then do if tfn = '$BANNER' then address command 'VMFCLEAR' src = ScrolWin('Pick a File to GET & Press ENTER|', 'PF3-Cancel |PINK|WHITE|||', getlist'||27') address command 'ERASE TEMP FILEL A' pull targs if src > 12 then src = src - 12 if targs <> '' & src <> 3 then args = targs rargs else do address xedit MSG 'Get was cancelled' goodpick = 0 end end else do address xedit MSG 'No files found matching' targs goodpick = 0 end end else nop if goodpick then do "msgmode off" address XEDIT 'COMMAND GET' args grc = rc if index(word(args,1),'KEY') >0] word(args,2) = 'SHELL' then address command "EXEC CLICKER GET" subword(args,1,2) "msgmode" msgmode.1 if args = '' then args = 'MEMORY' if find('0 1 3 4',grc) > 0 then do "extract/size/" nlines = size.1-oldsize if nlines = 1 then phr = 'line was' else phr = 'lines were' address xedit MSG nlines phr "inserted from" args, "after line" line.1 /* 082290 start */ if grc = 3 then do 'extract/spill/' if spill.1 = 'OFF' then spilled = 'TRUNCATED' address xedit 'EMSG Warning, lines have been' spilled end /* 082290 end */ /* 031892 start */ if grc = 4 then address xedit 'EMSG Warning, No more storage to insert lines' /* 031892 end */ end else address xedit 'EMSG Nothing to get from' args end end end /* otw */ end /* sel */ return grc /* pop up a window and read it */ GetFNWin: procedure trace 'o' emsg = '' CRow = 1 /* default cursor postions */ CField = 1 COff = 1 topline = 'Press ENTER to GET file' botline = 'PF3/12 to Cancel PF6 Retrieve' nl = '15'x nf = '05'x na = '01'x WindowName = WindIO('%CREATE%%%6%28') fn = ' ' ft = ' ' fm = ' ' st = '1' le = '*' do until find('0 3 12',KeyHit) > 0 & emsg = '' if keyhit = 6 then do /* retrieve last get/put info */ address command 'GLOBALV SELECT $GETPUT$ GET FN' address command 'GLOBALV SELECT $GETPUT$ GET FT' address command 'GLOBALV SELECT $GETPUT$ GET FM' address command 'GLOBALV SELECT $GETPUT$ GET ST' address command 'GLOBALV SELECT $GETPUT$ GET LE' end l.1 = 'TEXT'na'Enter File Name'na'TURQ'nf'DATA'na]]fn]]na'8'na, 'Y'na'UND'nl l.2 = 'TEXT'na' Type'na'TURQ'nf'DATA'na]]ft]]na'8'na, 'Y'na'UND'nl l.3 = 'TEXT'na' Mode'na'TURQ'nf'DATA'na]]fm]]na'1'na, 'Y'na'UND'nl l.4 = 'TEXT'na' First Line'na'TURQ'nf'DATA'na]]st]]na'5'na, 'W'na'UND'nl l.5 = 'TEXT'na' How Many Lines'na'TURQ'nf'DATA'na]]le]]na'5'na, 'W'na'UND'nl l.6 = 'TEXT'na]]emsg]]na'RED'na'UND' RetString = WindIO('%READ%'WindowName'%'topline'%'botline'%BLUE', '%'CRow'%'CField'%'COff'%'l.1]]l.2]]l.3]]l.4]]l.5]]l.6) parse upper var RetString KeyHit '15'x CRow CField COff '15'x, fn '15'x ft '15'x fm '15'x st '15'x le if KeyHit > 12 then KeyHit = KeyHit - 12 emsg = '' if find('0 3 6 12',KeyHit) > 0 then nop else emsg = 'PF'keyhit 'is not defined' end if find('3 12',KeyHit) > 0 then fm = 'CANCEL' else if (fn ft fm) <> '' then address command 'GLOBALV SELECT $GETPUT$ PUTP FN FT FM ST LE' drc = WindIO('%DELETE%'WindowName) return fn '15'x ft '15'x fm '15'x st '15'x le Help: Say ' This macro can be invoked by saying GET fn >' Say 'It can also be invoked to do special processing by typing' Say 'GET <.dcf ] .mac ] .dcfx ] .sas ] .sasr> fn >' Say ' These are special options that are application dependent.' Say 'It can be invoked from the PREFIX area in 2 ways. By typing' Say 'GET you will be prompted for a fn . You can also say' Say 'GETM, which will do a get from memory. When invoked from the' Say 'prefix area the current line will not change!' return