/*
	clonevar

*!  VERSION 1.0.0  14oct2010

*/

VERSION 11.0

INCLUDE _std_small
DEFINE _dlght 150
INCLUDE header

HELP hlp1, view("help clonevar")
RESET res1

DIALOG main, label("clonevar - Clone existing variable") tabtitle("Main")
BEGIN
  TEXT tx_newvar		_lft	_top	_cwd1	.,		///
	label("New variable name:")
  EDIT ed_newvar		@	_ss	_vnwd	.,		///
	label("New variable name")
  
  TEXT tx_oldvar		_lft2	_top	_cwd1	.,		///
	label("Existing variable to clone:")
  VARNAME  vn_oldvar		@	_ss	_vnwd	.,		///
	label("Existing variable to clone")
END

INCLUDE ifin

PROGRAM command
BEGIN
	if ! main.ed_newvar.isvalidname() {
		stopbox stop `"The new variable name you specified is invalid."'
	}
	if main.ed_newvar.isvarname() {
		stopbox stop `"The new variable name you specified already exists."'
	}
	put "clonevar "
	varlist main.ed_newvar
	put " = "
	varlist main.vn_oldvar

	put " " /program ifin_output		
END
