Article 170503 of comp.os.vms:
In article <1997May23.101134@cjis.ci.lincoln.ne.us>, tech@cjis.ci.lincoln.ne.us (Tim Travis/City of Lincoln I.S./402-441-7763) writes:
> Does anyone know how I can get the first item from the RECALL buffer
> while in a command procedure (which should be the command line that
> executed the command procedure) and set that to a variable I can
> test?
> 
> TIA
> 
> Tim

Hi Tim,

Try the following simple program.  It will move the last command into a 
local DCL symbol, COMMAND_LINE.

;++
; Copyright © 1997 Brian Schenkenberger and TMESIS.
; ALL RIGHTS RESERVED.
;                            Notice of Disclaimer
;                         -------------------------
; 
; This Software is provided "AS IS" and is supplied for informational purpose
; only.  No warranty is expressed or implied and no liability can be accepted
; for any direct, indirect or consequential damages or for any damage whatso-
; ever resulting in the loss of systems, data or profit from the use of this
; software or from any of the information contained herein.  The author makes
; no claims as to the suitablility or fitness of this Software or information
; contain herein for any particular purpose.  
;
;                         Redistribution or Copying
;                         -------------------------
; Permission is hereby granted *ONLY* for the "not-for-profit" redistribution
; of this software provided that ALL SOURCE and/or OBJECT CODE remains intact
; and ALL COPYRIGHT NOTICES and NOTICES OF DISCLAIMER remain intact from its 
; original distribution.
;
; A fee may be levied for the media upon which the software is redistributed 
; provided that the fee charged is for the media and the production costs of
; the media and that the cost associated is clearly stated.
;
;                         Execution of the Software 
;                         -------------------------
; Any proper copy of this Software obtained within the guidelines expressed
; in the section above entitiled, "Redistribution or Copying" may be used on
; any CPU so desired by the proper recipient of the copy. 
;
;                            Title and Ownership
;                         -------------------------
; NO TITLE TO AND/OR OWNERSHIP OF THIS SOFTWARE IS HEREBY TRANSFERRED.  ANY
; MODIFICATION WITHOUT THE PRIOR WRITTEN CONSENT OF THE COPYRIGHT HOLDER IS
; PROHIBITED.
;--
	.TITLE	GET_CMD_LINE	; ditty to load last command into DCL symbol
	.IDENT	/V01.00/	; COMMAND_LINE

;++
; To Build:
; On VAX:	$ MACRO GET_CMD_LINE
;		$ LINK	GET_CMD_LINE,SYS$SYSTEM:SYS.STB,SYS$SYSTEM:DCLDEF.STB
;
; On Alpha:	$ MACRO GET_CMD_LINE
;		$ LINK	GET_CMD_LINE,SYS$LOADABLE_IMAGES:DCLDEF.STB/SYSEXE
;--

	.EXTRN	LIB$K_CLI_LOCAL_SYM
	.EXTRN	LIB$K_CLI_GLOBAL_SYM

;++
.SBTTL	Library and Include symbol file definitions
;--
	.LIBRARY	"SYS$LIBRARY:STARLET.MLB"       ; look here for:

	$DSCDEF
      	$LIB$ROUTINESDEF


	.PSECT	DATA,WRT,NOEXE,5
CMD:	.LONG	<DSC$K_CLASS_S@<DSC$B_CLASS@3>>!-
		<DSC$K_DTYPE_T@<DSC$B_DTYPE@3>>
	.ADDRESS .+4
	.BYTE	^x20[256]

SYMBOL:	.ASCID	"COMMAND_LINE"

	.PSECT	CODE,NOWRT,EXE,LONG
	.ENTRY	GET_CMD_LINE,0

	MOVAB	@#CTL$AG_CLIDATA,R1	; get address of the PPD
	MOVL	PPD$L_PRC(R1),R1	; and the adr of CLI own storage
	MOVL	PRC_L_RECALLPTR(R1),R1	; get last command recall pointer
	MOVZBL	-(R1),R0		; get length of the last command
	MOVW	R0,CMD			; store it in the CMD descriptor
	MNEGL	R0,R0			; negate command length to index
	MOVAB	(R1)[R0],R1		; get address of start of command
	MOVC3	CMD,(R1),@CMD+4		; copy it to the CMD descriptor

	$LIB_SET_SYMBOL_S -
		SYMBOL=SYMBOL,-
		VALUE_STRING=CMD,-
		TABLE_TYPE_INDICATOR=#LIB$K_CLI_LOCAL_SYM
	RET
	.END	GET_CMD_LINE


-- 
VAXman-                                                     VAXman@TMESIS.COM

Behold, he travaileth with iniquity, and hath conceived mischief, and brought
forth falsehood.   He made a pit, and digged it, and is fallen into the ditch
which he made.   His mischief shall return upon his own head, and his violent
dealing shall come down upon his own pate.               -- Psalms 7:14-16 --


