OpenVMS Source Code Demos

When Apache CGI can't write a symbol (like HTTP_COOKIE), it switches over to multi-line logical names. This function will attempt to read a SYMBOL, and if it is not found, will check for single-line or multi-line logical names. 

WCSM_Get_Symbol.fun

	!==========================================================================================
	! Title  :      wcsm_get_symbol_xxx.fun
	! Author :      Dave McNeil
	! History:
	! ver  who when   what
	! ---- --- ------ --------------------------------------------------------------------------
	!    1 DGM 070504 Big Bang
	!      NSR 101007 2. added a few comments
	!==========================================================================================
	!	Prototype:
	!		function string wcsm_get_symbol(string symbol$)
	!	Arguments:
	!		string symbol$	- Symbol to be resolved
	!	Returns:
	!		The value of the desired symbol or "" if symbol does not exist
	!       Purpose:
	!		This function 
	!==========================================================================================
	function string wcsm_get_symbol(string symbol$)				!
	option type=explicit							!
	%include "lib$routines" %from %library "sys$library:basic$starlet"	! lib$
	!
	declare string result$							!
	declare long rc%, index%, max_index%					!
	declare word result_length%						!
	declare string table$, temp$						!
	!=======================================================================
	!	main
	!=======================================================================
	main:
	rc% = LIB$GET_SYMBOL(symbol$, result$)					! read the symbol
	if (rc% and 7%) <> 1%							! if not successful
	then									!
	    result$ = ""							!
	    table$ = "LNM$PROCESS_TABLE"					!
	    call lib$get_logical(symbol$, temp$, result_length%, table$, max_index%, index%,)
	    if max_index% > -1%							! if symbol overflowed into multi-line logicals...
	    then								!
		for index% = 0% to max_index%					! step thru logcial names
		    call lib$get_logical(symbol$, temp$, result_length%, table$, max_index%, index%,)
		    result$ = result$ + temp$					! concat
		next index%							!
	    end if								!
	end if									!
	!
	wcsm_get_symbol = edit$(result$, 128)					! discard trailing spaces and tabs.
	end function								!

Back to OpenVMS
Back to Home
Neil Rieck
Kitchener - Waterloo - Cambridge, Ontario, Canada.