/*
  import sasxport

*! VERSION 1.0.0  12may2011

*/

VERSION 12.0

INCLUDE _std_medium
DEFINE _dlght 290
INCLUDE header

HELP hlp1, view("help import sasxport")
RESET res1

DIALOG main,								///
label("import sasxport - Import SAS XPORT Transport file") tabtitle("Main")
BEGIN
 GROUPBOX gb_syntax		_lft	_top	_iwd	_ht4,		///
	label("Syntax")
  RADIO rb_import		_indent	_ss	_inwd	., first	///
	onclickon(script main_import_on)				///
	label("Import contents of SAS XPORT Transport file")
  RADIO rb_describe		@	_ss	@	., last		///
	onclickon(script main_describe_on)				///
	label("Describe contents of SAS XPORT Transport file")
  TEXT tx_file			_lft	+45	_iwd	.,		///
	label("Filename:")
  FILE fi_file			@	_ss	@	.,		///
	filter(SAS XPORT (*.xpt)|*.xpt|All Files (*.*)|*.*)		///
	error("Filename")						///
	label("Browse...")

  GROUPBOX gb_options		@	+35	@	_ht9h,		///
	label("Options")
  CHECKBOX ck_clear		_indent	_ss	_inwd	.,		///
	label("Replace data in memory")					///  
	option(clear)
  CHECKBOX ck_novallab		@	_ms	@	.,		///
	option(novallabels) 						///
	label(`"Ignore accompanying "formats.xpf" file if it exists"')
  CHECKBOX ck_member		@	_ms	@	.,		///
	onclickon(script main_member_on)				///
	onclickoff(script main_member_off)				///
	label(`"" *.xpt " file has multiple members"')

  EDIT ed_member		_indent	_ss	_vnwd	.,		///
	option(member)							///
	label("Member")
  TEXT tx_member		_vnsep	@	_vnwd	.,		///
	label("Member")
END

SCRIPT main_import_on
BEGIN
	main.gb_options.setposition . . . 120
	main.ck_clear.show
	main.ck_novallab.show
	main.ck_member.setposition . 220
	main.ed_member.setposition . 240
	main.tx_member.setposition . 240
END

SCRIPT main_describe_on
BEGIN
	main.gb_options.setposition . . . 70
	main.ck_clear.hide
	main.ck_novallab.hide
	main.ck_member.setposition . 170
	main.ed_member.setposition . 190
	main.tx_member.setposition . 190
END

SCRIPT main_member_on
BEGIN
	main.tx_member.enable
	main.ed_member.enable
END

SCRIPT main_member_off
BEGIN
	main.tx_member.disable
	main.ed_member.disable
END

PROGRAM command
BEGIN
	put "import sasxport "
	require main.fi_file
	put `"""' main.fi_file `"""'
	beginoptions
		if main.rb_import {
			option main.ck_clear
			option main.ck_novallab
		}
		if main.rb_describe {
			put " describe"
		}
		if main.ck_member {
			require main.ed_member
			optionarg main.ed_member
		}
	endoptions
END
