(defun file_dat_r_g_w (mode variable value / patch file data_list); mode "r"-чтение "w"-запись "g"-запросить, записать и вернуть
  (setq patch (strcat *geo_tools_user_dat_dir* "\\data\\baza.dat"))
  (if (not(file_check patch))
    (file_write_list_to_file patch (list "100" "500" "100.000" (strcat *geo_tools_user_dat_dir* "\\Template\\blank.sht") "Лист1" "ГОСТ" "Нет"))
    );mv mg usl_z patch_sh name_layout shtamp_type flag_back_model
  (setq data_list(file_read_to_list patch))
  (cond
    ((eq mode "w")
     (cond
       ((eq variable "mv")
	(setq data_list(edit_replase_in_list_eliment_be_number (rtos value 2 0) 1 data_list))
	)
       ((eq variable "mg")
	(setq data_list(edit_replase_in_list_eliment_be_number (rtos value 2 0) 2 data_list))
	)
       ((eq variable "usl_z")
	(setq data_list(edit_replase_in_list_eliment_be_number (rtos value 2 3) 3 data_list))
	)
       ((eq variable "patch_sh")
	(setq data_list(edit_replase_in_list_eliment_be_number value 4 data_list))
	)
       ((eq variable "name_layout")
	(setq data_list(edit_replase_in_list_eliment_be_number value 5 data_list))
	)
       ((eq variable "shtamp_type")
	(setq data_list(edit_replase_in_list_eliment_be_number value 6 data_list))
	)
       ((eq variable "flag_back_model")
	(setq data_list(edit_replase_in_list_eliment_be_number value 7 data_list))
	)
       )
     (file_write_list_to_file patch data_list)
     )
    ((eq mode "g")
     (cond
       ((eq variable "mv")
	(initget)(setq value (getreal (strcat "\nВведи числитель вертикального масштаба <1:"(rtos mv 2 0)"> 1:")))
	(if (eq value nil)(setq value mv))
	(setq data_list(edit_replase_in_list_eliment_be_number (rtos value 2 0) 1 data_list)))
       ((eq variable "mg")
	(initget)(setq value (getreal (strcat "\nВведи числитель горизонтально масштаба <1:"(rtos mg 2 0)"> 1:")))
	(if (eq value nil)(setq value mg))
	(setq data_list(edit_replase_in_list_eliment_be_number (rtos value 2 0) 2 data_list)))
       ((eq variable "usl_z")
	(initget)(setq value (getreal (strcat "\nВведи отметку условного горизонта <"(rtos usl_z 2 2)">: ")))
	(if (eq value nil)(setq value usl_z))
	(setq data_list(edit_replase_in_list_eliment_be_number (rtos value 2 3) 3 data_list)))
       )
     (file_write_list_to_file patch data_list)
     (cond
       ((eq variable "mv")(atof(nth 0 data_list)))
       ((eq variable "mg")(atof(nth 1 data_list)))
       ((eq variable "usl_z")(atof(nth 2 data_list)))
       ((eq variable "patch_sh")(nth 3 data_list))
       ((eq variable "name_layout")(nth 4 data_list))
       ((eq variable "shtamp_type")(nth 5 data_list))
       ((eq variable "flag_back_model")(nth 6 data_list))
       )
     )
    ((eq mode "r")
     (cond
       ((eq variable "mv")(atof(nth 0 data_list)))
       ((eq variable "mg")(atof(nth 1 data_list)))
       ((eq variable "usl_z")(atof(nth 2 data_list)))
       ((eq variable "patch_sh")(nth 3 data_list))
       ((eq variable "name_layout")(nth 4 data_list))
       ((eq variable "shtamp_type")(nth 5 data_list))
       ((eq variable "flag_back_model")(nth 6 data_list))
       )
     )
    )
  )
