OpenVMS Source Code Demos

SHOW_DEFAULT_DEMO

1000	!=======================================================================
	! title  : show_default_demo.bas
	! author : Neil Rieck
	! created: 2015.07.10
	! notes  : this is the program-equivalent of DCL's "$show default"
	!=======================================================================
	option type=explicit							!
	!
	%include "starlet"	%from %library "sys$library:basic$starlet"	!
        %include "lib$routines"	%from %library "sys$library:basic$starlet"      ! lib$
        %include "$libdef"	%from %library "sys$library:basic$starlet"      ! eg. lib$_normal
	%include "$psldef"	%from %library "sys$library:basic$starlet"	! psl$
	!
	declare string		path$			,			&
				dev$			,			&
		word		x			,			&
		long		rc			,			&
		byte		access_mode					!
	map(whatever)string	yada = 99
	!
	main:									!
    %let %method=1								!
    %if  %method=1 %then							!
	rc = LIB$GET_LOGICAL("SYS$DISK", dev$,, "LNM$PROCESS_TABLE")		! should be supervisor mode
    %else									!
	access_mode = PSL$C_SUPER						! we only want supervisor mode
	rc = LIB$GET_LOGICAL("SYS$DISK", dev$,, "LNM$PROCESS_TABLE",,,access_mode,)
    %end %if									!
	if ((rc and 7%) <> 1) then						!
	    print "-e-LIB$GET_LOGICAL-rc:";rc					!
	    goto fini								!
	end if									!
	!
	rc = SYS$SETDDIR(,x,yada)						!
	if ((rc and 7%) <> 1) then						!
	    print "-e-SYS$SETDDIR-rc:";rc					!
	    goto fini								!
	end if									!
	!
	path$ = dev$ + left$(yada,x)						!
	print "-i-default: "+ path$						!
	!
	fini:									!
	end program rc								!