OpenVMS Source Code Demos

FTP_MULTI_STACK_SCRIPTING_DEMO2

$!=================================================================================
$! title  : ftp_multi_stack_scripting_demo2.com
$! author : Neil Rieck
$! created: 2015-07-12
$! notes  :
$! 1) TCPware passes username and password "positionally" on the FTP command line
$! 2) MultiNet and "TCPIP Services" support command line switches "/user" + "/pass"
$! 3) TCPIP Services will upcase anything not double-quoted
$!=================================================================================
$ set noon						! do not stop
$ say :== write sys$output				!
$ say "-i-script: ",f$environment("PROCEDURE")		!
$!------------------------------------------------------
$ dest	= "kawc3w.on.bell.ca"				! Solaris-8
$ user	= "ibam"					!
$ pass	= "ibam2005"					!
$!------------------------------------------------------
$ dq[0,8]=34						! double quote
$ stack = 0						! init
$ if f$trnlnm("TCPIP$EXAMPLES") .nes. ""		! best choice?
$ then							!
$	say "-i-detected: TCPIP Services"		!
$	stack = stack .or. 1				!
$endif							!
$ if f$trnlnm("MULTINET") .nes. ""			!
$ then							!
$	say "-i-detected: MultiNet"			!
$	stack = stack .or. 2				!
$ endif							!
$ if f$trnlnm("TCPWARE") .nes. ""			!
$ then							!
$	say "-i-detected: TCPware"			!
$	stack = stack .or. 4				!
$ endif							!
$ stamp = f$cvtime() - ":" -":" -"-" -"-" -" " -"."	! eg. 2015081113241543
$ cmdfs	= "ftp_"+ stamp +".com"				! eg. ftp_2015081113241543.com
$!------------------------------------------------------
$	open/write cmdbuf	'cmdfs'			! build a command file
$	write cmdbuf	"$set verify"
$	write cmdbuf	"$set noon"
$ if ((stack .and. 4) .eq. 4)				! TCPware
$ then							!
$	say "-i-using TCPware variant"			!
$	write cmdbuf	"$ftp ",dest," ",user," ",pass
$	goto continue_build				!
$ endif							!
$ if ((stack .and. 2) .eq. 2)				! MultiNet
$ then							!
$	say "-i-using MultiNet variant"			!
$	write cmdbuf	"$ftp ",dest," /user=",user,"/pass=",pass
$	goto continue_build				!
$ endif							!
$	say "-i-using TCPIP SERVICES variant"		! TCPIP Services
$	write cmdbuf	"$ftp ",dest," /username=",dq,user,dq," /password=",dq,pass,dq
$continue_build:					!
$	write cmdbuf	"$deck"				! batch stuff
$	write cmdbuf	"dir"
$	write cmdbuf	"asc"
$	write cmdbuf	"put ftp_multi_stack_scripting_demo2.com"
$	write cmdbuf	"dir"
$	write cmdbuf	"bye"
$	write cmdbuf	"$eod"				! batch stuff
$	write cmdbuf	"$my_saved_status = $STATUS"	!
$	write cmdbuf	"$write sys$output my_ftp_status"
$	write cmdbuf	"$exit 'my_ftp_status'"		!
$	close cmdbuf					!
$	@'cmdfs'					! execute the script
$	my_saved_status = $STATUS			!
$	write sys$output my_saved_status		!
$fini:
$	if (f$length(cmdfs).ge.10)			!
$	then
$		del/nolog/noconfirm	'cmdfs';
$	endif
$	exit