	function dix_con_is_filler(control,nbit,offset,typ,data,lun)
	implicit none
c
c Return true if data is all filler
c
	integer*4 control
	integer*4 nbit			!:i: #bits
	integer*4 offset		!:i: offset in data
	integer*4 typ			!:i: datatype
	byte data(*)			!:i: the data
	integer*4 lun			!:i: lun for usetyped functions
	logical*4 dix_con_is_filler	!:f: return true if filler
c#
	include 'dix_def.inc'
c
	character*(max_str_len) line 
	integer*4 nkar,nb_f
c
	logical*4 dix_con_intasc
	record /des_rec/ des_rec	!:i: description
c##
	des_rec.ent_type = typ
	des_rec.size = nbit
	call dix_util_clear_descr(des_rec.fldnam,.false.)
c
	des_rec.bit_offset = offset
	des_rec.flags = des_flag_translate_nor
	des_rec.lun_translate = lun
c
c Let con_int_intasc solve the problem (but in hex mode)
c
	dix_con_is_filler = .not. dix_con_intasc(nbit/bits_per_byte,
     1                         des_rec,data,line,
     1                         nkar,.false.,nb_f,control)
	return
	end
c
	subroutine dix_con_type_intasc(nk,data,type,value,nkar,control)
	implicit none
	include 'dix_def.inc'
c
c A simplified interface to dix_con_intasc
c
	integer*4 nk		!:i: length of data
	byte data(*)		!:i: the data
	integer*4 type		!:i: the type
	character*(*) value	!:o: the string
	integer*4 nkar		!:o: length
	record /control/ control!:i: contro l block
c#
	record /des_rec/ des_rec
	integer*4 k
c
c
	des_rec.ent_type = type
	call dix_util_clear_descr(des_rec.fldnam,.false.)
	des_rec.bit_offset = 0
	des_rec.size = nk*bits_per_byte
	des_rec.flags = des_flag_translate_nor
	call dix_con_intasc(nk,des_rec,data,value,nkar,.false.,
     1                       k,control)
	return                     
	end

	function dix_con_intasc(max_size,des_rec,data,value,nkar,hex,
     1                          max_len,control)
	implicit none
c
c Convert data from binary to ascii in all modes
c
	include 'dix_def.inc'
	integer*4 max_size		!:i: size of remaining data
	record /des_rec/ des_rec	!:i: description
	byte data(*)			!:i: the data
	character*(*) value		!:o: the text
	integer*4 nkar			!:o: the size
	logical*4 hex			!:i: hex translation wanted
	integer*4 max_len		!:o: max length needed for ascii
	record /control/ control
	logical*4 dix_con_intasc	!:f: if true than nonempty
c#
	integer*4 nk,typ,temp(2),nk2,offs,limit
	integer*4 conmask,nb_reserved
	logical stat,variable
c
c The conversion routines per type
c
	logical*4 dix_con_int_intasc,dix_con_real_f_intasc
	logical*4 dix_con_real_g_intasc,dix_con_real_h_intasc
	logical*4 dix_con_real_d_intasc,dix_con_real_s_intasc
	logical*4 dix_con_real_t_intasc,dix_con_real_x_intasc
	logical*4 dix_con_log_intasc,dix_con_dat_intasc
	logical*4 dix_con_uic_intasc,dix_con_bits_intasc
	logical*4 dix_con_chr_intasc,dix_con_str_intasc
	logical*4 dix_con_uint_intasc,dix_con_lstr_intasc
	logical*4 dix_con_zstr_intasc,dix_con_hstr_intasc
	logical*4 dix_con_hex_intasc,dix_con_prot_intasc
	logical*4 dix_con_oct_intasc,dix_con_vfc_intasc
	logical*4 dix_con_revint_intasc,dix_con_fid_intasc
	logical*4 dix_con_wstr_intasc,dix_con_bin_intasc
	logical*4 dix_con_diskmap_intasc
	logical*4 dix_con_decimal_intasc
	logical*4 dix_con_identifier_intasc
	logical*4 dix_con_acl_intasc,dix_inter_execute
c
	logical*4 overflow
        common /dix_con_common/ overflow
	external dix_con_overflow
c
	typ = des_rec.ent_type
	nk = min((des_rec.size+bits_per_byte-1)/bits_per_byte,max_size)
	value = ' '
c
	offs = des_rec.bit_offset/bits_per_byte+1
	overflow = .false.
c
	nk2 = 1
	if(des_rec.size .gt.  1*bits_per_byte) nk2 = 2
	if(des_rec.size .gt.  2*bits_per_byte) nk2 = 3
	if(des_rec.size .gt.  3*bits_per_byte) nk2 = 4
	if(des_rec.size .gt.  4*bits_per_byte) nk2 = 8
	if(nk2 .gt. max_size) nk2 = max_size
	if(hex .ne. des_flag_translate_nor) then
	  conmask = hex
	else
	  conmask = (des_rec.flags .and. des_flag_translate_mask)
	endif
	variable = (des_rec.flags .and. des_flag_is_variable) .ne. 0
	nb_reserved = (des_rec.flags .and. des_flag_nb_reserved_mask)	
c
	if(conmask .ne. des_flag_translate_nor) then
c
c Explicit hex asked, or the description line contains /hex or something like that
c
	  if(conmask .eq. des_flag_translate_hex) then
	    stat   = dix_con_hex_intasc(des_rec.bit_offset,
     1                  des_rec.size,data,nk,value,nkar,typ,max_len)
	  elseif(conmask .eq. des_flag_translate_bin) then
	    stat   = dix_con_bin_intasc(des_rec.bit_offset,
     1                  des_rec.size,data,nk,value,nkar,max_len)
	  elseif(conmask .eq. des_flag_translate_oct) then
	    stat   = dix_con_oct_intasc(des_rec.bit_offset,
     1                  des_rec.size,data,nk,value,nkar,max_len)
	  endif
	else
c
c Normal conversion
c
	  if    (typ .eq. enttyp_int) then
	    call dix_util_copy_bits(des_rec.size,des_rec.bit_offset,data,
     1                temp,nk2)
	    stat = dix_con_int_intasc(nk2,temp,value,nkar,
     1                                des_rec.fldnam,control)
	    max_len = 60
	  elseif(typ .eq. enttyp_uint) then
	    call dix_util_copy_bits(des_rec.size,des_rec.bit_offset,data,
     1                temp,nk2)
	    stat = dix_con_uint_intasc(nk2,temp,value,nkar,
     1                                 des_rec.fldnam,control)
	    max_len = 60
	  elseif(typ .eq. enttyp_bits .or. typ .eq. enttyp_rbits) then
	    stat = dix_con_bits_intasc(des_rec.size,
     1                     des_rec.bit_offset,data,value,nkar,
     1                     des_rec.fldnam,
     1                     typ .eq. enttyp_rbits)
	    max_len = len(value)
	  elseif(typ .eq. enttyp_log .or. typ .eq. enttyp_rlog) then
	    call dix_util_copy_bits(des_rec.size,des_rec.bit_offset,data,
     1                temp,nk2)
	    stat = dix_con_log_intasc(nk2,temp,value,nkar,des_rec.fldnam,
     1                     typ .eq. enttyp_rlog)
	    max_len = 60
	  elseif(typ .eq. enttyp_real_f) then
	    stat = dix_con_real_f_intasc(nk,data(offs),value,nkar,control)
	    max_len = 60
	  elseif(typ .eq. enttyp_real_g) then
	    stat = dix_con_real_g_intasc(nk,data(offs),value,nkar,control)
	    max_len = 60
	  elseif(typ .eq. enttyp_real_h) then
	    stat = dix_con_real_h_intasc(nk,data(offs),value,nkar,control)
	    max_len = 60
	  elseif(typ .eq. enttyp_real_x) then
	    stat = dix_con_real_x_intasc(nk,data(offs),value,nkar,control)
	    max_len = 60
	  elseif(typ .eq. enttyp_real_d) then
	    stat = dix_con_real_d_intasc(nk,data(offs),value,nkar,control)
	    max_len = 60
	  elseif(typ .eq. enttyp_real_s) then
	    stat = dix_con_real_s_intasc(nk,data(offs),value,nkar,control)
	    max_len = 60
	  elseif(typ .eq. enttyp_real_t) then
	    stat = dix_con_real_t_intasc(nk,data(offs),value,nkar,control)
	    max_len = 60
	  elseif(typ .eq. enttyp_dat .or. 
     1           typ .eq. enttyp_cpu .or.
     1           typ .eq. enttyp_deltatime) then
	    stat = dix_con_dat_intasc   (nk,data(offs),value,nkar,
     1                                            typ,
     1                                des_rec.fldnam,control)
	    max_len = 60
	  elseif(typ .eq. enttyp_uic) then
	    stat = dix_con_uic_intasc   (nk,data(offs),value,nkar)
	    max_len = 60
	  elseif(typ .eq. enttyp_identifier) then
	    stat = dix_con_identifier_intasc(nk,data(offs),
     1                    value,nkar)
	    max_len = 60
	  elseif(typ .eq. enttyp_prot) then
	    stat = dix_con_prot_intasc   (nk,data(offs),value,nkar)
	    max_len = 60
	  elseif(typ .eq. enttyp_fid) then
	    stat = dix_con_fid_intasc   (nk,data(offs),value,nkar)
	    max_len = 60
	  elseif(typ .eq. enttyp_vfc) then
	    stat = dix_con_vfc_intasc   (nk,data(offs),value,nkar)
	    max_len = 60       
	  elseif(typ .eq. enttyp_revint) then
	    stat = dix_con_revint_intasc (nk,data(offs),value,nkar,control)
	    max_len = 60
	  elseif(typ .eq. enttyp_udecimal) then
	    stat = dix_con_decimal_intasc(nk,data(offs),value,nkar,.true.,
     1              des_rec.flags)
	    max_len = des_rec.size/bits_per_byte 
	  elseif(typ .eq. enttyp_decimal) then
	    stat = dix_con_decimal_intasc(nk,data(offs),value,nkar,.false.,
     1              des_rec.flags)
	    max_len = des_rec.size/bits_per_byte 
	  elseif(typ .eq. enttyp_chr) then
	    stat = dix_con_chr_intasc   (nk,data(offs),value,nkar,
     1                        control.include_binary,control.mode)
	    max_len = des_rec.size/bits_per_byte - nb_reserved
	    if(variable) max_len = len(value)
	  elseif(typ .eq. enttyp_string) then
	    limit = nk*bits_per_byte
	    call dix_des_get_real_size(typ,limit,data(offs),0,control)
	    nk = limit/bits_per_byte
	    stat = dix_con_str_intasc   (nk,data(offs),value,nkar,
     1                        control.include_binary,control.mode)
	    max_len = des_rec.size/bits_per_byte - nb_reserved
	    if(variable) max_len = len(value)
	    des_rec.act_size = (nk-nb_reserved)*bits_per_byte
	  elseif(typ .eq. enttyp_wstring) then
	    limit = nk*bits_per_byte	
	    call dix_des_get_real_size(typ,limit,data(offs),0,control)
	    nk = limit/bits_per_byte
	    stat = dix_con_wstr_intasc  (nk,data(offs),value,nkar,
     1                        control.include_binary,control.mode)
	    max_len = des_rec.size/bits_per_byte - nb_reserved
	    if(variable) max_len = len(value)
	    des_rec.act_size = (nk-nb_reserved)*bits_per_byte
	  elseif(typ .eq. enttyp_lstring) then
	    limit = nk*bits_per_byte	
	    call dix_des_get_real_size(typ,limit,data(offs),0,control)
	    nk = limit/bits_per_byte
	    stat = dix_con_lstr_intasc  (nk,data(offs),value,nkar,
     1                        control.include_binary,control.mode)
	    max_len = des_rec.size/bits_per_byte - nb_reserved
	    if(variable) max_len = len(value)
	    des_rec.act_size = (nk-nb_reserved)*bits_per_byte
	  elseif(typ .eq. enttyp_zstring) then
	    limit = nk*bits_per_byte	
	    call dix_des_get_real_size(typ,limit,data(offs),0,control)
	    nk = limit/bits_per_byte
	    stat = dix_con_zstr_intasc  (nk,data(offs),value,nkar,
     1                        control.include_binary,control.mode)
	    max_len = des_rec.size/bits_per_byte - nb_reserved
	    if(variable) max_len = len(value)
	    des_rec.act_size = (nk-nb_reserved)*bits_per_byte
	  elseif(typ .eq. enttyp_hstring) then
	    limit = nk*bits_per_byte	
	    call dix_des_get_real_size(typ,limit,data(offs),0,control)
	    nk = limit/bits_per_byte
	    stat = dix_con_hstr_intasc  (nk,data(offs),value,nkar,
     1                        control.include_binary,control.mode)
	    max_len = des_rec.size/bits_per_byte - nb_reserved
	    if(variable) max_len = len(value)
	    des_rec.act_size = (nk-nb_reserved)*bits_per_byte
	  elseif(typ .eq. enttyp_diskmap) then
	    limit = nk*bits_per_byte	
	    call dix_des_get_real_size(typ,limit,data(offs),0,control)
	    nk = limit/bits_per_byte
	    stat = dix_con_diskmap_intasc(nk,data(offs),value,nkar)
	    des_rec.act_size = (nk)*bits_per_byte
	    max_len = 60
	  elseif(typ .eq. enttyp_acl) then
	    limit = nk*bits_per_byte	
	    call dix_des_get_real_size(typ,limit,data(offs),0,control)
	    nk = limit/bits_per_byte
	    stat = dix_con_acl_intasc(nk,data(offs),value,nkar)
	    des_rec.act_size = (nk)*bits_per_byte
	    max_len = 60
	  elseif(typ .eq. enttyp_user) then
	    stat = dix_inter_execute(control,'BINASC',des_rec.lun_translate,
     1          des_rec.size,des_rec.fldnam,nk,data(offs),
     1          nkar,%ref(value),nk2)
	  endif
c
c VAX overflow returns a fault and the call stack is skipped
c 
	  if(overflow) then
	    value = 'Overflow'
	    nkar = 8
	  endif	    
	endif
c
c Return found size
c
	max_len = min(max_len,len(value))
	dix_con_intasc = stat
	return
	end                                     

	function dix_con_int_intasc(nk,data,value,nkar,fldnam,control)
	implicit none
c
	include 'dix_def.inc'
c
c conversio routine for signed integers
c
	integer*4 nk		!:i: length of data
	byte data(*)		!:i: the data
	character*(*) value	!:o: the text
	integer*4 nkar		!:o: text length
	character*(*) fldnam	!:i: List of fields
	record /control/ control
	logical*4 dix_con_int_intasc	!:f: true if no skip else false
c#
c local vars
c
	integer*4 nk1
	integer*4 int8(2)
	logical*4 ok
c
	character*(max_int_asc_length) temp
	logical*4 dix_util_get_field

	integer*4 dix_util_get_len_fu
c
	int8(1) = 0
	int8(2) = 0
	temp = ' '
	call dix_util_copy(nk,data,int8)
	dix_con_int_intasc = (int8(1) .ne. 0) .or. (int8(2) .ne. 0)
	if(nk .le. 4) then
c
c Check if field is present
c
	  ok = .false.
	  if(fldnam .ne. ' ') then
	    ok = dix_util_get_field(int8(1),fldnam,temp,nkar)
	  end if
	  if(.not. ok) then
	    if(control.format_integer4 .eq. default_format_integer4) then
	      call ots$cvt_l_ti(int8(1),temp(1:12),%val(1),%val(nk))
	      nkar = 12
	    else
	      write(temp,control.format_integer4,err=10) int8(1)
10	      nkar = dix_util_get_len_fu(temp)
	    endif
	    call dix_util_left_just(temp,nkar)
	  end if
	else
c
c Vax does not have the int*8 mode, so display it as a list of 2 int*4
c
	  if(control.platform .eq. platform_vax) then
	    if(control.format_integer4 .eq. default_format_integer4) then
	      call ots$cvt_l_ti(int8(1),temp(1:12),%val(1),%val(4))
	      nkar = 12
	    else
	      write(temp,control.format_integer4,err=12) int8(1)
12	      nkar = dix_util_get_len_fu(temp)
	    endif
	    call dix_util_left_just(temp,nkar)
	    nkar = nkar+1
	    temp(nkar:nkar) = ','
	    nk1 = nkar
c
	    if(control.format_integer4 .eq. default_format_integer4) then
	      call ots$cvt_l_ti(int8(2),temp(nkar+1:nkar+12),%val(1),%val(4))
	      nkar= 12
	    else
	      write(temp,control.format_integer4,err=14) int8(2)
14	      nkar = dix_util_get_len_fu(temp)
	    endif
c
	    call dix_util_left_just(temp(nkar+1:nkar+12),nkar)
	    nkar = nk1+nkar
	  else
c
c Alpha/ia64 have int*8, so use native
c
	    temp = ' '
	    if(control.format_integer8 .eq. default_format_integer8) then
	      call ots$cvt_l_ti(int8,temp,%val(1),%val(8))
	      nkar = len(temp)
	    else
	      call dix_con_i8_intasc(control,int8,temp)
	      nkar = dix_util_get_len_fu(temp)
	    endif
	    call dix_util_left_just(temp,nkar)
	  endif
	end if
	value = temp
	return
	end

	function dix_con_uint_intasc(nk,data,value,nkar,fldnam,control)
	implicit none
c
	include 'dix_def.inc'
c
c conversio routine for unsigned integers
c
	integer*4 nk		!:i: length of data
	byte data(*)		!:i: the data
	character*(*) value	!:o: the text
	integer*4 nkar		!:o: text length
	character*(*) fldnam	!:i: field names
	record /control/ control
	logical*4 dix_con_uint_intasc	!:f: true if no skip else false
c#
c local vars
c
	integer*4 nk1
	integer*4 int8(2)
	logical*4 ok
c
	character*(max_int_asc_length) temp
	logical*4 dix_util_get_field
	integer*4 dix_util_get_len
c
	int8(1) = 0
	int8(2) = 0
	temp = ' '
	call dix_util_copy(nk,data,int8)
	dix_con_uint_intasc = (int8(1) .ne. 0) .or. (int8(2) .ne. 0)
	if(nk .le. 4) then
	  ok = .false.
	  if(fldnam .ne. ' ') then
	    ok = dix_util_get_field(int8(1),fldnam,temp,nkar)
	  end if
	  if(.not. ok) then
	    call ots$cvt_l_tu(int8(1),temp(1:12),%val(1),%val(nk))
	    nkar = 12
	    call dix_util_left_just(temp,nkar)
	  end if
	else
	  if(control.platform .eq. platform_vax) then
	    call ots$cvt_l_tu(int8(1),temp(1:12),%val(1),%val(4))
	    nkar = 12
	    call dix_util_left_just(temp,nkar)
	    nkar = nkar+1
	    temp(nkar:nkar) = ','
	    nk1 = nkar
	    call ots$cvt_l_tu(int8(2),temp(nkar+1:nkar+12),%val(1),%val(4))
	    nkar= 12
	    call dix_util_left_just(temp(nkar+1:nkar+12),nkar)
	    nkar = nk1+nkar
	  else
	    temp = ' '
	    call ots$cvt_l_tu(int8,temp,%val(1),%val(8))
	    nkar = dix_util_get_len(temp)
	  endif
	end if
	value = temp
	return
	end

	function dix_con_log_intasc(nk,data,value,nkar,fldnam,reverse)
	implicit none
c
c convert logicals
c
	include 'dix_def.inc'
c
	integer*4 nk		!:i: length of data
	byte data(*)		!:i: the data
	character*(*) value	!:O: the dix_conerted text
	integer*4 nkar		!:o: length of text
	character*(*) fldnam	!:i: fieldnames
	logical*4 reverse	!:i: value reversed?
	logical*4 dix_con_log_intasc	!:f: true if not compressed
c#
	nkar = nk		!prevent unused message
	nkar = %loc(fldnam)	!prevent unused
c
	if(data(1) .xor. reverse) then
	  value = true_name
	  nkar = len(true_name)
	else
	  value = false_name
	  nkar =  len(false_name)
	end if
	dix_con_log_intasc = data(1)
	return
	end
c

	function dix_con_dat_intasc(nk,data,value,nkar,typ,
     1                              fldnam)
	implicit none
c
c convert vms date (4 or 8 bytes long) or cputime *4
c Date format can be *8 (normal vms date)
c                 or *4 (vmsdate/60000000 = #minutes sinc 1857)
c
	include 'dix_def.inc'
	integer*4 nk		!:i: data length
	byte data(*)		!:i: the data
	character*(*) value	!:O: the text
	integer*4 nkar		!:o: the text length
	integer*4 typ 		!:i: date or cpu time or deltatime
	character*(*) fldnam	!:i: fieldnames
	logical*4 dix_con_dat_intasc	!:F: true if not copmpressed
c#
	integer*4 vmsdat(2),temp(2)
	logical*4 ok
	logical*4 dix_util_get_field
c
	vmsdat(1) = 0
	vmsdat(2) = 0
c
	if(typ .eq. enttyp_cpu) then
c
c Is cputime value, integer*4, make it deltatime
c
	  call lib$emul(data,-10*1000*10,0,vmsdat)	!delta time
	else
c
c Enttyp_dat or enttyp_deltatime
c
	  if(nk .le. 4) then
	    call lib$emul(data,600000000,0,vmsdat)
	  else
	    call dix_util_copy(nk,data,vmsdat)
	  endif
	endif
c
c Return the "empty" value
c
	dix_con_dat_intasc = (vmsdat(1) .ne. 0) .or. (vmsdat(2) .ne. 0)
c
c See if value has special name
c  only if high longowrd has the same value as low longword
c so 0,0 or 1,1 or -1,-1 etc
c
	ok = .false.
	if(fldnam .ne. ' ') then
	  if(nk .eq. 8) then
c
c See if the data is limited to 32 bits
c  Sign extend the low (longword) and see if the data
c  in the high longword is equal
c
	     temp(1) = vmsdat(1)
             call dix_util_sign_extend(temp)
	     if(temp(2) .ne. vmsdat(2)) goto 10
	  endif
	  ok = dix_util_get_field(vmsdat(1),fldnam,value,nkar)
	end if
c
10	if(.not. ok) then
c
c Default conversion
c
	  nkar = 0			!asctim delivers only integer*2
c
c I found a problem in the sys$asctim on the VAX
c  if the string has a length of > 32376, sys$asctim will
c  not return the time field, so we limit the string to 24 chars
c
	  call sys$ASCtim(nkar,value(1:24),vmsdat,)
	endif
	call dix_util_left_just(value,nkar)
	return
	end
c

	function dix_con_uic_intasc(nk,data,value,nkar)
	implicit none
c
	include 'dix_def.inc'
c
c convert UIC
c
	integer*4 nk		!:i: data length
	byte data(*)		!:i: the data
	character*(*) value	!:o: the converted text
	integer*4 nkar		!:o: lenngth of text
	logical*4 dix_con_uic_intasc	!:f: True if not compressed
c#
	integer*4 uic,nk1
c
	character*(max_uic_asc_length) tline
c
	uic = 0
	call dix_util_copy(nk,data,uic)
	dix_con_uic_intasc = uic .ne. 0
c
	nkar = 0			!idtoasc delivers only integer*2
	call sys$fao('!%I',nkar,value,%val(uic))
	nk1 = 0
	call sys$fao('!%U',nk1, tline,%val(uic))
	if(value(1:nkar) .ne. tline(1:nk1)) then
	  value(nkar+1:) = ' = '//tline(1:nk1)
	  nkar = nkar +3 + nk1
	endif
	call dix_util_left_just(value,nkar)
	return
	end
	function dix_con_identifier_intasc(nk,data,value,nkar)
	implicit none
c
c convert UIC
c
	integer*4 nk		!:i: data length
	byte data(*)		!:i: the data
	character*(*) value	!:o: the converted text
	integer*4 nkar		!:o: lenngth of text
	logical*4 dix_con_identifier_intasc	!:f: True if not compressed
c#
	integer*4 sys$idtoasc
c
	integer*4 id
c
	call dix_util_copy(nk,data,id)
	dix_con_identifier_intasc = id .ne. 0
c
	nkar = 0			!idtoasc delivers only integer*2
	call sys$idtoasc(%val(id),nkar,value,,,)
	call dix_util_left_just(value,nkar)
	return
	end

	function dix_con_revint_intasc(nk,data,value,nkar,control)
	implicit none
c
c convert integer with words reversed (only *4)
c
	integer*4 nk		!:i: data length
	byte data(*)		!:i: the data
	character*(*) value	!:o: the converted text
	integer*4 nkar		!:o: lenngth of text
	integer*4 control	!:i: control block
	logical*4 dix_con_revint_intasc	!:f: True if not compressed
c#
	logical*4 dix_con_int_intasc
c
	integer*2 data2(2)
c
c Swap high/low word
c
	call dix_util_copy(4,data,data2)
	call dix_util_swap(data2(1),data2(2))
	dix_con_revint_intasc = dix_con_int_intasc(nk,data2,value,
     1                          nkar,' ',control)
	return
	end
	function dix_con_fid_intasc(nk,data,value,nkar)
	implicit none
c
	include 'dix_def.inc'
c
c Convert file id to ascii (*6)
c
	integer*4 nk      		!:i: #bytes
	integer*2 data(3)		!:i: the data
	character*(*) value		!:o: the text
	integer*4 nkar			!:o: length of value
	logical*4 dix_con_fid_intasc	!:f: True if not compressed
c#
	integer*4 fnr,fseq,vol,tmp
	character*(max_fid_asc_length) temp
c
	vol = nk		!to prevent warnings
c
	fnr = zext(data(1))	!not in once integer*2 truncate
	tmp = iand(data(3),'FF00'X)
        tmp = ishft(tmp,8)
	fnr = fnr .or. tmp
	fseq = zext(data(2))
	vol = iand(data(3),'FF'X)
c
	nkar  = 0
	call sys$fao('(!UL,!UL,!UL)',nkar,temp,
     1              %val(fnr),%val(fseq),%val(vol))
	dix_con_fid_intasc = (fnr .ne. 0) .or. (fseq .ne. 0).or.(vol .ne. 0)
	nkar = min(nkar,len(value))
	value = temp(1:nkar)
	return
	end
	function dix_con_prot_intasc(nk,data,value,nkar)
	implicit none
c
	include 'dix_def.inc'
c
c convert file protection mask
c
	integer*4 nk		!:i: data length
	byte data(*)		!:i: the data
	character*(*) value	!:o: the converted text
	integer*4 nkar		!:o: lenngth of text
	logical*4 dix_con_prot_intasc	!:f: True if not compressed
c#
	integer*2 prot,k,l
	integer*4 prot_len
	parameter (prot_len=4)
	character*(prot_len) mask,types
	character*(max_prot_asc_length) temp
c
	prot = 0
	call dix_util_copy(nk,data,prot)
	dix_con_prot_intasc = prot .ne. 0
c
	mask  = 'RWED'
	types = 'SOGW'
	nkar = 0
	do k=0,3
	  temp(nkar+1:nkar+1) = types(k+1:k+1)
	  temp(nkar+2:nkar+2) = ':'
	  nkar = nkar + 2
	  do l=0,3
	    if(.not. btest(prot,k*4+l)) then
	      nkar = nkar + 1
	      temp(nkar:nkar) = mask(l+1:l+1)
	    end if
	  end do
	  if(k .ne. 3) then
	    temp(nkar+1:nkar+2) = ', '
	    nkar = nkar + 2
	  end if
	end do
	nkar = min(nkar,len(value))
	value = temp(1:nkar)
	return
	end

	function dix_con_bits_intasc(nbit,offset,data,value,nkar,
     1                     fldnam,reverse)
	implicit none
c
	include 'dix_def.inc'
c
c Convert bit string
c
	integer*4 nbit		!:i: #bits length
	integer*4 offset	!:i: Offset in databuffer
	byte data(*)		!:i: the data
	character*(*) value	!:o: the converted text
	integer*4 nkar		!:o: length of text
	character*(*) fldnam	!:i: list of field names
	logical*4 reverse	!:i: bits reversed??
	logical*4 dix_con_bits_intasc	!:F: true if not comppessed
c#
	integer*4 k,nk1
	byte temp,all_set,all_clr
c
	character*(max_short_line_length) tempasc
c
	logical*4 dix_util_get_field
c
	all_set = .true.
	all_clr = .true.

	do k=0,nbit-1
	  call dix_util_copy_bits(1,offset+k,data,temp,1)
	  if(reverse) temp = .not. temp
	  if(     temp) all_clr = .false.
	  if(.not.temp) all_set = .false.
	end do
	dix_con_bits_intasc = .not. all_clr
	if(.not. all_set) goto 1
	value = '%ALL'
	nkar = 4
	goto 90
c
1	nkar = 0
	do k=0,nbit-1
	  call dix_util_copy_bits(1,offset+k,data,temp,1)
	  if(reverse) temp = .not. temp
	  if(temp) then
	    if(.not. dix_util_get_field(k,fldnam,tempasc,nk1)) then
c
c Not found,in list, fill in fieldname in number format
c
	      call sys$fao('BIT!UL',nk1,tempasc,%val(k))
	    end if
c
c If name is #, skip this one
c
	    if(tempasc(1:nk1) .ne. '#') then
	      if(nkar+nk1 .lt. len(value)) then
	        value(nkar+1:nkar+nk1) = tempasc(1:nk1)
	        nkar = nkar + nk1 + 1
	        value(nkar:nkar) = ','
	      endif
	    endif
	  end if
	end do	    
	if(nkar .gt. 0) then
	  value(nkar:nkar) = ' '
	  nkar  = nkar-1
	end if
90	return
	end
c
	options /g_float
	function dix_con_real_f_intasc(nk,data,value,nkar,control)
	implicit none
c
c real conversion
c
	include 'dix_def.inc'
	integer*4 nk		!:i: data length
	byte data(*)		!:i: the data
	character*(*) value	!:o: the converted text
	integer*4 nkar		!:o: length of text
	record /control/ control!
	logical*4 dix_con_real_f_intasc	!:F: true if not compressed
c#
	real*4 real4
c
	logical*4 overflow
        common /dix_con_common/ overflow
c
	integer*4 dix_util_get_len_fu
	external dix_con_overflow
	volatile overflow
c
	real4 = 0.0
	call dix_util_copy(nk,data,real4)
c
	overflow = .false.
	call lib$establish(dix_con_overflow)
c
c Test for the overflow detection
c
	dix_con_real_f_intasc = real4 .ne. 0.0
	if(overflow) goto 60
	write(value,control.format_real4,err=10) real4
10	nkar = dix_util_get_len_fu(value)
	goto 90
60	value = 'Overflow'
	nkar = 8
90	call dix_util_left_just(value,nkar)
	return
	end
	options /g_float
	function dix_con_real_g_intasc(nk,data,value,nkar,control)
	implicit none
c
c real conversion
c
	include 'dix_def.inc'
	integer*4 nk		!:i: data length
	byte data(*)		!:i: the data
	character*(*) value	!:o: the converted text
	integer*4 nkar		!:o: length of text
	record /control/ control
	logical*4 dix_con_real_g_intasc	!:F: true if not compressed
c#
	real*8 real8
c
	logical*4 overflow
        common /dix_con_common/ overflow
	external dix_con_overflow
	volatile overflow
	integer*4 dix_util_get_len_fu
c
	real8 = 0.0
	call dix_util_copy(nk,data,real8)
c
	overflow = .false.
	call lib$establish(dix_con_overflow)
c
c Test for the overflow detection
c
	dix_con_real_g_intasc = real8 .ne. 0.0
	if(overflow) goto 60
	write(value,control.format_real8,err=10) real8
10	nkar = dix_util_get_len_fu(value)
	goto 90
60	value = 'Overflow'
	nkar = 8
90	call dix_util_left_just(value,nkar)
	return
	end
	options /nog_floating
	function dix_con_real_d_intasc(nk,data,value,nkar,control)
	implicit none
c
c real conversion (d_format)
c
	include 'dix_def.inc'
	integer*4 nk		!:i: data length
	byte data(*)		!:i: the data
	character*(*) value	!:o: the converted text
	integer*4 nkar		!:o: length of text
	record /control/ control
	logical*4 dix_con_real_d_intasc	!:F: true if not compressed
c#
	real*8 real8
	byte hulp(8)
c
	equivalence (real8,hulp)
c
	logical*4 overflow
        common /dix_con_common/ overflow
	external dix_con_overflow
	integer*4 dix_util_get_len_fu
c
	real8 = 0
	call dix_util_copy(nk,data,hulp)
c
	overflow = .false.
	call lib$establish(dix_con_overflow)
c
	dix_con_real_d_intasc = real8 .ne. 0.0
	if(overflow) goto 50
c
	write(value,control.format_real8,err=10) real8
10	nkar = dix_util_get_len_fu(value)
	goto 70
50	value= 'Overflow'
	nkar = 8
70	call dix_util_left_just(value,nkar)
	return
	end
	function dix_con_chr_intasc(nk,data,value,nkar,
     1                              include_binary,mode)
	implicit none
c
c character conversion
c
	include 'dix_def.inc'
	integer*4 nk		!:I: data length
	byte data(*)		!:i: data 
	character*(*) value	!:o: the converted text
	integer*4 nkar		!:o: length of text
	logical*4 include_binary!:i: include unprintables in text
	logical*4 mode		!:i: mode
	logical*4 dix_con_chr_intasc	!:f: true if not compressed
c#
	integer*4 k,nk1
	logical*4 dix_util_kar_in_ran
c
	integer*4 nk_nam
	character*(max_short_line_length) nam
c
	dix_con_chr_intasc = .false.
	nkar = 0
	nk1 = min(nk,len(value))
	do k=1,nk1
	  if(dix_util_kar_in_ran(zext(data(k)))) then
c
c It is a printable char, 
c if _fancy or _hex, see if the character is a < or a %
c  if so double the char, else insert normally
c just include
c
	    if(nkar .eq. len(value)) goto 90
	    if(include_binary .eq. include_binary_fancy) then
	      if(data(k) .eq. ichar('<')) then
	        if(nkar .eq. len(value)-1) goto 90
	        nkar = nkar + 1
	        value(nkar:nkar) = char(data(k))
	      endif
	    elseif(include_binary .eq. include_binary_hex) then
	      if(data(k) .eq. ichar('%')) then
	        if(nkar .eq. len(value)-1) goto 90
	        nkar = nkar + 1
	        value(nkar:nkar) = char(data(k))
	      endif
	    endif
	    nkar = nkar + 1
	    value(nkar:nkar) = char(data(k))
            if(value(nkar:nkar) .ne. ' ') dix_con_chr_intasc = .true.
	  else
c
c  UNprintable one, set intasc to true, so not a compressable one
c
	    if(data(k) .ne. 0) dix_con_chr_intasc = .true.
	    if(include_binary .eq. include_binary_dot) then
c
c Replace all unprintables by a . 
c  if in screen mode replace them by a <NULL>, the display will be a bold .
c
	      if(nkar .eq. len(value)) goto 90
	      nkar = nkar + 1
	      if(mode .eq. mode_screen) then
	        value(nkar:nkar) = char(0)
	      else
	        value(nkar:nkar) = '.'
	      endif
c
	    elseif(include_binary .eq. include_binary_fancy) then
c
c Replace all unprintables by a symbolic name like <SUB>
c
	      call dix_util_conv_fancy(zext(data(k)),nam,nk_nam)
	      if(nkar + nk_nam .gt. len(value)) goto 90
	      value(nkar+1:nkar+nk_nam) = nam(1:nk_nam)
	      nkar = nkar + nk_nam
	    elseif(include_binary .eq. include_binary_hex) then
c
c Replace all unprintables by a hex display %Xnn 
c
	      if(nkar + 4 .gt. len(value)) goto 90
	      write(value(nkar+1:nkar+4),1000) zext(data(k))
1000	      format('%X',z2.2)
	      nkar = nkar + 4
	    else
c
c Include_binary_bin  (do nothing)
c
	      if(nkar .eq. len(value)) goto 90
	      nkar = nkar + 1
	      value(nkar:nkar) = char(data(k))
	    endif
	    dix_con_chr_intasc = .true.
	  endif
	end do
90	return
	end

	function dix_con_decimal_intasc(nk,data,value,nkar,
     1                                 unsigned,flags)
	implicit none
c
c Decimal string conversion
c Decinmal strings are a number of digits (0..9)
c  optionally preceeded by a + or a -
c  illegal characters wil not be displayed
c
	include 'dix_def.inc'
	integer*4 nk		!:I: data length
	byte data(*)		!:i: data 
	character*(*) value	!:o: the converted text
	integer*4 nkar		!:o: length of text
	logical*4 unsigned	!:i: signed/unsigned
	integer*4 flags		!:i: allow exponents/fractions
	logical*4 dix_con_decimal_intasc	!:f: true if not compressed
c#
	integer*4 k
	logical*4 seen_sign
	logical*4 seen_exp_sign
	logical*4 seen_exponent
	logical*4 seen_fract
c
	logical*4 allow_fract
	logical*4 allow_expon
c
	nkar = min(nk,len(value))
c
	nkar = 0
	dix_con_decimal_intasc = .false.
	allow_expon = (flags .and. des_flag_decimal_exponent) .ne. 0
	allow_fract = (flags .and. des_flag_decimal_fraction) .ne. 0
c
c  If unsigned, signs are not allowed
c
	seen_sign = unsigned
	seen_exp_sign = .false.
	seen_exponent = .not. allow_expon
	seen_fract    = .not. allow_fract
c
	do k=1,nk
	  if(data(k) .eq. ichar('+') .or.
     1       data(k) .eq. ichar('-')) then
	    if(seen_exponent) then
	      if(seen_exp_sign) goto 10
	      seen_exp_sign = .true.
	    else
	      if(seen_sign) goto 10
	      seen_sign = .true.
	    endif
	  endif
	  if((data(k) .eq. ichar('.'))) then
c
c Fraction character, if already seen one (or disallowed) skip the rest
c
	    if(seen_exponent) goto 30	!in exponent not allowed
	    if(seen_fract) goto 30
	    seen_fract = .true.
	  endif
	  if((data(k) .eq. ichar('E')) .or.
     1       (data(k) .eq. ichar('e'))) then
c
c If we already saw an exponent (or exponent not allowed)
c  skip the rest
c
	    if(seen_exponent) goto 30
	    seen_exponent = .true.
	  endif
	  if((data(k) .lt. ichar('0') .and.
     1        data(k) .gt. ichar('9'))) goto 10
c
c Add the character
c
	  nkar = nkar + 1
	  value(nkar:nkar) = char(data(k))
	  if(value(nkar:nkar) .ge. '1' .and. 
     1         value(nkar:nkar) .le. '9')
     1          dix_con_decimal_intasc = .true.
10	end do
30	return
	end

	function dix_con_str_intasc(nk,data,value,nkar,
     1                              include_binary,mode)
	implicit none
c
c charcter conversion for counted ascii strings
C the first byte contains the length
c
	integer*4 nk		!:I: data length
	byte data(*)		!:i: data 
	character*(*) value	!:o: the converted text
	integer*4 nkar		!:o: length of text
	logical*4 include_binary!:i: include unprintables in text
	logical*4 mode		!:i: mode
	logical*4 dix_con_str_intasc	!:f: true if not compressed
c#
	logical*4 dix_con_chr_intasc
	dix_con_str_intasc = dix_con_chr_intasc(nk-1,data(2),value,nkar,
     1                               include_binary,mode)
	return
	end

	function dix_con_wstr_intasc(nk,data,value,nkar,
     1                               include_binary,mode)
	implicit none
c
c charcter conversion for counted ascii strings
C the first word contains the length
c
	integer*4 nk		!:I: data length
	byte data(*)		!:i: data 
	character*(*) value	!:o: the converted text
	integer*4 nkar		!:o: length of text
	logical*4 include_binary!:i: include unprintables in text
	logical*4 mode		!:i: mode
	logical*4 dix_con_wstr_intasc	!:f: true if not compressed
c#
	logical*4 dix_con_chr_intasc
c
	dix_con_wstr_intasc = dix_con_chr_intasc(nk-2,data(3),value,nkar,
     1                               include_binary,mode)
	return
	end
	function dix_con_lstr_intasc(nk,data,value,nkar,
     1                               include_binary,mode)
	implicit none
c
c charcter conversion for counted ascii strings
C the first longword contains the length
c
	integer*4 nk		!:I: data length
	byte data(*)		!:i: data 
	character*(*) value	!:o: the converted text
	integer*4 nkar		!:o: length of text
	logical*4 include_binary!:i: include unprintables in text
	integer*4 mode		!:i: display mode
	logical*4 dix_con_lstr_intasc	!:f: true if not compressed
c#
	logical*4 dix_con_chr_intasc
c
	dix_con_lstr_intasc = dix_con_chr_intasc(nk-4,data(5),value,nkar,
     1                               include_binary,mode)
	return
	end

	function dix_con_hstr_intasc(nk,data,value,nkar,
     1                                include_binary,mode)
	implicit none
c
c charcter conversion for strings terminated by char with high bit set
c
	integer*4 nk		!:I: data length
	byte data(*)		!:i: data 
	character*(*) value	!:o: the converted text
	integer*4 nkar		!:o: length of text
	logical*4 include_binary!:i: include unprintables in text
	logical*4 mode		!:i: mode
	logical*4 dix_con_hstr_intasc	!:f: true if not compressed
c#
	logical*4 dix_con_chr_intasc
c
	dix_con_hstr_intasc = dix_con_chr_intasc(nk,data,value,nkar,
     1                               include_binary,mode)
	value(nk:nk) = char(iand(ichar(value(nk:nk)),'7F'X))
	return
	end

	function dix_con_zstr_intasc(nk,data,value,nkar,
     1                               include_binary,mode)
	implicit none
c
c charcter conversion for zero-terminated ascii strings
c
	integer*4 nk		!:I: data length
	byte data(*)		!:i: data 
	character*(*) value	!:o: the converted text
	integer*4 nkar		!:o: length of text
	logical*4 include_binary!:i: include unprintables in text
	logical*4 mode		!:i: mode
	logical*4 dix_con_zstr_intasc	!:f: true if not compressed
c#
	logical*4 dix_con_chr_intasc
c
	dix_con_zstr_intasc = dix_con_chr_intasc(nk-1,data,value,nkar,
     1                               include_binary,mode)
	return
	end
	function dix_con_acl_intasc(nk,data,value,nkar)
	implicit none
c
c charcter conversion for acl fields
c
	integer*4 nk		!:I: data length
	byte data(*)		!:i: data 
	character*(*) value	!:o: the converted text
	integer*4 nkar		!:o: length of text
	logical*4 dix_con_acl_intasc  !:f: true if not compressed
c#
	integer descr(2),istat
c
	integer sys$format_acl
c
	descr(1) = nk
	descr(2) = %loc(data)
	istat = sys$format_acl(descr,nkar,value,,,,,)
	dix_con_acl_intasc = .true.
90	return
	end
	function dix_con_diskmap_intasc(nk,data,value,nkar)
	implicit none
c
c charcter conversion for diskmap (ods-2 disk allocation)
c
	integer*4 nk		!:I: data length
	byte data(*)		!:i: data 
	character*(*) value	!:o: the converted text
	integer*4 nkar		!:o: length of text
	logical*4 dix_con_diskmap_intasc  !:f: true if not compressed
c#
	integer k,blnr,count,bltyp
	integer*2 dataword(4)
c
	call lib$movc3(8,data,dataword)
c
	dix_con_diskmap_intasc = .false.
	bltyp = zext(data(2))
	bltyp = ishft(bltyp,-6)	!take bit 15,14 = bit 7,6 of nbyte 2
	do k=1,nk
	  if(data(k) .ne. 0) goto 10
	enddo
	nkar = 0
	goto 90
10	dix_con_diskmap_intasc = .true.
	if(bltyp .eq. 0) then
c
c Type 0, placement type
c
	  write(value,1000) (data(k),k=1,min(10,nk))
1000	  format('P:',10z3)
	  nkar = 2 + nk*3
	  goto 90
	elseif(bltyp .eq. 1) then
c
c Type 1: 8 bits count and 22 bits blocknr
c    bit 111111
c        5432109876543210
c word1  tpNNNNNNCCCCCCCC  
c word2  NNNNNNNNNNNNNNNN
c
	  count = iand(dataword(1),'ff'x)
	  blnr  = iand(dataword(1),'3f00'x)
	  blnr  = ior(ishft(blnr ,8),zext(dataword(2)))
	elseif(bltyp .eq. 2) then
c
c Type 2: 14 bits count and 32 bits blocknr
c    bit 111111
c        5432109876543210
c word1  tpCCCCCCCCCCCCCC  
c word2  NNNNNNNNNNNNNNNN
c word3  NNNNNNNNNNNNNNNN
c
	  count = iand(dataword(1),'3fff'x)
	  call lib$movc3(4,dataword(2),blnr)
	elseif(bltyp .eq. 3) then
c
c Type 3: 30 bits count and 32 bits blocknr
c word1  tpCCCCCCCCCCCCCC  MS
c word2  CCCCCCCCCCCCCCCC  LS
c word3  NNNNNNNNNNNNNNNN  LS
c word4  NNNNNNNNNNNNNNNN  MS
c
	  count = iand(dataword(1),'3fff'x)
	  count = ior(ishft(count,16),zext(dataword(2)))
	  call lib$movc3(4,dataword(3),blnr)
	endif
c
c count is one low, a count of 0 means 1 block
c
	call sys$fao('T:!UL !UL-!UL (!UL)',nkar,value,
     1         %val(bltyp),%val(blnr),%val(blnr+count),%val(count+1))
c
90	return
	end
c
	function dix_con_vfc_intasc(nk,data,value,nkar)
	implicit none
c
c character conversion for vfc fields 
c The string wil be HH explanation   (hh the hex code)
c
	integer*4 nk		!:I: data length (should be 1)
	byte data(*)		!:i: data 
	character*(*) value	!:o: the converted text
	integer*4 nkar		!:o: length of text
	logical*4 dix_con_vfc_intasc  !:f: true if not compressed
c#
	integer*4  max_co_name_length
	parameter (max_co_name_length=3)
c
	character*3 dix_util_c0_name
c
	character*(max_co_name_length) name
c
	integer*4  max_hh_length
	parameter (max_hh_length=2)
	character*(max_hh_length) temp
c
	character*80 extra
	integer*4 nk1,count,flag
c
	nk1 = nk		!to prevent unused warnings
c
	flag = zext(data(1))
	write(temp,'(z2.2)') flag
c
	dix_con_vfc_intasc = flag .ne. 0	
c
	if(flag .eq. 0) then
	  extra = 'None'
	  nk1   = 4
	else
	  if(.not. btest(flag,7)) then
c
c high bit clear, this means nn linefeeds
c
	    count = iand(zext(flag),127)
	    call sys$fao('!UL New_line!%S',nk1,extra,%val(count))
	  else
c
c High bit set, if only high bit set, if bit 6,5 are clear, 
c  this means the co_names 
c
	    extra = 'Reserved'
	    nk1   = 8	    
	    if(iand(flag,'E0'X) .eq. '80'X) then
	      count = iand(zext(flag),31)
	      name = dix_util_c0_name(count)
	      call sys$fao('Byte !2XL = !AS',nk1,extra,%val(count),name) 
	    elseif(iand(flag,'F0'X) .eq. 'C0'X) then
c
c if bit 6,5 set, tis vfu channel 0..15
c
	      count = iand(zext(flag),15)
	      call sys$fao('VFU channel !UL',nk1,extra,%val(count)) 
	    endif
	  endif
	endif
	value = temp//' : '//extra(1:nk1)
	nkar  = len(temp) + 3 + nk1
	return
	end
	function dix_con_hex_intasc(offset,size,data,nbdata,
     1                              value,nkar,typ,max_len)
	implicit none
c
c convert to hex bytes
C if string than separated by spaces and ascending index
C else descending index
c
	integer*4 offset	!:i: offset in bits from buffer data
	integer*4 size          !:i: size in bits of data
	integer*4 typ		!:i: the data type
	byte data(*)		!:i: the data
	integer*4 nbdata	!:i: max # bytes in databuf
	character*(*) value	!:o: the text
	integer*4 nkar		!:o: length of text
	integer*4 max_len	!:o: max length allowed
	logical*4 dix_con_hex_intasc	!:F: True if not compres skip else false
c#
c local vars
c
	include 'dix_def.inc'
c
	logical*4 dix_con_typ_is_text
c
	integer*4 k,nk_txt,nk,offs,nbtod
	logical*4 ascii
	integer*4 lib$extzv
c
	ascii = dix_con_typ_is_text(typ)
	nk_txt = len(value)
	nk = min(size/8,nbdata)
c
	nkar = 0
	dix_con_hex_intasc = .false.
	if(ascii) then
c
c ascii case, convert ascending with spaces
c cannot be fielded
c
	  offs = offset/8
	  nk   = size/8
	  do k=1,nk
	    if(nkar+3 .le. nk_txt) then
	      write(value(nkar+1:nkar+3),1000) data(k+offs)
1000	      format(z2.2,' ')
	    end if
	    if(data(k) .ne. 0 .and. data(k).ne. ' ') dix_con_hex_intasc =.true.
	    nkar = nkar + 3
	  end do
	  nkar = nkar - 1	!skup trailing space
	  max_len = nk*3
	else
c
c binary case, convert descending no spaces
c
	  if(mod(offset,8) .ne. 0 .or. mod(size,8) .ne. 0) then
	    nbtod = size
	    offs = offset
	    do while(nbtod .gt. 0)
	      k = lib$extzv(offset,min(8,nbtod),data)
	      if(nkar+2 .le. nk_txt) then
	        write(value(nkar+1:nkar+2),1100) k
	      end if
	      if(k .ne. 0) dix_con_hex_intasc = .true.
	      nkar = nkar + 2
	      nbtod = nbtod-8
	      offs = offs + 8
	    end do
	  else
	    offs = offset/8
	    nk   = size/8
	    do k=nk,1,-1
	      if(nkar+2 .le. nk_txt) then
	        write(value(nkar+1:nkar+2),1100) data(k+offs)
1100	        format(z2.2)
	      end if
	      if(data(k) .ne. 0) dix_con_hex_intasc = .true.
	      nkar = nkar + 2
	    end do
	  end if
	  max_len = nk*2
	end if
	call dix_util_left_just(value,nkar)
	return
	end	  
	function dix_con_oct_intasc(offset,size,data,nbdata,
     1                              value,nkar,max_len)
	implicit none
c
c convert to oct bytes
C if string than separated by spaces and ascending index
C else descending index
c
	integer*4 offset	!:i: offset in bits from buffer data
	integer*4 size          !:i: size in bits of data
	byte data(*)		!:i: the data
	integer*4 nbdata	!:i: max # bytes in databuf
	character*(*) value	!:o: the text
	integer*4 nkar		!:o: length of text
	integer*4 max_len	!:o: max length allowed
	logical*4 dix_con_oct_intasc	!:F: True if not compres skip else false
c#
c local vars
c
	include 'dix_def.inc'
c
	integer*4 k,offs,nbtod,pos
	integer*4 lib$extzv
c
	nkar = min(len(value),min(nbdata*3,(size+2)/3))
	dix_con_oct_intasc = .false.
c
	nbtod = size
	offs = offset
	pos = nkar
	do while(nbtod .gt. 0)
	  k = lib$extzv(offs,min(3,nbtod),data)
	  if(nkar .gt. 0) value(pos:pos) = char(ichar('0')+k)
	  if(k .ne. 0) dix_con_oct_intasc = .true.
	  pos   = pos   - 1
	  nbtod = nbtod - 3
	  offs  = offs  + 3
	end do
	call dix_util_left_just(value,nkar)
	max_len = nkar
	return
	end	  

	function dix_con_bin_intasc(offset,size,data,nbdata,
     1                              value,nkar,max_len)
	implicit none
c
c convert to binary
c
	integer*4 offset	!:i: offset in bits from buffer data
	integer*4 size          !:i: size in bits of data
	byte data(*)		!:i: the data
	integer*4 nbdata	!:i: max # bytes in databuf
	character*(*) value	!:o: the text
	integer*4 nkar		!:o: length of text
	integer*4 max_len	!:o: max length allowed
	logical*4 dix_con_bin_intasc	!:F: True if not compres skip else false
c#
c local vars
c
	include 'dix_def.inc'
c
	integer*4 k,l,offs
	integer*4 lib$extzv
c
	value = ' '
	dix_con_bin_intasc = .false.
c
	nkar = min(len(value),min(nbdata*8,size))
	max_len = nkar
	offs = offset
	do l=1,size
	  k = lib$extzv(offs,1,data)
	  value(nkar:nkar) = char(ichar('0')+k)
	  if(k .ne. 0) dix_con_bin_intasc = .true.
	  offs = offs + 1
	  nkar = nkar - 1
	end do
	nkar = min(size,max_len)
	max_len = nkar
	return
	end	  
c
	function dix_con_type_ascint(value,nbits,data,type,control,nb_f)
	implicit none
	include 'dix_def.inc'
c
c A simplified interface to dix_con_ascint
c
	character*(*) value	!:i: the string
	integer*4 nbits		!:i: length of data 
	byte data(*)		!:o: the data
	integer*4 type		!:i: the type
	record /control/ control!:i: contro l block
	integer*4 nb_f		!:o: #bits found
	integer*4 dix_con_type_ascint !:f: function result
c#
	record /des_rec/ des_rec
	integer*4 istat
c
	integer*4 dix_con_ascint
c
	des_rec.ent_type = type
	call dix_util_clear_descr(des_rec.fldnam,.false.)
	des_rec.bit_offset = 0
	des_rec.size = nbits
	des_rec.flags = des_flag_translate_nor
	istat = dix_con_ascint(value,data,des_rec,
     1                   des_flag_translate_nor,nb_f,control)
	dix_con_type_ascint = istat
	return                     
	end
c
	function dix_con_ascint(value,data,des_rec,hex,nb_f,control)
	implicit none
c
c Convert data from ascii to binary
c
	include 'dix_def.inc'
	character*(*) value		!:i: the text
	byte data(*)			!:o: the data to receive
	record /des_rec/ des_rec
	logical*4 hex			!:i: hex mode??
	integer*4 nb_f			!:o: length of data found
	record /control/ control	!:i: control structure
	logical*4 dix_con_ascint	!:f: f is conversion error
c#
c The conversion routines
c
	logical*4 dix_con_int_ascint,dix_con_real_f_ascint
	logical*4 dix_con_real_g_ascint,dix_con_real_h_ascint
	logical*4 dix_con_real_s_ascint,dix_con_real_t_ascint
	integer*4 dix_con_real_x_ascint
	logical*4 dix_con_real_d_ascint,dix_con_identifier_ascint
	logical*4 dix_con_log_ascint,dix_con_dat_ascint
	logical*4 dix_con_uic_ascint,dix_con_bits_ascint
	logical*4 dix_con_chr_ascint,dix_con_str_ascint
	logical*4 dix_con_wstr_ascint,dix_con_lstr_ascint
	logical*4 dix_con_uint_ascint,dix_con_hex_ascint
	logical*4 dix_con_hstr_ascint,dix_con_zstr_ascint
	logical*4 dix_con_prot_ascint,dix_con_revint_ascint
	logical*4 dix_con_fid_ascint,dix_con_bin_ascint
	logical*4 dix_con_oct_ascint,dix_con_acl_ascint
	logical*4 dix_con_diskmap_ascint,dix_con_vfc_ascint
	logical*4 dix_con_decimal_ascint
	logical*4 dix_inter_execute
c
	external dix_msg_converr
c
	integer*4 temp(2),offs
	integer*4 size,typ,k,case,conmask,nb_reserved
	logical try_hex,stat,variable,readonly
c
	nb_f = des_rec.size		!intitial setting
c
	if(hex .ne. des_flag_translate_nor) then
	  conmask = hex
	else
	  conmask  = (des_rec.flags .and. des_flag_translate_mask)
	endif
	variable = (des_rec.flags .and. des_flag_is_variable) .ne. 0
	readonly = (des_rec.flags .and. des_flag_readonly)    .ne. 0
	nb_reserved = (des_rec.flags .and. des_flag_nb_reserved_mask)	
c
	offs = des_rec.bit_offset/8
	size = (des_rec.size+7)/8
	if(variable) size = 0
	typ  = des_rec.ent_type
	case = des_rec.flags .and. des_flag_case_mask
c
c
	try_hex = conmask .ne. des_flag_translate_nor
	if(typ .eq. enttyp_int .or. typ .eq. enttyp_uint) then
c
c Hex wanted, but if string start with %, let normal int/uint translate
c
	  if(value(1:1) .eq. '%') try_hex = .false.
	endif
c
	if(try_hex) then
c
c Translate non standard (hex,oct,bin)
c
	  if(conmask .eq. des_flag_translate_hex) then
	    stat = dix_con_hex_ascint(value,data,
     1            des_rec.bit_offset,des_rec.size,typ,control)
	  elseif(conmask .eq. des_flag_translate_bin) then
	    stat = dix_con_bin_ascint(value,data,
     1            des_rec.bit_offset,des_rec.size,control)
	  elseif(conmask .eq. des_flag_translate_oct) then
	    stat = dix_con_oct_ascint(value,data,
     1            des_rec.bit_offset,des_rec.size,control)
	  endif	  
	else
c
c Normal conversions
c
	  if    ( typ .eq. enttyp_int) then
	    call dix_util_copy_bits(des_rec.size,des_rec.bit_offset,data,
     1                temp,8)
	    stat = dix_con_int_ascint(value,temp, des_rec.size,
     1                               des_rec.fldnam,des_rec.min_val,
     1                               des_rec.max_val,control,
     1                               readonly)
	    if(stat) then
	      call dix_util_insert_bits(temp,des_rec.bit_offset,
     1                des_rec.size,data)
	    end if
	  elseif( typ .eq. enttyp_uint) then
	    call dix_util_copy_bits(des_rec.size,des_rec.bit_offset,data,
     1                temp,8)
	    stat = dix_con_uint_ascint  (value,temp, des_rec.size,
     1                             des_rec.fldnam,des_rec.min_val,
     1                             des_rec.max_val,control,
     1                             readonly)
	    if(stat) then
	      call dix_util_insert_bits(temp,des_rec.bit_offset,
     1                des_rec.size,data)
	    end if
	  elseif( typ .eq. enttyp_log .or. typ .eq. enttyp_rlog) then
	    call dix_util_copy_bits(des_rec.size,des_rec.bit_offset,data,
     1                temp,8)
	    stat = dix_con_log_ascint   (value,temp, des_rec.size,
     1                      typ .eq. enttyp_rlog,control)
	    if(stat) then
	      call dix_util_insert_bits(temp,des_rec.bit_offset,
     1                des_rec.size,data)
	    end if
	  elseif( typ .eq. enttyp_bits .or. typ .eq. enttyp_rbits) then
	    call dix_util_copy_bits(des_rec.size,des_rec.bit_offset,data,
     1                temp,8)
	    stat = dix_con_bits_ascint  (value,temp, des_rec.size,
     1                            des_rec.fldnam,
     1                            typ .eq. enttyp_rbits,control,
     1                            readonly)
	    if(stat) then
	      call dix_util_insert_bits(temp,des_rec.bit_offset,
     1                des_rec.size,data)
	    end if
	  elseif( typ .eq. enttyp_real_f) then
	    stat = dix_con_real_f_ascint(value,data(offs+1),size,
     1                            control)
	  elseif( typ .eq. enttyp_real_g) then
	    stat = dix_con_real_g_ascint(value,data(offs+1),size,
     1                            control)
	  elseif( typ .eq. enttyp_real_h) then
	    stat = dix_con_real_h_ascint(value,data(offs+1),size,
     1                            control)
	  elseif( typ .eq. enttyp_real_x) then
	    stat = dix_con_real_x_ascint(value,data(offs+1),size,
     1                            control)
	  elseif( typ .eq. enttyp_real_d) then
	    stat = dix_con_real_d_ascint(value,data(offs+1),size,
     1                            control)
	  elseif( typ .eq. enttyp_real_s) then
	    stat = dix_con_real_s_ascint(value,data(offs+1),size,
     1                            control)
	  elseif( typ .eq. enttyp_real_t) then
	    stat = dix_con_real_t_ascint(value,data(offs+1),size,
     1                            control)
	  elseif( typ .eq. enttyp_dat .or. 
     1            typ .eq. enttyp_deltatime .or.
     1            typ .eq. enttyp_cpu) then
	    stat = dix_con_dat_ascint   (value,data(offs+1), size,
     1                            typ,
     1                            des_rec.fldnam,control)
	  elseif( typ .eq. enttyp_uic) then
	    stat = dix_con_uic_ascint   (value,data(offs+1), size,
     1                            control,.true.)
	  elseif( typ .eq. enttyp_identifier) then
	    stat = dix_con_identifier_ascint(value,data(offs+1),
     1                            size,control,.true.)
	  elseif( typ .eq. enttyp_prot) then
	    stat = dix_con_prot_ascint   (value,data(offs+1), size,
     1                            control)
	  elseif( typ .eq. enttyp_fid) then
	    stat = dix_con_fid_ascint   (value,data(offs+1), size,
     1                            control)
	  elseif( typ .eq. enttyp_vfc) then
	    stat = dix_con_vfc_ascint   (value,data(offs+1), size,
     1                            control)
	  elseif( typ .eq. enttyp_revint) then
	    stat = dix_con_revint_ascint (value,data(offs+1), size,
     1                   des_rec.min_val,des_rec.max_val,
     1                   control,readonly)
	  elseif( typ .eq. enttyp_udecimal) then
	    stat = dix_con_decimal_ascint(value,data(offs+1),size,
     1                            control,.true.,des_rec.flags)
	  elseif( typ .eq. enttyp_decimal) then
	    stat = dix_con_decimal_ascint(value,data(offs+1),size,
     1                            control,.false.,des_rec.flags)
	  elseif( typ .eq. enttyp_chr) then
	    stat = dix_con_chr_ascint   (value,data(offs+1), size,
     1                            control,case)
	  elseif( typ .eq. enttyp_string) then
	    stat = dix_con_str_ascint (value,data(offs+1),size,nb_f,
     1                            control,case)
	    nb_f = nb_f*8
	  elseif(typ .eq. enttyp_wstring) then
	    stat = dix_con_wstr_ascint(value,data(offs+1),size,nb_f,
     1                            control,case)
	    nb_f = nb_f*8
	  elseif(typ .eq. enttyp_lstring) then
	    stat = dix_con_lstr_ascint(value,data(offs+1),size,nb_f,
     1                            control,case)
	    nb_f = nb_f*8
	  elseif(typ .eq. enttyp_hstring) then
	    stat = dix_con_hstr_ascint(value,data(offs+1),size,nb_f,
     1                            control,case)
	    nb_f = nb_f*8
	  elseif(typ .eq. enttyp_zstring) then
	    stat = dix_con_zstr_ascint(value,data(offs+1),size,nb_f,
     1                            control,case)
	    nb_f = nb_f*8
	  elseif(typ .eq. enttyp_diskmap) then
	    stat = dix_con_diskmap_ascint(value,data(offs+1),
     1                            size,nb_f,control)
	    nb_f = nb_f*8
	  elseif(typ .eq. enttyp_acl) then
	    stat = dix_con_acl_ascint(value,data(offs+1),
     1                            size,nb_f,control)
	    nb_f = nb_f*8
	  elseif(typ .eq. enttyp_user) then
	    stat = dix_inter_execute(control,'ASCBIN',des_rec.lun_translate,
     1          0,des_rec.fldnam,len(value),%ref(value),
     1          k,data(offs+1),nb_f)
	  endif
	end if
	if(stat) then
	  dix_con_ascint = 1
	else
	  dix_con_ascint = %loc(dix_msg_converr)
	endif
	return
	end

	function dix_con_int_ascint(line,data,size,fldnam,min_val,
     1                              max_val,control,readonly)
	implicit none
c
c Convert signed integer
c
	character*(*) line			!:i: the line to convert
	byte data(*)				!:o: the data
	integer*4 size				!:i: data size in bits
	character*(*) fldnam			!:i: list of fieldnames
	integer*4 min_val			!:i: min val 
	integer*4 max_val			!:i: max val
	integer*4 control
	logical*4 readonly			!:i: readonly field?
	integer*4 dix_con_int_ascint		!:f: true if all ok
c#
	logical*4 dix_con_int_ascint_1
c	integer*4 k
c
	external dix_msg_converr
	external dix_msg_invint
c
	dix_con_int_ascint = %loc(dix_msg_converr)
	if(dix_con_int_ascint_1(line,data,size,fldnam,min_val,
     1         max_val,control,.true.,readonly)) then
	  dix_con_int_ascint = 1
	else
	  call dix_message(control,dix_msg_invint,line)
	end if
90	return
	end

	function dix_con_int_ascint_1(line,data,size,fldnam,min_val,
     1            max_val,control,signed,readonly)
	implicit none
c
	include 'dix_def.inc'
c
c The actual conversion for signed integer
c
	character*(*) line			!:i: the line to convert
	byte data(*)				!:o: the data
	integer*4 size				!:i: data size in bits
	character*(*) fldnam			!:i: list of fieldnames
	integer*4 min_val			!:i: allowed min_val
	integer*4 max_val			!:i: allowed max val
	record /control/ control
	logical signed				!:i: signed/unsigned
	logical*4 readonly			!:i: readonly field
	logical*4 dix_con_int_ascint_1		!:f: true if all ok
c#
	integer*4 hulp(2),nkar,k,l,istat,bpos,epos,ots_size
	character kar_special
	logical*4 dix_con_i4
	integer*4 lib$convert_date_string
	logical*4 dix_util_find_field
	logical*4 dix_smg_select_field
	character*(max_line_length) tline
c
	external dix_msg_intoutran
	logical dix_con_check_size
c
	integer*4 ots$cvt_tz_l
	integer*4 ots$cvt_tb_l
	integer*4 ots$cvt_to_l
c
	integer*4 ots$cvt_tu_l
	integer*4 ots$cvt_ti_l
c
c Set the right max_val, min_val
c  either form the user, or from the size
c
	do nkar=len(line),1,-1
	  if(line(nkar:nkar) .ne. ' ' .and. line(nkar:nkar) .ne. NULL)goto 4
	end do
c
	nkar = 0
c
4	if(size .le. 4*8 .and. fldnam .ne. ' ') then
	  if(line(1:1) .eq. '?') then
	    if(dix_smg_select_field(control,data,size*8,.false.,
     1                  fldnam,.false.,.true.,readonly))goto 75
	    goto 80
	  end if
	  call str$upcase(tline,line(1:nkar))
	  if(dix_util_find_field(tline(1:nkar),fldnam,hulp)) goto 70
	end if
c
	hulp(1) = 0
	hulp(2) = 0
c
	if(control.platform .eq. platform_vax) then
	  ots_size = 4
	else
	  ots_size = 8
	endif
c
	if    (size .lt. 4*8) then
c
c See for the %Xdddd and the 'xxxx'X formats
c
c Set the default
c
	  kar_special = 'D'
	  bpos = 1
	  epos = nkar
c
	  if(nkar .gt. 2) then
c
c Formats %Rddddd
c
	    if(line(1:1) .eq. '%') then
	      call str$upcase(kar_special,line(2:2))
	      bpos = 3
	      epos = nkar
	    endif
	  endif
	  if(line(1:1) .eq. '''') then
c
c Format 'ddd'R
c
	    if(line(nkar-1:nkar-1) .eq. '''') then
	      bpos = 2
	      epos = nkar-2
	      call str$upcase(kar_special,line(nkar:nkar))
	    endif
	  endif
	  if(kar_special .eq. 'X') then
	    istat = ots$cvt_tz_l(line(bpos:epos),hulp,%val(ots_size))
	  elseif(kar_special .eq. 'O') then
	    istat = ots$cvt_to_l(line(bpos:epos),hulp,%val(ots_size))
	  elseif(kar_special .eq. 'B') then
	    istat = ots$cvt_tb_l(line(bpos:epos),hulp,%val(ots_size))
	  elseif(kar_special .eq. 'D') then
	    if(signed) then
	      istat = ots$cvt_ti_l(line(bpos:epos),hulp,%val(ots_size))
	    else
	      istat = ots$cvt_tu_l(line(bpos:epos),hulp,%val(ots_size))
	    endif
	  else
	    istat = 0
	  endif
	  if(.not. istat) goto 80
c
	elseif(size .eq. 4*8) then
	  if(.not. dix_con_i4(line,nkar,hulp,.false.,
     1                        control,signed)) goto 80
	  if(hulp(1) .lt. 0) hulp(2) = -1	!sign extend
	else
c
c >32 bits, if alpha use ots, else do it youself
c
	  if(control.platform .eq. platform_vax) then
	    k = index(line,'.')
	    if(k .ne. 0) then
c
c is build of 2 integer*4's try conversion for each of them
c
	      if(.not. dix_con_i4(line,k-1,hulp(2),.false.,
     1                       control,.false.)) goto 60
	      if(.not. dix_con_i4(line(k+1:),nkar-k,hulp(1),.false.,
     1                       control,signed)) goto 60
	    else
	      if(nkar .lt. 10) then
	        read(line(1:nkar),2010,err=60) hulp(1)
2010	        format(i12)
	        hulp(2) = 0
	        if(hulp(1) .lt. 0) hulp(2) = -1
	      else
	        read(line(1 :   9),2010,err=60) k
	        read(line(10:nkar),2010,err=60) l
	        call lib$emul(1000000000,k,l,hulp)
	      end if
	    endif
	  else
c
c  Alpha/ipf
c	    
	     if(signed) then
	        istat = ots$cvt_ti_l(line(1:nkar),hulp,%val(8))
	     else
	        istat = ots$cvt_tu_l(line(1:nkar),hulp,%val(8))
	     endif
	     if(istat) goto 70
	  end if
c
c Try date conversion (in upper case)
c
60	  call str$upcase(tline,line(1:nkar))
	  k = lib$convert_date_string(tline(1:nkar),hulp,,123)
	  if(.not. l) goto 80
	end if
c
c Now check the optional range values
c
70	if(max_val .gt. min_val) then
	  if(hulp(1) .lt. min_val .or. hulp(1) .gt. max_val) then
	    call dix_message(control,dix_msg_intoutran,
     1	          line,%val(min_val),%val(max_val))
	    goto 80
	  endif
	else
	  istat = dix_con_check_size(control,size,signed,hulp,line(1:nkar))
	  if(.not. istat) goto 80
	endif
c
	call dix_util_copy((size+7)/8,hulp,data)
75	dix_con_int_ascint_1 = .true.
	goto 90
c
80	dix_con_int_ascint_1 = .false.
c
90	return
	end
c                         
	function dix_con_check_size(control,size,signed,hulp,text)
	implicit none
c
c Check if the data fits in 'size' bits signed or not
c If not signal a message, and return .false.
c
	include 'dix_def.inc'
c
	record /control/ control
	integer*4 size		!:i: #bits avail
	logical*4 signed	!:i: signed value?
	integer*4 hulp(2)	!:i: the data (max 64 bits)
	character*(*) text	!:i: the original text for the value
	logical dix_con_check_size!:f: .false. if tto big
c#
	integer*4 istat
c
	integer*4 lib$extv
c
	external dix_msg_toobig
	external dix_msg_toobigu
c
c Now check for the size in bits
c
	if(size .eq. 8*8) then
c
c All allowed
c
	elseif(size .gt. 4*8) then
c
c  63..32 bits
c
	  if(signed) then
	    istat = lib$extv(size-1,64-size+1,hulp)
	    if(istat .eq. -1) istat = 0
	  else
	    istat = lib$extv(size,64-size,hulp)
	  endif
	  if(istat .ne. 0) goto 20
c
	elseif(size .eq. 4*8) then
c
c Exactly 32 bits.
c  if signed and hulp(2) =-1, bit 31 must be 1
c                hulp(2) = 0, bit 31 must be 0
c
	  if(signed) then
	    if(hulp(2) .lt. 0) then
	      if(hulp(1) .ge. 0) goto 20
	    else
	      if(hulp(1) .lt. 0) goto 20
	    endif
	  else
c
c Unsigned, only check high longword (must be 0)
c
	    if(hulp(2) .ne. 0) goto 20
	  endif
	else
c
c 1..31 bits
c
c
	  if(signed .and. hulp(2) .eq. -1) hulp(2) = 0
	  if(hulp(2) .ne. 0) goto 20
c
c Now the low longword
c
	  if(signed) then
c
c 1 bits signed is not possible
c
	    istat = lib$extv(size-1,32-size+1,hulp)
	    if(istat .eq. -1) istat = 0
	  else
	    istat = lib$extv(size,32-size,hulp)
	  endif
	  if(istat .ne. 0) goto 20
	endif
	istat = 1
	goto 90
c
c Does not fit
c
20	if(signed) then
	  call dix_message(control,dix_msg_toobig,text,%val(size))
	else
	  call dix_message(control,dix_msg_toobigu,text,%val(size))
	endif
	istat = 0
90	dix_con_check_size = (istat .eq. 1)
	return
	end
	function dix_con_uint_ascint(line,data,size,fldnam,min_val,
     1                    max_val,control,readonly)
	implicit none
c
c Convert unsigned integers
c
	character*(*) line                      !:i: the text
	byte data(*)                            !:o: the data
	integer*4 size   			!:i: size in bits
	character*(*) fldnam			!:i: list of fieldnames
	integer*4 min_val
	integer*4 max_val
	integer*4 control
	logical readonly			!:i: readonly field?
	logical*4 dix_con_uint_ascint
c#
	logical*4 dix_con_int_ascint_1
	integer*4 nkar
	external dix_msg_invsign
	external dix_msg_invuint
	external dix_msg_converr
c
	dix_con_uint_ascint = %loc(dix_msg_converr)
	do nkar=len(line),1,-1
	  if(line(nkar:nkar) .ne. ' ') goto 4
	end do
	nkar = 0
4	if(index(line(1:nkar),'-') .ne. 0 .or. 
     1     index(line(1:nkar),'+') .ne. 0) goto 85
c
	if(.not. dix_con_int_ascint_1(line,data,size,fldnam,min_val,
     1            max_val,control,.false.,readonly)) goto 87
	dix_con_uint_ascint = 1
	goto 90
c
85	call dix_message(control,dix_msg_invsign,line)
	goto 90
c
87	call dix_message(control,dix_msg_invuint,line)
	goto 90
c
90	return
	end

	function dix_con_real_f_ascint(line,data,size,control)
	implicit none
c
c Convert real
c
	character*(*) line		!:i: the text
	byte data(*)			!:o: the binary data
	integer*4 size			!:i: the size	
	integer*4 control
	logical*4 dix_con_real_f_ascint	!:f: the result
c
	integer*4 istat
	real*4 hulp
c#
	integer*4 ots$cvt_t_f
	external dix_msg_invreal
c
	istat = ots$cvt_t_f(line,hulp,,,1)
	if(istat) then
	  call dix_util_copy(size,hulp,data)
	  dix_con_real_f_ascint = .true.
	else
	  call dix_message(control,dix_msg_invreal,line)
	  dix_con_real_f_ascint = .false.
	end if
c
	return
	end
	function dix_con_real_g_ascint(line,data,size,control)
	implicit none
c
c Convert real
c
	character*(*) line		!:i: the text
	byte data(*)			!:o: the binary data
	integer*4 size			!:i: the size	
	integer*4 control
	logical*4 dix_con_real_g_ascint	!:f: the result
c
	integer*4 istat
	real*8 hulp   
c#
	integer*4 ots$cvt_t_g
	external dix_msg_invreal
c
	istat = ots$cvt_t_g(line,hulp,,,1)
	if(istat) then
	  call dix_util_copy(size,hulp,data)
	  dix_con_real_g_ascint = .true.
	else
	  call dix_message(control,dix_msg_invreal,line)
	  dix_con_real_g_ascint = .false.
	end if
c
	return
	end
	function dix_con_real_d_ascint(line,data,size,control)
	implicit none
c
c Convert real (d_floating)
c
	character*(*) line		!:i: the text
	byte data(*)			!:o: the binary data
	integer*4 size			!:i: the size
	integer*4 control
	logical*4 dix_con_real_d_ascint	!:f: conversion result
c#
	real*8 hulp
	integer*4 istat 
	integer*4 ots$cvt_t_d
	external dix_msg_invreald
c
	istat = ots$cvt_t_d(line,hulp,,,1)
	if(istat) then
	  call dix_util_copy(size,hulp,data)
	  dix_con_real_d_ascint = .true.
	else
	  call dix_message(control,dix_msg_invreald,line)
	  dix_con_real_d_ascint = .false.
	end if
	return
	end
	function dix_con_log_ascint(line,data,size,reverse,control)
	implicit none
c
c Convert logical 
c
	character*(*) line		!:i: the text
	byte data(*)			!:o: the binary data
	integer*4 size			!:i: the length
	logical*4 reverse		!:i: reverse the value
	integer*4 control
	logical*4 dix_con_log_ascint    !:f: the conversion result
c#
	logical*4 logf(2)
	external dix_msg_invlog
c
	if(    line(1:1) .eq. 'F' .or.
     1         line(1:1) .eq. 'f' .or.
     1         line(1:1) .eq. '0') then
	  logf(1) = .false.
	elseif(line(1:1) .eq. 'T' .or.
     1         line(1:1) .eq. 't' .or.
     1         line(1:1) .eq. '1') then
	  logf(1) = .true.
	else
	  call dix_message(control,dix_msg_invlog,line)
	  dix_con_log_ascint = .false.
	  goto 90
	end if
	if(reverse) logf(1) = .not. logf(1)
	logf(2) = 0
	if(logf(1)) logf(2) = -1	!sign extend
	call dix_util_copy((size+7)/8,logf,data)
	dix_con_log_ascint = .true.
90	return
	end

	function dix_con_dat_ascint(line,data,size,typ,
     1                              fldnam,control)
	implicit none
c
	include 'dix_def.inc'
c
c Convert date from asc to int (either date or cputime fields)
c Date format can be *8 (normal vms date)
c                 or *4 (vmsdate/60000000 = #minutes sinc 1857)
c
c Fldnam can be used to convert dats to special texts
c  syntax "value=name[,value=name]"
c Where value is the value for the whole value
c  and name the used name
c
	character*(*) line		!:i: the text
	byte data(*)			!:o: the binary data
	integer*4 size			!:i: the length (4 or 8)
	integer*4 typ			!:i: date/cputime/deltatime flag
	character*(*) fldnam		!:i: special names for dats
	integer*4 control
	logical*4 dix_con_dat_ascint	!:f: conversion result
c#
	integer*4 vmstim(2),istat,temp,k
	integer*2 defs(7)
c
	integer*4 lib$convert_date_string
	integer*4 sys$bintim
	external dix_msg_invdate
	external dix_msg_invcputim
	external dix_msg_invdelta
	logical*4 dix_util_find_field
c
c allow default for all fields ; except  day
c
 	if(fldnam .ne. ' ') then
	  if(dix_util_find_field(line,fldnam,vmstim(1))) then
	     call dix_util_sign_extend(vmstim)
	     istat = 1
	     goto 70
	  endif
	endif
c
	if(typ .eq. enttyp_cpu) then
c
c cputime format
c
	  do k=1,7
	    defs(k) = 0
	  end do
c
	  istat = sys$bintim(line,vmstim)
	  if(istat) then
	    call lib$ediv(-10*1000*10,vmstim,temp,k)
	    if(temp .lt. 0) then
	      istat = 0
	    else
	      vmstim(1) = temp
	    endif
	  endif
 	  if(.not. istat) istat = %loc(dix_msg_invcputim)
	elseif(typ .eq. enttyp_deltatime) then
c
c Can only be bintim
c
	  if(line .eq. ' ') then
	     vmstim(1) = 0
	     vmstim(2) = 0
	     istat = 1
	  else
	    istat = sys$bintim(line,vmstim)
	   endif
	else
	  if(.not. lib$convert_date_string(line,
     1                 vmstim,,127)) then
c
c Can still be deltatime, the convert_date_string 
c  cannot handle deltatimes, so check for bintim
c
	    istat = sys$bintim(line,vmstim)
 	  end if
c
	  if(istat) then
	    if(size .eq. 4) then
	      call lib$ediv(600000000,vmstim,temp,k)
	      vmstim(1) = temp
	    endif
	  else
	    istat = %loc(dix_msg_invdate)
	  endif
	endif
c
70	if(istat) then
	  call dix_util_copy(size,vmstim,data)
	else
 	  call dix_message(control,%val(istat),line)
	endif
	dix_con_dat_ascint = istat
c
90	return
	end

	function dix_con_uic_ascint(line,data,size,control,signal)
	implicit none
c
c Convert UIC
c
	character*(*) line 		!:i: the text
	byte data(*)			!:o: the binary data
	integer*4 size			!:i: the size
	integer*4 control
	logical signal			!:i: signal error ?
	logical*4 dix_con_uic_ascint	!:f: conversion result
c#
	integer*4 sys$asctoid
c
	structure /uic/
	  integer*2 mem
	  integer*2 grp
	end structure
	record /uic/ uic,uic1
	integer*4 ipos1,ipos2,ipos3
c
	external dix_msg_invuic
c
	ipos1 = size		!prevent unused message (size is always 4)
c
	dix_con_uic_ascint = .false.
	ipos3 = index(line,']')
	if(ipos3 .eq. 0) goto 80
	ipos1 = index(line(1:ipos3),'[')
	if(line(1:ipos1-1) .ne. ' ') goto 80
c
	if(ipos1 .gt. 0) then
	  ipos2 = index(line(1:ipos3),',')
	  if(ipos2 .eq. 0) then
c
c Format [userasc]
c
	    if(ipos3 .gt. ipos1) then
	      if(sys$asctoid(line(ipos1+1:ipos3-1),uic,)) then
	        dix_con_uic_ascint = uic.grp .gt. 0	!not general identifier
	      endif
	    endif
	  else
c
c Format either
c  [group,member]
c  both group and mmeber can be text (identifier) or numeric (octal)
c
	    if(ipos2 .gt. ipos1 .and. ipos3 .gt. ipos2) then
	      read(line(ipos1+1:ipos2-1),2000,err=10) uic.grp
	      goto 20
c
c Not numeric, so must be identifier
c
10	      if(.not. sys$asctoid(line(ipos1+1:ipos2-1),uic,)) goto 80
	      if(uic.mem .ne. 'FFFF'x) goto 80		!must be -1
c
c uic.grp in filled now
c
20	      read(line(ipos2+1:ipos3-1),2000,err=30) uic1.mem
2000	      format(bn,o6)
	      goto 40
30	      if(.not. sys$asctoid(line(ipos2+1:ipos3-1),uic1,)) goto 80
	      if(uic.grp .ne. uic1.grp) goto 80
40	      uic.mem = uic1.mem
	      dix_con_uic_ascint = .true.
	    end if
	  end if
	end if
c	    
80	if(dix_con_uic_ascint) then
	  call dix_util_copy(4,uic,data)
	else
	  if(signal) call dix_message(control,dix_msg_invuic,line)
	end if
	return
	end
	function dix_con_identifier_ascint(line,data,size,control,signal)
	implicit none
c
c Convert UIC
c
	character*(*) line 		!:i: the text
	byte data(*)			!:o: the binary data
	integer*4 size			!:i: the size
	integer*4 control
	logical signal			!:i: signal error ?
	logical*4 dix_con_identifier_ascint	!:f: conversion result
c#
	integer*4 ipos,id
c
	external dix_msg_invid
	logical dix_con_uic_ascint
	integer*4 sys$asctoid
	integer*4 dix_util_get_len
c
	ipos = size		!prevent unused message (size is always 4)
c
	dix_con_identifier_ascint = .false.
	ipos = dix_util_get_len(line)
	if(sys$asctoid(line(1:ipos),id,)) then
 	  dix_con_identifier_ascint = .true.
	else
	  if(dix_con_uic_ascint(line,id,size,control,.false.)) then
 	    dix_con_identifier_ascint = .true.
	  endif
	endif	    
	if(dix_con_identifier_ascint) then
	  call dix_util_copy(4,id,data)
	else
	  if(signal) call dix_message(control,dix_msg_invid,line)
	end if
	return
	end

	function dix_con_revint_ascint(line,data,size,
     1               min_val,max_val,control,readonly)
	implicit none
c
c Convert revint (int*4 wtih low/high word swapped)
c	
	character*(*) line		!:i: the text
	byte data(*)			!:o: the binary data
	integer*4 size			!:i: the size
	integer*4 min_val		!:i: min allowed balue
	integer*4 max_val		!:i: max allowed value
	integer*4 control
	logical*4 readonly		!:i: readonly field?
	logical*4 dix_con_revint_ascint	!:f: the conversion result
c#
	integer*2 temp(2)
	logical*4 dix_con_int_ascint
c
	dix_con_revint_ascint = .false.
	if(dix_con_int_ascint(line,temp,size*8,' ',
     1               min_val,max_val,control,readonly)) then
	  dix_con_revint_ascint = .true.
	  call dix_util_swap(temp(1),temp(2))
	  call dix_util_copy(size,temp,data)
	end if	  
	return
	end
	function dix_con_fid_ascint(line,data,size,control)
	implicit none
c
	include 'dix_def.inc'
c
c Convert fileid 
c
	character*(*) line		!:i: the text
	integer*2 data(3)		!:o: the binary data
	integer*4 size			!:i: the size (must be 6)
	integer*4 control
	logical*4 dix_con_fid_ascint	!:f: the conversion result
c#
	integer*4 fnr,fseq,vol,ipos
	integer*2 tdata(3)

	structure /v2v4/
	  union
	    map
	      integer*2 v2(2)
	    end map
	    map
	      integer*4 v4
	    end map
	  end union
	end structure
	record /v2v4/ val
c
	character*(max_fid_asc_length) temp
	external dix_msg_invfield
c
	dix_con_fid_ascint = .false.
	ipos = index(line,'(')
	if(ipos .eq. 0) goto 90
c
	temp = line(ipos+1:)
c
	ipos = index(temp,',')
	if(ipos .eq. 0) goto 90
c
	read(temp(1:ipos-1),1000,err=90) fnr
1000	format(bn,i12)
	temp = temp(ipos+1:)
	if(fnr .lt. 0 .or. fnr .gt. 'ffffff'x) goto 90
c
	ipos = index(temp,',')
	if(ipos .eq. 0) goto 90
c
	read(temp(1:ipos-1),1000,err=90) fseq
	temp = temp(ipos+1:)
	if(fseq .lt. 0 .or. fseq .gt. 'ffff'x) goto 90
c
c Not direct assignment because signed/unsigned
c
	val.v4 = fseq
	tdata(2) = val.v2(1)
c
	ipos = index(temp,')')
	if(ipos .eq. 0) goto 90
c
	read(temp(1:ipos-1),1000,err=90) vol
	temp = temp(ipos+1:)
c
	if(vol .lt. 0 .or. vol .gt. 255) goto 90
	tdata(3) = vol
c
	if(temp .ne. ' ') goto 90
c
c Not direct assignment because signed/unsigned
c
	val.v4 = fnr
	tdata(1) = val.v2(1)
c
	val.v4 = iand(ishft(fnr,-8),'FF00'X)
	tdata(3) = tdata(3) .or. val.v2(1)
c
	dix_con_fid_ascint = .true.
c
	size = 6
	call dix_util_copy(size,tdata,data)
	goto 99
c
90	call dix_message(control,dix_msg_invfield,line)	
99	return
	end

	function dix_con_vfc_ascint(line,data,size,control)
	implicit none
c
	include 'dix_def.inc'
c
c Convert vfc field, only the first two bytes are read, they must 
c be a hex number, byte 3 should be space
c
	character*(*) line		!:i: the text
	byte data			!:o: the binary data
	integer*4 size			!:i: the size
	integer*4 control
	logical*4 dix_con_vfc_ascint	!:f: the conversion result
c#
	integer*4 tdata,test		!vax does nmot like IAND on bytes
	external dix_msg_invvfc
c
c Accepatable data, see the rms service reference manual page 4.25
c  bit  7 6 5 4
c       0 0 0 0  Null oke
c       0 x x x  nnn new lines oke
c       1 0 0 x  co codes 0..31 oke
c       1 0 1 x  Illegal            1
c       1 1 0 0  VFU formats oke
c       1 1 0 1  Illegal            2
c       1 1 1 0  Illegal            3
c
	dix_con_vfc_ascint = .false.
	if(line(3:3) .ne. ' ') goto 80
	read(line(1:2),2000,err=80) tdata
2000	format(z2.2)
c
c Check for the reserved types
c
	test = iand(tdata,'E0'x)
	if(test .eq. 'A0'X) goto 80 		!illegal 1
	test = iand(tdata,'F0'x)
c
	if(test .eq. 'D0'X) goto 80		!illegal 2
	if(test .eq. 'E0'X) goto 80		!illegal 3
c
	dix_con_vfc_ascint = .true.
	size = 1
	call dix_util_copy(size,tdata,data)
	goto 90
c
80	call dix_message(control,dix_msg_invvfc,line)	
c
90	return
	end
c
	function dix_con_prot_ascint(line,data,size,control)
	implicit none
c
c Convert protection 
c
	character*(*) line		!:i: the text
	byte data(*)			!:o: the binary data
	integer*4 size			!:i: the size (should be 2)
	integer*4 control
	logical*4 dix_con_prot_ascint	!:f: function result
c#
	logical*4 dix_con_prot_ascint_1
c
	integer*4 prot,ibpos,iepos,k,offs,flag
c
	dix_con_prot_ascint = .false.
c
	prot = 'FFFF'X			!default all off
	ibpos = 1
	flag = control		!to prevent warnings
	flag = 0
c
	do while(ibpos .le. len(line))
	  iepos = index(line(ibpos:) ,',')
	  if(iepos .eq. 0) then
	    iepos = len(line)
	  else
	   iepos = ibpos + iepos-2
	  end if
	  if(.not.  dix_con_prot_ascint_1(line(ibpos:iepos),k,
     1                offs,control)) goto 90
	  if(btest(flag,offs)) goto 90
	  flag = ibset(flag,offs)		!signal already used
	  call lib$insv(k,offs,4,prot)
	  ibpos = iepos + 2
	end do
	dix_con_prot_ascint = .true.
	call dix_util_copy(size,prot,data)
c
90	return
	end
	function dix_con_prot_ascint_1(line,val,offs,control)
	implicit none
c
c Convert a piece of the prot string
c
	character*(*) line		!:i: the text
	integer*4 val			!:o: the binary data
	integer*4 offs			!:i: the offset
	integer*4 control
	logical*4 dix_con_prot_ascint_1 !:f: conversion result
c#
	character type
	integer*4 k,ipos,l
	external dix_msg_typdoubl
	external dix_msg_typunkn
	external dix_msg_protdoubl
	external dix_msg_invprot
c
	dix_con_prot_ascint_1 = .false.

c
	ipos = index(line,':')
	if(ipos .eq. 0) ipos = len(line)+1
c
	type = ' '
	do k=1,ipos-1
	  if(line(k:k) .ne. ' ') then
	    if(type .ne. ' ') goto 80
	    type = line(k:k)
	  end if
	end do
c
	offs = -1
	if(type .eq. 'S' .or. type .eq. 's')offs = 0
	if(type .eq. 'O' .or. type .eq. 'o')offs = 4
	if(type .eq. 'G' .or. type .eq. 'g')offs = 8
	if(type .eq. 'W' .or. type .eq. 'w')offs = 12
	if(offs .lt. 0) goto 82
c
	ipos = index(line,':')
	val  = 15				!default disabled
	if(ipos .eq. 0) goto 20
	do k=ipos+1,len(line)
	  if(line(k:k) .eq. ' ') goto 20
	  l = -1
	  if(line(k:k) .eq. 'R' .or. line(k:k) .eq. 'r') l = 0
	  if(line(k:k) .eq. 'W' .or. line(k:k) .eq. 'w') l = 1
	  if(line(k:k) .eq. 'E' .or. line(k:k) .eq. 'e') l = 2
	  if(line(k:k) .eq. 'D' .or. line(k:k) .eq. 'd') l = 3
	  if(l .lt. 0) goto 84
c
	  if(.not. btest(val,l)) goto 86		!if reset, then error (double)
	  val = ibclr(val,l)
	end do
c
20	dix_con_prot_ascint_1 = .true.
	goto 90
80	call dix_message(control,dix_msg_typdoubl,type)
	goto 90
82	call dix_message(control,dix_msg_typunkn,type)
	goto 90
84	call dix_message(control,dix_msg_invprot,line(k:k))
	goto 90
86	call dix_message(control,dix_msg_protdoubl,line(k:k))
90	return
	end

	function dix_con_bits_ascint(line,data,size,fldnam,reverse,
     1                               control,readonly)
	implicit none
c
	include 'dix_def.inc'
c
c Convert bits 
c
	character*(*) line		!:i: the text data
	byte data(*)                    !:o: the result 
	integer*4 size                  !:i: #bits in result
	character*(*) fldnam            !:i: fieldnames
	integer*4 control
	logical*4 reverse		!:i: reverse values?
	logical readonly		!:i: readonly field?
	logical*4 dix_con_bits_ascint	!:f: conversion result
c#
	logical*4 dix_util_get_field
	integer*4 str$case_blind_compare
	logical*4 dix_smg_select_field
	external dix_msg_invbits
c
	integer*4 ibpos,iepos,hulp(2),nkar,offset,nk_f,nb,nk
	logical*4 neg
	character*(max_symbol_name_length) field
	character*(max_short_line_length) tline
c
	ibpos = 1
	nkar = len(line)
	hulp(1) = 0
	hulp(2) = 0
	neg = .false.
c
	nb = (size+7)/8
c
	if(line(1:1) .eq. '?') then
	  if(dix_smg_select_field(control,data,size,.true.,
     1              fldnam,reverse,.true.,readonly)) goto 75
	  goto 85
	endif
	if(line(1:1) .eq. '+') then
	  call dix_util_copy(nb,data,hulp)
	  ibpos = 2
	elseif(line(1:1) .eq. '-') then
	  call dix_util_copy(nb,data,hulp)
	  ibpos = 2
	  neg = .true.
	else
	  ibpos = 1
	end if
c
c For reverse bits inverse all bits
c
	if(reverse) then
	  hulp(1) = .not. hulp(1)
	  hulp(2) = .not. hulp(2)
	end if
c
10	iepos = index(line(ibpos:),',')
	if(iepos .eq. 0) then
	  iepos = nkar
	else
	  iepos = iepos+ibpos-2
	endif
c
	if(iepos .ge. ibpos) then
	  call str$upcase(tline,line(ibpos:iepos))
c
	  nk = iepos-ibpos+1
	  call dix_util_left_just(tline,nk)
c
c Ignore # fields
c
	  if(tline .eq. '#') goto 18
c
c First see if name to be found
c
	  if(tline .eq. '%ALL') then
	    hulp(1) = 'ffffffff'X
	    hulp(2) = 'ffffffff'X
	    goto 18
	  end if
	  do offset=0,size-1
c
c Try to extract fieldname
c
	    if(dix_util_get_field(offset,fldnam,field,nk_f)) then
c
c Got the field name, no compare
c
	      nk_f = min(nk_f,nk)
	      if(str$case_blind_compare(field(1:nk_f),
     1             tline(1:nk_f)) .eq. 0) goto 16
	    end if
	  end do
c
c Could not find field, so must be integer
c
	  read(tline(1:nk),2000,err=14) offset
2000	  format(bn,i2)
	  goto 16
14	  if(nk .gt. 3 .and. tline(1:3) .eq. 'BIT') then
	    read(tline(4:nk),2000,err=80) offset
	  else
	    goto 80
	  end if
16	  if(offset .lt. 0 .or. offset .ge. size) goto 80
	  if(neg) then
	    call clear_bit(offset,hulp)
	  else
	    call set_bit(offset,hulp)
	  end if
	endif
18	ibpos = iepos+2
	if(ibpos .le. nkar) goto 10
c
	if(reverse) then
	  hulp(1) = .not. hulp(1)
	  hulp(2) = .not. hulp(2)
	end if
	call dix_util_copy(nb,hulp,data)
75	dix_con_bits_ascint = .true.
	goto 90
80	call dix_message(control,dix_msg_invbits,tline(1:nk))
85	dix_con_bits_ascint = .false.
c
90	return
	end

	function dix_con_chr_ascint(line,data,size,control,case)
	implicit none
	include 'dix_def.inc'
c
c Convert chars
c
	character*(*) line		!:i: the input data
	byte data(*)                    !:o: the output data
	integer*4 size			!:i: length of data
	record /control/ control        !:i: control block
	integer*4 case			!:i: case parameter
	logical*4 dix_con_chr_ascint    !:f: conversion error
c#
	integer*4 k,ipos,val,jpos
	character kar
	character dix_util_upcase_kar
	character dix_util_locase_kar
	integer*4 dix_util_c0_kar
	integer*4 dix_util_c1_kar
c
	external dix_msg_invfanst
	external dix_msg_invhexst
c
	ipos = 1
	do k=1,size
	  if(ipos .gt. len(line)) then
	    kar = ' '
	  else
	    kar = line(ipos:ipos)
	    ipos = ipos + 1
	    if(control.include_binary .eq. include_binary_fancy) then
	      if(kar .eq. '<') then
	        if(line(ipos:ipos) .eq. '<') then
c
c Two < means insert only one
c
	          ipos = ipos + 1
	        else
c
c Now the rest must be a valid c0/c1 name
c
	          jpos = index(line(ipos:),'>')
	          if(jpos .eq. 0) goto 70
	          val = dix_util_c0_kar(line(ipos:ipos+jpos-2))
	          if(val .lt. 0) val = dix_util_c1_kar(line(ipos:ipos+jpos-2))
	          if(val .lt. 0) goto 70
	          kar = char(val)
	        endif
	      endif
	    elseif(control.include_binary .eq. include_binary_hex) then
	      if(kar .eq. '%') then
	        if(line(ipos:ipos) .eq. '%') then
c
c Two < means insert only one
c
	          ipos = ipos + 1
	        else
c
c Now the rest must be a valid hex construct Xdd
c                
	          if(line(ipos:ipos) .ne. 'X') goto 80
	          read(line(ipos+1:ipos+2),2000,err=80) val
2000	          format(z2)
	          kar = char(val)
	          ipos = ipos + 3
	        endif
	      endif
	    else
c
c _bin and _dot do the same, just move the character
c  n.b. for the _dot the conversoin will lose info about unprintables
c       they were changes to . , and now the back conversion leaves the .
c       and does not know the original value any more
c
	    endif
	  endif
	  if(case .eq. des_flag_case_lower) then
	    data(k) = ichar(dix_util_locase_kar(kar))
	  elseif(case .eq. des_flag_case_upper) then
	    data(k) = ichar(dix_util_upcase_kar(kar))
	  else
	    data(k) = ichar(kar)
	  endif
	enddo
	dix_con_chr_ascint = .true.
	goto 90
c
c Invalide fancy name
c
70	dix_con_chr_ascint = .false.
	if(jpos .eq. 0) jpos = 4
	call dix_message(control,dix_msg_invfanst,line(ipos-1:ipos+jpos-1))
	goto 90
c
c Invalide hex construct
c
80	dix_con_chr_ascint = .false.
	call dix_message(control,dix_msg_invhexst,line(ipos-1:ipos+2))
c
90	return
	end

	function dix_con_decimal_ascint(line,data,size,control,
     1                                  unsigned,flags)
	implicit none
	include 'dix_def.inc'
c
c Convert decimal strings 
c  syntax [sign]dddddd[E[expsign]dddd]
c
	character*(*) line              !:i: text
	byte data(*)                    !:o: data
	integer*4 size                  !:o: size
	integer*4 control               !:i: control block
	logical*4 unsigned		!:i: unsigned?
	integer*4 flags			!:i: other flags
	logical*4 dix_con_decimal_ascint
c#
	integer*4 k,nk,nk1,pos_fract,pos_expon
	character sign,exp_sign,last_char
c
	external dix_msg_decsignpos
	external dix_msg_decdupsig
	external dix_msg_decdupexp
	external dix_msg_dectoobig
	external dix_msg_decillchr
	external dix_msg_invsign
	external dix_msg_invfract
	external dix_msg_invexpon
c
	sign = ' '
	dix_con_decimal_ascint = .false.
	exp_sign = ' '
	pos_expon = 0
	pos_fract = 0 
	nk = 0
c
c First check
c
	last_char = ' '
	do k=1,len(line)
	  if(line(k:k) .eq. '+' .or. line(k:k) .eq. '-') then
	    if(unsigned) then
	      call dix_message(control,dix_msg_invsign,line)
	      goto 90
	    endif
	    if(last_char .ne. ' ') then
	      call dix_message(control,dix_msg_decsignpos,line)
	      goto 90
	    endif
	    if(pos_expon .ne. 0) then
c
c We saw the exponent, check for exponent sign
c
	      if(exp_sign .ne. ' ') then
	        call dix_message(control,dix_msg_decdupsig,line)
	        goto 90
	      endif
	      exp_sign = line(k:k)
	    else
	      if(sign .ne. ' ') then
	        call dix_message(control,dix_msg_decdupsig,line)
	        goto 90
	      endif
	      sign = line(k:k)
	    endif	   
	    nk = nk + 1
	    last_char = 'x'
	  elseif(line(k:k) .eq. '.') then
c
c Fraction separator
c
	    if((flags .and. des_flag_decimal_fraction) .eq. 0) then
	      call dix_message(control,dix_msg_invfract,line)
	      goto 90
	    endif
	    if(pos_fract .ne. 0 .or. pos_expon .ne.  0) then
	      call dix_message(control,dix_msg_invfract,line)
	      goto 90
	    endif
	    pos_fract = k
c
	  elseif(line(k:k) .eq. 'E' .or. line(k:k) .eq. 'e') then
	    if((flags .and. des_flag_decimal_exponent) .eq. 0) then
	      call dix_message(control,dix_msg_invexpon,line)
	      goto 90
	    endif
	    if(pos_expon .ne. 0) then
	      call dix_message(control,dix_msg_decdupexp,line)
	      goto 90
            endif
	    last_char = ' '
	    pos_Expon = k
	    nk = nk + 1
	  elseif(line(k:k) .ge. '0' .and. line(k:k) .le. '9') then
	    nk = nk + 1
	    last_char = 'x'
	  elseif(line(k:k) .ne. ' ') then 
	    call dix_message(control,dix_msg_decillchr,line)
	    goto 90
	  endif
	end do
c
c Now we need a length of nk chars (if sign='+') one less would do also
c	
	if(sign .eq. '+') nk = nk - 1
c
c Check it the size fits
c
	if(nk .gt. size) then
	  call dix_message(control,dix_msg_dectoobig,line)
	  goto 90
	endif
c
c Insert the chars
c 1. the - sign
c
	nk1 = 0
	if((flags .and. des_flag_decimal_zerofill) .ne. 0) then
c
c Zero fill
c
	  if(sign .eq. '-') then
	    nk1 = 1
	    data(1) = ichar('-')
	  endif
c
c 2. the leading zero's
c
	  do k=nk+1,size
	    nk1 = nk1 + 1
	    data(nk1) = ichar('0')	  
          end do
	else
c
c The blank filled data
c 
	  if((flags .and. des_flag_decimal_leftjust) .eq. 0) then
c
c Not left justified
c
	    do k=nk+1,size
	      nk1 = nk1 + 1
	      data(nk1) = ichar(' ')
	    enddo
	    if(sign .eq. '-') then
	      data(nk1) = ichar('-')
	    endif
	  else
	    if(sign .eq. '-') then
	       nk1 = nk1 + 1
	       data(nk1) = ichar('-')
	    endif
	  endif
	endif
c
c 3. the data
c
	do k=1,len(line)
	  if(line(k:k) .ne. ' ') then
	    nk1 = nk1 + 1
	    data(nk1) = ichar(line(k:k))
	  endif
	end do
c
c Set trailing blanks
c
	do k=nk1+1,size
	  data(k) = ichar(' ')
	end do
	dix_con_decimal_ascint = .true.
c
90	return
	end

	function dix_con_str_ascint(line,data,size,nb_f,control,case)
	implicit none
c
c Convert string type
c size if either 0, (length of line determines size)
c  or <>0, we have a fixed size
c the result will be in nb_f
c
	character*(*) line		!:i: the text
	byte data(*)			!:o: the binary data
	integer*4 size			!:i: size
	integer*4 nb_f			!:o: actual size
	integer*4 control
	integer*4 case			!:i: case parameter
	logical*4 dix_con_str_ascint	!:f: conversion result
c#
	logical*4 dix_con_chr_ascint
c
c Save size in byte
c
	if(size .eq. 0) then
	  nb_f = min(len(line)+1,256)
	  size = nb_f
	else
	  nb_f = size
	  size = min(size,len(line)+1)
	end if
	call dix_util_copy(1,size-1,data)
	dix_con_str_ascint = dix_con_chr_ascint(line,data(2),nb_f-1,
     1                         control,case)
	return
	end

	function dix_con_wstr_ascint(line,data,size,nb_f,control,case)
	implicit none
c
c Convert wstring (word counted string)
c size if either 0, (length of line determines size)
c  or <>0, we have a fixed size
c the result will be in nb_f
c
	character*(*) line		!:i: the text
	byte data(*)			!:o: th  binary data
	integer*4 size			!:i: the size
	integer*4 nb_f			!:o: actual length
	integer*4 control
	integer*4 case			!:i: case parameter
	logical*4 dix_con_wstr_ascint	!:f: conversion result
c#
	logical*4 dix_con_chr_ascint
c
	if(size .eq. 0) then
	  nb_f = len(line)+2
	  size = nb_f
	else
	  nb_f = size
	  size = min(size,len(line)+2)
	end if
	call dix_util_copy(2,size-2,data)
	dix_con_wstr_ascint = dix_con_chr_ascint(line,data(3),nb_f-2,
     1                  control,case)
c
	return
	end
	function dix_con_lstr_ascint(line,data,size,nb_f,control,case)
	implicit none
c
c Convert lstring (longword counted string)
c size if either 0, (length of line determines size)
c  or <>0, we have a fixed size
c the result will be in nb_f
c
	character*(*) line		!:i: the text
	byte data(*)			!:o: the  binary data
	integer*4 size			!:i: the size (or 0)
	integer*4 nb_f			!:o: actual length
	integer*4 case			!:i: case parameter
	integer*4 control
	logical*4 dix_con_lstr_ascint	!:f: conversion result
c#
	logical*4 dix_con_chr_ascint
c
	if(size .eq. 0) then
	  nb_f = len(line)+4
	  size = nb_f
	else
	  nb_f = size
	  size = min(size,len(line)+4)
	end if
	call dix_util_copy(4,size-4,data)
	dix_con_lstr_ascint = dix_con_chr_ascint(line,data(5),nb_f-4,
     1                       control,case)
c
	return
	end

	function dix_con_hstr_ascint(line,data,size,nb_f,control,case)
	implicit none
c
c Conver hstring (string terminated with byte that has high bit set)
c size if either 0, (length of line determines size)
c  or <>0, we have a fixed size
c the result will be in nb_f
c
c
	character*(*) line		!:i: the text
	byte data(*)			!:o: binary data
	integer*4 size			!:i: length
	integer*4 nb_f			!:o: actual length
	integer*4 control
	integer*4 case			!:i: case parameter
	logical*4 dix_con_hstr_ascint	!:f: conversion result
c#
	logical*4 dix_con_chr_ascint
c
c Terminate string with hex 80
c
	if(size .eq. 0) then
	  nb_f = len(line)
	  size = nb_f
	else
	  nb_f = size
	  size = min(size,len(line))
	end if
c
	dix_con_hstr_ascint = dix_con_chr_ascint(line,data,nb_f,
     1                 control,case)
	data(size) = data(size) .or. '80'X
90	return
	end
	function dix_con_zstr_ascint(line,data,size,nb_f,control,case)
	implicit none
c
c Convert zstring (string with terminating 0)
c
c size if either 0, (length of line determines size)
c  or <>0, we have a fixed size
c the result will be in nb_f
c
	character*(*) line		!:i: the text
	byte data(*)			!:o: the binary data
	integer*4 size			!:i: the size
	integer*4 nb_f			!:o: the actual length
	integer*4 control
	integer*4 case		        !:i: case paraemter
	logical*4 dix_con_zstr_ascint	!:f: conversion result
c#
	integer*4 k
c
	logical*4 dix_con_chr_ascint
c
c Terminate string with hex 00
c
	if(size .eq. 0) then
c
c Variable length
c
	  nb_f   = len(line)+1
	  size   = nb_f
	else
c
c Fixed length
c
	  nb_f   = size
	  size   = min(size,len(line)+1)
	end if
c
	dix_con_zstr_ascint = dix_con_chr_ascint(line,data,nb_f,
     1                   control,case)
c
c  Fill the rest with 0
c
	do k=size,nb_f
	  data(k) = 0
	end do
90	return
	end
	function dix_con_acl_ascint(line,data,size,nb_f,control)
	implicit none
c
c COnvert acl 
c
	character*(*) line		!:i: the text	
	byte data(*)			!:o: binary data
	integer*4 size			!:i: size (unused)
	integer*4 nb_f			!:o: actual length
	integer*4 control
	logical*4 dix_con_acl_ascint	!:f: conversion result
c#
	integer descr(2)
	integer sys$parse_acl
	external dix_msg_invacl
c
	descr(1) = 0
	descr(2) = %loc(data)
c
	nb_f = size		!to prevent compiler warnings
	dix_con_acl_ascint = sys$parse_acl(line,descr,,,)
	if(.not. dix_con_acl_ascint) 
     1       call dix_message(control,dix_msg_invacl,line)
	nb_f = descr(1)
	return
	end
	function dix_con_diskmap_ascint(line,data,size,nb_f,control)
	implicit none
c
c Convert diskmap entry
c
	character*(*) line		!:i: the text
	byte data(*)			!:o: binary data
	integer*4 size			!:i: the size
	integer*4 nb_f			!:o: actual length
	integer*4 control
	logical*4 dix_con_diskmap_ascint!:f: conversion result
c#
	integer k,n,count,begblk,endblk,bltyp,ipos,kpos
	external dix_msg_invdmap
c
	dix_con_diskmap_ascint = .false.
c
	nb_f = size		!to prevent compiler warning
	if(line(1:2) .eq. 'P:') then
c
c Type 0, placement type
c Syntax PL: xx xx xx
c
	  n = 3
	  nb_f = 0
	  do while(n+2 .lt. len(line))
	    nb_f = nb_f + 1
	    read(line(n+1:n+2),2020,err=90) data(nb_f)
2020	    format(z2)
	    n = n + 3
	  enddo
	  goto 80
	elseif(line(1:2) .eq. 'T:') then
	  read(line(3:3),2000,err=90) bltyp
2000	  format(i12)
	  k = 5
	  if(bltyp .lt. 1.or. bltyp .gt. 3) goto 90
	else 
	  k = 1
	  bltyp = 0
	endif
	ipos = index(line,'-')
	kpos = index(line,'(')
	if(kpos .eq. 0) kpos = len(line) + 1
	if(ipos .eq. 0) goto 90
	read(line(k     :ipos-1),2000,err=90) begblk
	read(line(ipos+1:kpos-1),2000,err=90) endblk
	count = endblk-begblk		!0 mens one block
	if(bltyp .eq. 0) then
c
c Automatic nb_f, let DIX decide on format
c
	  if(count .le. 255 .and. begblk .le. '3fffff'X) then
	    bltyp = 1
	  else
	    if(count .le. '3fff'x) then
	      bltyp = 2
	    elseif(count .le. '3fffffff'x) then
	      bltyp = 3
	    endif
	  endif
	endif
c
c Now check on bltyp
c
	if(bltyp .eq. 1) then
c
c Type 1: 8 bits count and 22 bits blocknr
c    bit 111111
c        5432109876543210
c word1  tpNNNNNNCCCCCCCC  
c word2  NNNNNNNNNNNNNNNN
c
	  if(count .gt. 255) goto 90
	  if(begblk .gt. '3fffff'x) goto 90
	  k = ishft(begblk,-16)
	  k = ishft(k,8)
	  k = '4000'x .or. k .or. count
	  call lib$movc3(2,k,data(1))
	  k = iand(begblk,'ffff'x)	    
	  call lib$movc3(2,k,data(3))
	  nb_f = 4
	elseif(bltyp .eq. 2) then
c
c Type 2: 14 bits count and 32 bits blocknr
c    bit 111111
c        5432109876543210
c word1  tpCCCCCCCCCCCCCC  
c word2  NNNNNNNNNNNNNNNN
c word3  NNNNNNNNNNNNNNNN
c
	  if(count .gt. '3fff'x) goto 90
	  k = '8000'x .or. iand(count,'3fff'x)
	  call lib$movc3(2,k,data(1))
c              
	  call lib$movc3(4,begblk,data(3))
	  nb_f = 6
	elseif(bltyp .eq. 3) then
c
c Type 3: 30 bits count and 32 bits blocknr
c word1  tpCCCCCCCCCCCCCC  
c word2  CCCCCCCCCCCCCCCC
c word3  NNNNNNNNNNNNNNNN
c word4  NNNNNNNNNNNNNNNN
c
	  if(count .gt. '3fffffff'x) goto 90
          k = 'c000'X .or. ishft(count,-16)
          call lib$movc3(2,k,data(1))
          k = iand(begblk,'ffff'x)
          call lib$movc3(2,k,data(3))
	  call lib$movc3(4,begblk,data(5))
	  nb_f = 8
	endif
80	dix_con_diskmap_ascint = .true.
	goto 99
90	call dix_message(control,dix_msg_invdmap,line)
99	return
	end
	function dix_con_i4(data,nkar_data,data_out,hex_first,
     1                      control,signed)
	implicit none
c
	include 'dix_def.inc'
c
c Easy routine for asc to int*4
c It tries to convert in a lot of ways
c
	character*(*) data		!:i: the text data
	integer*4 nkar_data             !:i: #chars                  	
	integer*4 data_out             !:o: the data
	logical*4 hex_first             !:i: try hex first
	integer*4 control
	logical signed
	integer*4 dix_con_i4		!:f: conversion result
c#
	integer*4 lib$convert_date_string
	integer*4 sys$asctoid
	integer*4 dix_con_uic_ascint
	external dix_msg_convi4dt
	external dix_msg_convid
	external dix_msg_convuic
	external dix_msg_convtext
c
	integer*4 ots$cvt_ti_l		!signed
	integer*4 ots$cvt_tu_l          !unsigned
	integer*4 ots$cvt_to_l          !octal
	integer*4 ots$cvt_tz_l          !hex
	integer*4 ots$cvt_tb_l          !binary
c
	integer*4 istat,vmstim(2),k,data4
	character*(max_int_asc_length) tline
c
c if nkar_data=0 then value=0
c
	if(nkar_data .eq. 0) then
	  data4 =0
	  istat = 1
	else
c
c Fist try as integer
c
	  if(hex_first) then
	    istat = ots$cvt_tz_l(data(1:nkar_data),data4)
	  else
	    if(signed) then
	      istat = ots$cvt_ti_l(data(1:nkar_data),data4)
	    else
	      istat = ots$cvt_tu_l(data(1:nkar_data),data4)
	    endif
	  end if
	  if(istat) goto 19
c
	  if(nkar_data .gt. 2) then
	    if(data(1:2) .eq. '%X' .or.
     1         data(1:2) .eq. '%x') then
	      istat = ots$cvt_tz_l(data(3:nkar_data),data4)
	    elseif(data(1:2) .eq. '%O' .or.
     1             data(1:2) .eq. '%o') then
	      istat = ots$cvt_to_l(data(3:nkar_data),data4)
	    elseif(data(1:2) .eq. '%B' .or.
     1             data(1:2) .eq. '%b') then
	      istat = ots$cvt_tb_l(data(3:nkar_data),data4)
	    elseif(data(1:2) .eq. '%D' .or.
     1             data(1:2) .eq. '%d') then
	      if(signed) then
	        istat = ots$cvt_ti_l(data(3:nkar_data),data4)
	      else
	        istat = ots$cvt_tu_l(data(3:nkar_data),data4)
	      endif
	    else
	      istat = 0
	    end if
	    if(istat) goto 19
	  end if
c
c try format 'dddd'B
c
11	  if(data(1:1) .eq. '''') then
	    do k=2,nkar_data-1
	      if(data(k:k) .eq. '''') then
	        if(data(k+1:k+1) .eq. 'X' .or. data(k+1:k+1) .eq. 'x') then
	          istat = ots$cvt_tz_l(data(2:k-1),data4)
	        elseif(data(k+1:k+1) .eq. 'O' .or. data(k+1:k+1) .eq. 'o') then
	          istat = ots$cvt_to_l(data(2:k-1),data4)
	        elseif(data(k+1:k+1) .eq. 'D' .or. data(k+1:k+1) .eq. 'd') then
	          if(signed) then
	            istat = ots$cvt_ti_l(data(2:k-1),data4)
	          else
	            istat = ots$cvt_tu_l(data(2:k-1),data4)
	          endif
	        elseif(data(k+1:k+1) .eq. 'B' .or. data(k+1:k+1) .eq. 'b') then
	          istat = ots$cvt_tb_l(data(2:k-1),data4)
	        else
	          istat = 0
	        endif
	        if(istat) goto 19
	        goto 111
	      endif
	    end do
	  endif
	  
c
c integer conversion did not success, so try date format
c
111	  call str$upcase(tline,data(1:nkar_data))
	  istat = lib$convert_date_string(tline(1:nkar_data),vmstim,,123)
	  if(.not. istat) goto 12
	  call lib$ediv(600000000,vmstim,data4,istat)
	  call dix_message(control,dix_msg_convi4dt,
     1         data(1:nkar_data),%val(data4),%val(data4))
	  goto 19
c
c did not succeed for data, so try identifier format
c
12	  istat = sys$asctoid(data(1:nkar_data),data4,)
	  if(.not. istat) goto 14
	  call dix_message(control,dix_msg_convid,
     1         data(1:nkar_data),%val(data4),%val(data4))
	  goto 19
c
c did not succeed, try as uic
c
14	  istat = dix_con_uic_ascint(data(1:nkar_data),
     1            data4,4*8,control,.false.)
	  if(.not. istat) goto 18
	  call dix_message(control,dix_msg_convuic,
     1         data(1:nkar_data),%val(data4),%val(data4))
	  goto 19
c
c Try as ascii
c
18	  if(data(1:1) .eq. '''' .or. data(1:1) .eq. '"') then
	    call dix_util_copy(4,%ref(data(2:2)),data4)
	    call dix_message(control,dix_msg_convtext,
     1         data(1:nkar_data),%val(data4),%val(data4))
	    goto 19
	  end if
c
c No more options, failed
c
	  istat = 0
	  goto 99
	end if
c
c  ok
c
19	data_out = data4
c
99	dix_con_i4 = istat
	return
	end

	function dix_con_hex_ascint(value,data,offset,size,typ,control)
	implicit none
c
c convert to hex bytes
C if string than separated by spaces and ascending index
C else descending index
c
	character*(*) value	!:i: the text
	byte data(*)		!:o: the data
	integer*4 size		!:i: length of data in bits
	integer*4 offset	!:i: offset in bits
	integer*4 typ		!:i: the data type
	integer*4 control
	logical*4 dix_con_hex_ascint	!:F: Fale in conv error
c#
c local vars
c
	include 'dix_def.inc'
c
	logical*4 dix_con_typ_is_text
	external dix_msg_invhexv
	external dix_msg_toobigu
	logical*4 dix_con_check_size
c
	integer*4 k,ipos,offs,nbtod,nk_str,nb1
	byte hulp(16)
	logical*4 ascii
	byte tmp
	integer*4 dix_util_get_len_fu
c
	ascii = dix_con_typ_is_text(typ)
c
c In 2 phases, first to check for legality.
c
	nk_str = dix_util_get_len_fu(value)
	if(nk_str .lt. 0) nk_str =  len(value)
c
c THe layout is DD DD DD DD DD D DD 
c
	ipos = 1
c
c See if it fits anyhow
c
c Check if value HEX data
c
	nb1 = 0
	do while(ipos .le. nk_str)
	  if(value(ipos:ipos) .eq. ' ') then
	    ipos = ipos + 1
	  else
	    if(ipos .eq. nk_str .or. 
     1         value(ipos+1:ipos+1) .eq. ' ') then
c
c Single digit 
c
	      read(value(ipos:ipos),2001,err=80) tmp
2001	      format(z1)
	      ipos = ipos + 1
	      nb1 = nb1 + 1
	    else
c
c Double digit
c
	      read(value(ipos:ipos+1),2000,err=80) tmp
2000	      format(z2)
	      ipos = ipos + 2
	      nb1 = nb1 + 1
	    endif
	  endif
	end do
	if(nb1 .gt. size/bits_per_byte) goto 70
c
c 2nd for real data
c
	if(ascii) then
c
c ascii case, convert ascending 
c Cannot be fielded
c
	  ipos = 1
	  offs = offset/8
c
c
	  do k=1,size/8
10	    if(ipos .le. nk_str) then
	      if(value(ipos:ipos) .eq. ' ') then
	        ipos = ipos + 1
	        goto 10
	      end if
	      if(ipos .eq. nk_str .or. 
     1           value(ipos+1:ipos+1) .eq. ' ') then
c
c Single digit
c
	        read(value(ipos:ipos),2001,err=80) tmp
	        ipos = ipos + 1
	      else
c
c Double digit
c
	        read(value(ipos:ipos+1),2000,err=80) tmp
	        ipos = ipos + 2
	      endif
	    else
	      tmp = ' '
	    end if
c
c Do it directly in the user buffer, it checked already
c
	    data(offs+k) = tmp
	  end do
	else
c
c binary case, convert descending 
c start converting from the end of the string
c max 128 bits
c
	  nbtod = (size+7)/8
	  if(nbtod .gt. 16) goto 70
c
	  do k=1,16
	    hulp(1) = 0	!init all to zero
	  end do
c
	  ipos = nk_str
c
	  do while(ipos .gt. 0)
	    if(value(ipos:ipos) .eq. ' ') then
	      ipos = ipos - 1
	    else
	      if(ipos .eq. 1 .or. value(ipos-1:ipos-1) .eq. ' ') then
c
c Single digit
c
	        read(value(ipos:ipos),2001,err=80) hulp(k)
	        ipos = ipos - 1
	      else
c
c Double digit
c
	        read(value(ipos-1:ipos),2000,err=80) hulp(k)
	        ipos = ipos - 2
	      endif
	      k = k + 1
	    end if
	  end do
c
c And to the result value
c
	  if(.not. dix_con_check_size(control,size,
     1          .false.,hulp,value(1:nk_str))) goto 80
c
c Now move the bits to the target
c
	  call dix_util_insert_bits(hulp,offset,size,data)
	end if
c
	dix_con_hex_ascint = .true.
	goto 90
70	call dix_message(control,dix_msg_toobigu,value(1:nk_str),%val(size))
c
80	dix_con_hex_ascint = .false.
	call dix_message(control,dix_msg_invhexv,value)
90	return
	end	  
	function dix_con_bin_ascint(value,data,offset,size,control)
	implicit none
c
c convert binary data
c
	character*(*) value	!:i: the text
	byte data(*)		!:o: the data
	integer*4 offset	!:i: offset in buffer in bits
	integer*4 size		!:i: length of data
	integer*4 control
	logical*4 dix_con_bin_ascint	!:F: Fale in conv error
c#
c local vars
c
	include 'dix_def.inc'
c
	integer*4 k,l,ipos,offs,nk
c
	external dix_msg_toobigu
	external dix_msg_invbinv
c
	do k=1,len(value)
	  if(value(k:k) .eq. ' ') goto 10
	  if(value(k:k) .ne. '0' .and. value(k:k) .ne. '1') goto 80
	end do
c
10	nk = k-1
	if(nk .gt. size) goto 70
	offs = offset+size-1
c
	do k=1,size
	  l = 0
	  ipos = k-size+nk
	  if(ipos .gt. 0) then
	    if(value(ipos:ipos) .eq. '1') l = 1
	  endif
	  call lib$insv(l,offs,1,data)
	  offs = offs - 1
	end do	
	dix_con_bin_ascint = .true.
	goto 90
c
70	nk = min(nk,50)
	call dix_message(control,dix_msg_toobigu,value(1:nk),%val(size))
c
80	dix_con_bin_ascint = .false.
	call dix_message(control,dix_msg_invbinv,value)
90	return
	end	  
	function dix_con_oct_ascint(value,data,offset,size,control)
	implicit none
c
c convert octal text
c
	character*(*) value	!:i: the text
	byte data(*)		!:o: the data
	integer*4 offset	!:i: offset in buffer in bits
	integer*4 size		!:i: length of data
	integer*4 control
	logical*4 dix_con_oct_ascint	!:F: Fale in conv error
c#
c local vars
c
	include 'dix_def.inc'
c
	integer*4 k,l,ipos,offs,nk,nb,nb_to_do
c
	external dix_msg_toobigu
	external dix_msg_invoctv
c
	nb = 0
c
	do k=1,len(value)
	  if(value(k:k) .eq. ' ') goto 10
	  if(value(k:k) .lt. '0' .or. value(k:k) .gt. '7') goto 80
	  if(nb .eq. 0) then
	    if(value(k:k) .gt. '0') nb = 1
	    if(value(k:k) .gt. '1') nb = 2
	    if(value(k:k) .gt. '3') nb = 3
	  else
	    nb = nb + 3
	  endif
	end do
c
10	ipos = k-1
	if(nb .gt. size) goto 70
	offs = offset
c
	nb_to_do = size
	do while (nb_to_do .gt. 0)
	  l = 0
	  if(ipos .gt. 0) l = ichar(value(ipos:ipos)) - ichar('0')
	  ipos = ipos - 1
	  call lib$insv(l,offs,min(3,nb_to_do),data)
	  offs = offs + 3
	  nb_to_do = nb_to_do - 3
	end do	
	dix_con_oct_ascint = .true.
	goto 90
c
70	nk = min(ipos,50)
	call dix_message(control,dix_msg_toobigu,value(1:nk),%val(size))
c
80	dix_con_oct_ascint = .false.
	call dix_message(control,dix_msg_invoctv,value)
90	return
	end	  

	function dix_con_typ_is_text(typ)
	implicit none
c
c Return true if datatype is "text"
c
	integer*4 typ			!:i: the datatype
	logical*4 dix_con_typ_is_text	!:f: function result
c#
	include 'dix_def.inc'
c
	dix_con_typ_is_text = 
     1          typ .eq. enttyp_chr .or.
     1          typ .eq. enttyp_string .or.
     1          typ .eq. enttyp_wstring .or.
     1          typ .eq. enttyp_lstring .or.
     1          typ .eq. enttyp_hstring .or.
     1          typ .eq. enttyp_zstring
	return
	end
	function dix_con_kar_to_hex(kar,nr)
	implicit none
c
c Convert a char to hex
c
	character*(*) kar		!:i: text char (should be 0-9 or a-f)	
	integer*4 nr			!:o: the binary data
	logical*4 dix_con_kar_to_hex 	!:f: conversion result
c#
	dix_con_kar_to_hex = .false.
	read(kar,'(z1)',err=90) nr
	dix_con_kar_to_hex = .true.
90	return
	end
        function dix_con_overflow(sigargs) !,mechargs)
        implicit none
c
c OVerflow hadler for real conversions
c
        integer*4 sigargs(*)
c       integer*4 mechargs(*)
        integer*4 dix_con_overflow
c#
        include '($ssdef)'
        include '($mthdef)'
c
	logical*4 overflow
        common /dix_con_common/ overflow
c
        integer*4 signal
c
        signal = sigargs(2)
c
        if(signal .eq. ss$_intovf .or.
     1     signal .eq. ss$_intdiv .or.
     1     signal .eq. ss$_fltovf .or.
     1     signal .eq. ss$_fltdiv .or.
     1     signal .eq. ss$_hparith .or.
     1     signal .eq. mth$_floovemat) then
c
c These are traps. Just set the overflow flag and continue
c
          overflow = .true.
          dix_con_overflow = ss$_continue
        elseif(
     1     signal .eq. ss$_fltovf_f .or.
     1     signal .eq. ss$_fltdiv_f) then
c
c These are faults. Normally the execution would be restarted
c and result in the same overflow. To prevent this we unwind the
c stack call frame
c
          overflow = .true.
          dix_con_overflow = ss$_continue
          call sys$unwind(,)
        else
          dix_con_overflow = ss$_resignal
        end if
        return
        end
	function dix_con_value_intasc(control,value,line,nkar,hex)
	implicit none
c
c Convert a value from binary to ascii
c 
	include 'dix_def.inc'
	record /value/ value		!:i: the value
	record /control/ control
	character*(*) line		!:o: the text
	integer*4 nkar			!:o: length of line
	logical hex
	logical dix_con_value_intasc	!:f: conversion result
c#
	record /des_rec/ des_rec
	integer*4 max_len,nk1,expon,k
c
	integer*4 dix_con_intasc
c
	if(value.type .eq. symb_typ_int) then
	  des_rec.ent_type   = enttyp_int
	  des_rec.size       = bits_per_byte*control.integer_size
	  des_rec.bit_offset = bits_per_byte*(%loc(value.ival) - %loc(value)) !i4/i8 overlap
	elseif(value.type .eq. symb_typ_real) then
c
c The real types depend on the platform and the real_size
c            real_size
c  platform   4     8     16
c   vax       f     d      h
c   alpha     f     g      x
c   ipf       s     t      x
c
	  call dix_con_cvt_float_type(control,control.real_size,
     1                                des_rec.ent_type)
	  des_rec.size       = bits_per_byte*control.real_size
	  des_rec.bit_offset = bits_per_byte*(%loc(value.rval) - %loc(value))	!rval/rval8/rval16 overlap
	elseif(value.type .eq. symb_typ_log) then
	  des_rec.ent_type   = enttyp_log
	  des_rec.size       = bits_per_byte*sizeof(value.lval)
	  des_rec.bit_offset = bits_per_byte*(%loc(value.lval) - %loc(value))
	elseif(value.type .eq. symb_typ_date) then
	  des_rec.ent_type   = enttyp_dat
	  des_rec.size       = bits_per_byte*sizeof(value.date)
	  des_rec.bit_offset = bits_per_byte*(%loc(value.date) - %loc(value))
	endif
	des_rec.fldnam.dsc$w_maxstrlen  = 0
	if(value.type .eq. symb_typ_char) then
	  des_rec.ent_type   = enttyp_chr
	  des_rec.size       = bits_per_byte*zext(value.strdes.dsc$w_maxstrlen)
	  des_rec.bit_offset = 0
	  dix_con_value_intasc = dix_con_intasc(des_rec.size,des_rec,
     1                  %val(value.strdes.dsc$a_pointer),
     1                  line,nkar,hex,max_len,control)
	elseif(value.type .eq. symb_typ_decimal) then
	  des_rec.ent_type   = enttyp_decimal
	  des_rec.size       = bits_per_byte*zext(value.strdes.dsc$w_maxstrlen)
	  des_rec.bit_offset = 0
	  dix_con_value_intasc = dix_con_intasc(des_rec.size,des_rec,
     1                  %val(value.strdes.dsc$a_pointer),
     1                  line,nkar,hex,max_len,control)
	  if(value.sign .ne. 0) then
	    line(1:nkar+1) = '-'//line(1:nkar)
	    nkar = nkar + 1
	  endif
	  expon = value.exponent
	  if(expon .gt. 0 .and. expon .lt. 10) then
c
c Append expon zeros
c
	    do k=1,expon
	      nkar = nkar + 1
	      line(nkar:nkar) = '0'
	    end do
	    expon = 0
	  elseif(expon .eq. -nkar) then
	    line(1:nkar+2) = '0.'//line(1:nkar)
	    nkar  = nkar + 1
	    expon = 0
	  elseif(expon .gt. -nkar .and. expon .lt. 0) then
	    line(1:nkar+1) = line(1:nkar+expon)//'.'//line(nkar+expon+1:nkar)
	    nkar  = nkar +1
	    expon = 0
	  endif
c
c If still <>0 , append the Edd part
c
	  if(expon .ne. 0) then
	    call sys$fao('E!SL',nk1,line(nkar+1:),%val(expon))
	    nkar = nkar + nk1
	  endif
	else
	  dix_con_value_intasc = dix_con_intasc(des_rec.size,des_rec,
     1                  value,line,nkar,hex,max_len,control)
	endif
	return
 	end
	subroutine dix_con_cvt_float_type(control,real_size,real_type)
	implicit none
c
	include 'dix_def.inc'
	record /control/ control	!:i: control for the architecture
	integer*4 real_size		!:i: the wanted size (4,8,16)
	integer*4 real_type             !:o: the real_type
c
c Take the approprioate real type
c depending on arc and real_size
c#
	if(control.platform .eq. platform_vax) then
	  if(real_size .eq. 8) then
	    real_type = enttyp_real_d
	  elseif(real_size .eq. 16) then
	    real_type = enttyp_real_h
	  else
	    real_type = enttyp_real_f
	  endif
	elseif(control.platform .eq. platform_alpha) then
	  if(real_size .eq. 8) then
	    real_type = enttyp_real_g
	  elseif(real_size .eq. 16) then
	    real_type = enttyp_real_x
	  else
	    real_type = enttyp_real_f
	  endif
	else		!must be ipf
	  if(real_size .eq. 8) then
	    real_type = enttyp_real_t
	  elseif(real_size .eq. 16) then
	    real_type = enttyp_real_x
	  else
	    real_type = enttyp_real_s
	  endif
	end if
	return
	end
	subroutine dix_con_float_name(type,name)
	implicit none
c
c Return the name of the real_type
c
	include 'dix_def.inc'
	integer*4 type
	character*(*) name
c#
	if(type .eq. enttyp_real_f) then
	  name = 'REAL_F'
	elseif(type .eq. enttyp_real_g) then
	  name = 'REAL_G'
	elseif(type .eq. enttyp_real_d) then
	  name = 'REAL_D'
	elseif(type .eq. enttyp_real_h) then
	  name = 'REAL_H'
	elseif(type .eq. enttyp_real_s) then
	  name = 'REAL_S'
	elseif(type .eq. enttyp_real_t) then
	  name = 'REAL_T'
	elseif(type .eq. enttyp_real_x) then
	  name = 'REAL_X'
	else
	  name = '??????'
	endif
	return
	end
	subroutine dix_con_cvt_float_real_f(control,input_real,
     1                                     output_real,overflow)
	implicit none
c
c Convert the real in the current mode to real_f
c
	include 'dix_def.inc'
	record /control/ control
	integer*2 input_real(*)
	integer*2 output_real(*)
	logical overflow
c#
	integer*4 cur_format,new_format
c
	call dix_con_cvt_float_type(control,control.real_size,cur_format)
	new_format = enttyp_real_f
	if(cur_format .ne. new_format) then
	  call dix_con_cvt_float(control,input_real ,cur_format,
     1                           output_real,new_format,
     1                           overflow)                                                    
	else
	  call dix_util_copy(4,input_real,output_real)
	endif
	return	
	end

	function dix_con_cvt_float(control,input_real,input_format,
     1                         output_real,output_format,
     1                         overflow)
c
c A general convert routine for floating point formats
c  Format can be enttyp_real_F,_G,_D,_H,_S,_T,_X 
c Overflow will be set if the number is too big for the
c  selected format, the real will be clipped to max value
c  and the return value will be set to 3 (info)
c
c Return value
c  dix_con_cvt_float = 0 (illegal format)
c  dix_con_cvt_float = 1 (successfull conversion)
c  dix_con_cvt_float = 3 (Overflow)
c
	include 'dix_def.inc'
	record /control/ control
c
	integer*2 input_real(*)		!:i: the input real
	integer*4 input_format		!:i: the input real format
	integer*2 output_real(*)	!:o: the output real
	integer*4 output_format		!:i: the output real format
	logical*4 overflow		!:o: overflow (exponent will be clipped)
	integer*4 dix_con_cvt_float 	!:f: function result
c#
	integer*4 sign,exponent,mantisse(4),istat,nk
	logical mantisse_zero,is_zero
c
	character*(max_line_length) line
c
	integer*4 dix_con_cvt_float_split
	integer*4 dix_con_cvt_float_merge
c
	istat = 1
	overflow = .false.
c
c Split the input real to fields
c
	istat = dix_con_cvt_float_split(control,
     1                    input_real,input_format,
     1                    sign,exponent,mantisse,
     1                    mantisse_zero,is_zero)
	if(istat) then
c
	  if((control.debug .and. debug_fp) .ne. 0) then
	    call sys$fao('    result : sign !UL exp !UL mantisse !4(9XL)',
     1               nk,line,%val(sign),%val(exponent),
     1               %val(mantisse(1)),
     1               %val(mantisse(2)),
     1               %val(mantisse(3)),
     1               %val(mantisse(4)))
	    call dix_main_print_debug(control,debug_fp,line(1:nk))
	  endif
c
c Now merge the fields to the output value
c
	  istat = dix_con_cvt_float_merge(control,
     1                         sign,exponent,mantisse,
     1                         output_real,output_format,
     1                         overflow,is_zero)
	  if(overflow) istat = 3
	endif
	dix_con_cvt_float = istat
	return
	end
c
	function dix_con_cvt_float_split(control,
     1                    input_real,input_format,
     1                    sign,exponent,mantisse,
     1                    mantisse_zero,is_zero)
	implicit none
c
	include 'dix_def.inc'
	record /control/ control
	integer*2 input_real(*)		!:i: the input real
	integer*4 input_format		!:i: the input real format
	integer*4 sign
	integer*4 exponent
	integer*4 mantisse(4)
	logical*4 mantisse_zero
	logical is_zero
 	integer*4 dix_con_cvt_float_split !:f: function result
c#
c Clear all mantisse bits
c
	integer*4 istat,nk
	character*(max_line_length) line,name
c
	character*(*) fao_str
	parameter (fao_str = '   Input !AS !#(5XW)')
c
	mantisse(1) = 0
	mantisse(2) = 0
	mantisse(3) = 0
	mantisse(4) = 0
c
	istat = 1
	nk    = 0
c
c
	if((control.debug .and. debug_fp) .ne. 0) then
	  call dix_main_print_debug(control,debug_fp,'Real-to-real conversion')
	  call dix_con_float_name(input_format,name)
	endif
c
	if(    input_format .eq. enttyp_real_F) then
	  if((control.debug .and. debug_fp) .ne. 0) then
	    call sys$fao(fao_str,nk,line,name(1:6),
     1            %val(2),%val(input_real(1)),%val(input_real(2)))
	  endif
	  call dix_con_cvt_get_f(input_real,sign,exponent,mantisse,is_zero)
	elseif(input_format .eq. enttyp_real_G) then
	  if((control.debug .and. debug_fp) .ne. 0) then
	    call sys$fao(fao_str,nk,line,name(1:6),
     1            %val(4),%val(input_real(1)),%val(input_real(2)),
     1              %val(input_real(3)),%val(input_real(4)))
	  endif
	  call dix_con_cvt_get_g(input_real,sign,exponent,mantisse,is_zero)
	elseif(input_format .eq. enttyp_real_D) then
	  if((control.debug .and. debug_fp) .ne. 0) then
	    call sys$fao(fao_str,nk,line,name(1:6),
     1            %val(4),%val(input_real(1)),%val(input_real(2)),
     1              %val(input_real(3)),%val(input_real(4)))
	  endif
	  call dix_con_cvt_get_d(input_real,sign,exponent,mantisse,is_zero)
	elseif(input_format .eq. enttyp_real_H) then
	  if((control.debug .and. debug_fp) .ne. 0) then
	    call sys$fao(fao_str,nk,line,name(1:6),
     1            %val(8),%val(input_real(1)),%val(input_real(2)),
     1              %val(input_real(3)),%val(input_real(4)),
     1              %val(input_real(5)),%val(input_real(6)),
     1              %val(input_real(7)),%val(input_real(8)))
	  endif
	  call dix_con_cvt_get_h(input_real,sign,exponent,mantisse,is_zero)
	elseif(input_format .eq. enttyp_real_S) then
	  if((control.debug .and. debug_fp) .ne. 0) then
	    call sys$fao(fao_str,nk,line,name(1:6),
     1            %val(2),%val(input_real(1)),%val(input_real(2)))
	  endif
	  call dix_con_cvt_get_s(input_real,sign,exponent,mantisse,is_zero)
	elseif(input_format .eq. enttyp_real_T) then
	  if((control.debug .and. debug_fp) .ne. 0) then
	    call sys$fao(fao_str,nk,line,name(1:6),
     1            %val(4),%val(input_real(1)),%val(input_real(2)),
     1              %val(input_real(3)),%val(input_real(4)))
	  endif
	  call dix_con_cvt_get_t(input_real,sign,exponent,mantisse,is_zero)
	elseif(input_format .eq. enttyp_real_X) then
	  if((control.debug .and. debug_fp) .ne. 0) then
	    call sys$fao(fao_str,nk,line,name(1:6),
     1            %val(8),%val(input_real(1)),%val(input_real(2)),
     1              %val(input_real(3)),%val(input_real(4)),
     1              %val(input_real(5)),%val(input_real(6)),
     1              %val(input_real(7)),%val(input_real(8)))
	  endif
	  call dix_con_cvt_get_x(input_real,sign,exponent,mantisse,is_zero)
	else
	  call sys$fao(' ** Invalid input conversion type = !UL',
     1                 nk,line,%val(input_format))
	  istat = 0
	endif
	call dix_main_print_debug(control,debug_fp,line(1:nk))
	mantisse_zero = mantisse(1) .eq. 0 .and.
     1                  mantisse(2) .eq. 0 .and.
     1                  mantisse(3) .eq. 0 .and.
     1                  mantisse(4) .eq. 0
	dix_con_cvt_float_split = istat
	return
	end
c
	function dix_con_cvt_float_merge(control,
     1                         sign,exponent,mantisse,
     1                         output_real,output_format,
     1                         overflow,is_zero)
	implicit none
c
	include 'dix_def.inc'
	record /control/ control
	integer*4 sign
	integer*4 exponent
	integer*4 mantisse(4)
	integer*2 output_real(*)
	integer*4 output_format
	logical*4 overflow
	logical*4 is_zero
	integer*4 dix_con_cvt_float_merge
c#
	integer*4 istat,nk
c
	character*(max_line_length) line,name
c
	character*(*) fao_str
	parameter (fao_str = '  Output !AS !#(5XW), overflow=!UB')
c
	nk = 0
	overflow = .false.
c
	istat = 1
c
	if((control.debug .and. debug_fp) .ne. 0) then
	  call dix_con_float_name(output_format,name)
	endif
c
	if(    output_format .eq. enttyp_real_F) then
	  call dix_con_cvt_set_f(sign,exponent,mantisse,
     1                           output_real,overflow,is_zero)
	  if((control.debug .and. debug_fp) .ne. 0) then
	    call sys$fao(fao_str,nk,line,name(1:6),
     1            %val(2),%val(output_real(1)),%val(output_real(2)),
     1            %val(overflow))
	  endif
	elseif(output_format .eq. enttyp_real_G) then
	  call dix_con_cvt_set_g(sign,exponent,mantisse,
     1                           output_real,overflow,is_zero)
	  if((control.debug .and. debug_fp) .ne. 0) then
	    call sys$fao(fao_str,nk,line,name(1:6),
     1            %val(4),%val(output_real(1)),%val(output_real(2)),
     1              %val(output_real(3)),%val(output_real(4)),
     1            %val(overflow))
	  endif
	elseif(output_format .eq. enttyp_real_D) then
	  call dix_con_cvt_set_d(sign,exponent,mantisse,
     1                           output_real,overflow,is_zero)
	  if((control.debug .and. debug_fp) .ne. 0) then
	    call sys$fao(fao_str,nk,line,name(1:6),
     1            %val(4),%val(output_real(1)),%val(output_real(2)),
     1              %val(output_real(3)),%val(output_real(4)),
     1            %val(overflow))
	  endif
	elseif(output_format .eq. enttyp_real_H) then
	  call dix_con_cvt_set_h(sign,exponent,mantisse,
     1                           output_real,overflow,is_zero)
	  if((control.debug .and. debug_fp) .ne. 0) then
	    call sys$fao(fao_str,nk,line,name(1:6),
     1            %val(8),%val(output_real(1)),%val(output_real(2)),
     1              %val(output_real(3)),%val(output_real(4)),
     1              %val(output_real(5)),%val(output_real(6)),
     1              %val(output_real(7)),%val(output_real(8)),
     1            %val(overflow))
	  endif
	elseif(output_format .eq. enttyp_real_S) then
	  call dix_con_cvt_set_s(sign,exponent,mantisse,
     1                           output_real,overflow,is_zero)
	  if((control.debug .and. debug_fp) .ne. 0) then
	    call sys$fao(fao_str,nk,line,name(1:6),
     1            %val(2),%val(output_real(1)),%val(output_real(2)),
     1            %val(overflow))
	  endif
	elseif(output_format .eq. enttyp_real_T) then
	  call dix_con_cvt_set_t(sign,exponent,mantisse,
     1                           output_real,overflow,is_zero)
	  if((control.debug .and. debug_fp) .ne. 0) then
	    call sys$fao(fao_str,nk,line,name(1:6),
     1            %val(4),%val(output_real(1)),%val(output_real(2)),
     1              %val(output_real(3)),%val(output_real(4)),
     1            %val(overflow))
	  endif
	elseif(output_format .eq. enttyp_real_X) then
	  call dix_con_cvt_set_x(sign,exponent,mantisse,
     1                           output_real,overflow,is_zero)
	  if((control.debug .and. debug_fp) .ne. 0) then
	    call sys$fao(fao_str,nk,line,name(1:6),
     1            %val(8),%val(output_real(1)),%val(output_real(2)),
     1              %val(output_real(3)),%val(output_real(4)),
     1              %val(output_real(5)),%val(output_real(6)),
     1              %val(output_real(7)),%val(output_real(8)),
     1            %val(overflow))
	  endif
	else
	  call sys$fao(' ** Invalid output conversion type = !UL',
     1                 nk,line,%val(output_format))
	  istat = 0
	endif
	call dix_main_print_debug(control,debug_fp,line(1:nk))
c
90	dix_con_cvt_float_merge = istat
	return
	end	
c
c Below are routines to extract various parts from the binary data
c
	subroutine dix_con_cvt_get_f(real_val,sign,exponent,mantisse,is_zero)
c
c Get sign,exp, mantisse for float_f
c
	implicit none
	integer*4 real_val
	integer*4 sign
	integer*4 exponent
	integer*4 mantisse(4)
	logical*4 is_zero
c#
	integer*4 lib$extzv
c
	integer*4 mantisse1,mantisse2
c
	sign      = lib$extzv(15, 1,real_val)
	exponent  = lib$extzv( 7, 8,real_val) 
	mantisse1 = lib$extzv( 0, 7,real_val)
	mantisse2 = lib$extzv(16,16,real_val)
	mantisse(1) = ishft(mantisse1,25) + ishft(mantisse2,9)
	is_zero = mantisse(1) .eq. 0 .and. exponent .eq. 0
	if(.not. is_zero) exponent  = exponent - 129
	return
	end
	subroutine dix_con_cvt_get_s(real_val,sign,exponent,mantisse,is_zero)
c
c Get sign,exp, mantisse for float_s
c
	implicit none
	integer*4 real_val(*)
	integer*4 sign
	integer*4 exponent
	integer*4 mantisse(4)
	logical*4 is_zero
c#
	integer*4 lib$extzv
c
	integer*4 mantisse1
c
	sign      = lib$extzv(31, 1,real_val(1))
	exponent  = lib$extzv(23, 8,real_val(1)) 
	mantisse1 = lib$extzv(0 ,23,real_val(1))
	mantisse(1) = ishft(mantisse1,9) 
	is_zero = mantisse(1) .eq. 0 .and. exponent .eq. 0
	if(.not. is_zero) exponent  = exponent - 127
	return
	end
	subroutine dix_con_cvt_get_g(real_val,sign,exponent,mantisse,is_zero)
	implicit none
c
c Get sign,exp, mantisse for float_g
c
	integer*4 real_val(2)
	integer*4 sign
	integer*4 exponent
	integer*4 mantisse(4)
	logical*4 is_zero
c#
	integer*4 lib$extzv
c
	integer*4 mantisse1,mantisse2,mantisse3
c
	sign      = lib$extzv(15,1,real_val(1))
	exponent  = lib$extzv(4,11,real_val(1))
c
	mantisse1 = lib$extzv( 0, 4,real_val(1))
	mantisse2 = lib$extzv(16,16,real_val(1))
	mantisse3 = lib$extzv( 4,12,real_val(2))
	mantisse(1) = ishft(mantisse1,28) + ishft(mantisse2,12) +mantisse3
c
	mantisse1 = lib$extzv(0 ,4,real_val(2) )
	mantisse2 = lib$extzv(16,16,real_val(2) )
	mantisse(2) = ishft(mantisse1,28) + ishft(mantisse2,12)
c
	is_zero = mantisse(1) .eq. 0 .and. mantisse(2) .eq. 0 .and.
     1            exponent .eq. 0
	if(.not. is_zero) exponent  = exponent - 1025
c
	return
	end
	subroutine dix_con_cvt_get_d(real_val,sign,exponent,mantisse,is_zero)
	implicit none
c
c Get sign,exp, mantisse for float_d
c
	integer*4 real_val(2)
	integer*4 sign
	integer*4 exponent
	integer*4 mantisse(4)
	logical*4 is_zero
c#
	integer*4 lib$extzv
c
	integer*4 mantisse1,mantisse2,mantisse3
c
	sign      = lib$extzv(15, 1,real_val(1))
	exponent  = lib$extzv( 7, 8,real_val(1)) 
c
	mantisse1 = lib$extzv( 0, 7,real_val(1))
	mantisse2 = lib$extzv(16,16,real_val(1))
	mantisse3 = lib$extzv( 7, 9,real_val(2))
	mantisse(1) = ishft(mantisse1,25) + ishft(mantisse2,9) + mantisse3
c
	mantisse1 = lib$extzv( 0, 7,real_val(2))
	mantisse2 = lib$extzv(16,16,real_val(2))
	mantisse(2) = ishft(mantisse1,25) + ishft(mantisse2,9)
c
c
	is_zero = mantisse(1) .eq. 0 .and. mantisse(2) .eq. 0 .and.
     1            exponent .eq. 0
	if(.not. is_zero) exponent  = exponent - 129
	return
	end
	subroutine dix_con_cvt_get_h(real_val,sign,exponent,mantisse,is_zero)
	implicit none
c
c Get sign,exp, mantisse for float_h
c
	integer*4 real_val(4)
	integer*4 sign
	integer*4 exponent
	integer*4 mantisse(4)
	logical*4 is_zero
c#
	integer*4 lib$extzv
c
	integer*4 mantisse1,mantisse2
c
	sign     = lib$extzv(15,1,real_val(1))
	exponent = lib$extzv(0,15,real_val(1)) 
c
	mantisse1 = lib$extzv(16,16,real_val(1))
	mantisse2 = lib$extzv( 0,16,real_val(2))
	mantisse(1) = ishft(mantisse1,16) + mantisse2
c
	mantisse1 = lib$extzv(16,16,real_val(2))
	mantisse2 = lib$extzv( 0,16,real_val(3))
	mantisse(2) = ishft(mantisse1,16) + mantisse2
c
	mantisse1 = lib$extzv(16,16,real_val(3))
	mantisse2 = lib$extzv( 0,16,real_val(4))
	mantisse(3) = ishft(mantisse1,16) + mantisse2
c
	mantisse1 = lib$extzv(16,16,real_val(4))
	mantisse(4) = ishft(mantisse1,16) 
c
	is_zero = mantisse(1) .eq. 0 .and. mantisse(2) .eq. 0 .and. 
     1            mantisse(3) .eq. 0 .and. mantisse(4) .eq. 0 .and. 
     1            exponent .eq. 0
	if(.not. is_zero) exponent  = exponent - 16385
	return
	end
	subroutine dix_con_cvt_get_t(real_val,sign,exponent,mantisse,is_zero)
	implicit none
c
c Get sign,exp, mantisse for float_t
c
	integer*4 real_val(2)
	integer*4 sign
	integer*4 exponent
	integer*4 mantisse(4)
	logical*4 is_zero
c#
	integer*4 lib$extzv
	integer*4 mantisse1,mantisse2,mantisse3
c
	sign      = lib$extzv(31, 1,real_val(2))
	exponent  = lib$extzv(20,11,real_val(2)) 
c
	mantisse1 = lib$extzv(16, 4,real_val(2))
	mantisse2 = lib$extzv( 0,16,real_val(2))
	mantisse3 = lib$extzv(20,12,real_val(1))
	mantisse(1) = ishft(mantisse1,28) + ishft(mantisse2,12) + mantisse3
c
	mantisse1 = lib$extzv(16, 4,real_val(1))
	mantisse2 = lib$extzv( 0,16,real_val(1))
	mantisse(2) = ishft(mantisse1,28) + ishft(mantisse2,12)
c
	is_zero = mantisse(1) .eq. 0 .and. mantisse(2) .eq. 0 .and. 
     1            exponent .eq. 0
	if(.not. is_zero) exponent  = exponent - 1023
c
	return
	end
	subroutine dix_con_cvt_get_x(real_val,sign,exponent,mantisse,is_zero)
	implicit none
c
c Get values for float_x
c
	integer*2 real_val(*)
	integer*4 sign
	integer*4 exponent
	integer*4 mantisse(4)
	logical*4 is_zero
c#
	integer*4 lib$extzv
	integer*4 mantisse1,mantisse2
c
	sign     = lib$extzv(15,1,real_val(8))
	exponent = lib$extzv(0,15,real_val(8)) 
	mantisse1 = lib$extzv(0,16,real_val(7))
	mantisse2 = lib$extzv(0,16,real_val(6))
	mantisse(1) = ishft(mantisse1,16) + mantisse2
c
	mantisse1 = lib$extzv(0,16,real_val(5))
	mantisse2 = lib$extzv(0,16,real_val(4))
	mantisse(2) = ishft(mantisse1,16) + mantisse2
c
	mantisse1 = lib$extzv(0,16,real_val(3))
	mantisse2 = lib$extzv(0,16,real_val(2))
	mantisse(3) = ishft(mantisse1,16) + mantisse2
c
	mantisse1 = lib$extzv(0,16,real_val(1))
	mantisse(4) = ishft(mantisse1,16)
c
	is_zero = mantisse(1) .eq. 0 .and. mantisse(2) .eq. 0 .and. 
     1            mantisse(3) .eq. 0 .and. mantisse(4) .eq. 0 .and. 
     1            exponent .eq. 0
	if(.not. is_zero) exponent  = exponent - 16383
c
	return
	end
c
c Now the build routines
c
	subroutine dix_con_cvt_set_f(sign,exponent,mantisse,rval,
     1                               overflow,is_zero)
	implicit none
c
c The routine to build a float_f value from the various parts
c	
	integer*4 sign		!:i: sign
	integer*4 exponent	!:i: exponent (clipped)
	integer*4 mantisse(4)	!:i: mantissa
	integer*2 rval(2)	!:o: real value (float_f)
	logical*4 overflow	!:o: overflow detected (exp out or range)
	logical*4 is_zero	!:i: true zero?
c#
	integer*4 lib$extzv
c
	integer*4 mant1,exp
c
	rval(1) = 0
	rval(2) = 0
	call lib$insv(sign,15,1,rval(1))
	if(is_zero) goto 90
c
	exponent = exponent + 129
	exp = min(254,max(1,exponent))
	overflow = exp .ne. exponent
c
	call lib$insv(exp,7,8,rval(1))
	mant1 = lib$extzv(25, 7,mantisse)
	call lib$insv(mant1,0,7,rval(1))
c
	mant1 = lib$extzv( 9,16,mantisse)
	call lib$insv(mant1,0,16,rval(2))
90	return
	end	
c
	subroutine dix_con_cvt_set_g(sign,exponent,mantisse,rval,
     1                               overflow,is_zero)
	implicit none
c
c The routine to build a float_g value from the various parts
c	
	integer*4 sign		!:i: sign
	integer*4 exponent	!:i: exponent (clipped)
	integer*4 mantisse(4)	!:i: mantissa
	integer*2 rval(4) 	!:o: real value (float_g)
	logical*4 overflow	!:o: overflow detected (exp out or range)
	logical*4 is_zero	!:i: true zero?
c#
	integer*4 lib$extzv
c
	integer*4 mant1,exp
c
	rval(1) = 0
	rval(2) = 0
	rval(3) = 0
	rval(4) = 0
	call lib$insv(sign,15,1,rval(1))
	if(is_zero) goto 90
c
	exponent = exponent + 1025
	exp = min(2047,max(1,exponent))
	overflow = exp .ne. exponent
	call lib$insv(exp,4,11,rval(1))
c
	mant1 = lib$extzv(28,4,mantisse(1))
	call lib$insv(mant1,0,4,rval(1))
c
	mant1 = lib$extzv(12,16,mantisse(1))
	call lib$insv(mant1,0,16,rval(2))
c
	mant1 = lib$extzv(0,12,mantisse(1))
	call lib$insv(mant1,4,12,rval(3))
c
	mant1 = lib$extzv(28, 4,mantisse(2))
	call lib$insv(mant1,0,4,rval(3))
c
	mant1 = lib$extzv(16,16,mantisse(2))
	call lib$insv(mant1,4,12,rval(4))
c
	mant1 = lib$extzv(12,4,mantisse(2))
	call lib$insv(mant1,0,4,rval(4))
90	return
	end	
c
	subroutine dix_con_cvt_set_d(sign,exponent,mantisse,rval,
     1                               overflow,is_zero)

	implicit none
c
c The routine to build a float_d value from the various parts
c	
	integer*4 sign		!:i: sign
	integer*4 exponent	!:i: exponent (clipped)
	integer*4 mantisse(4)	!:i: mantissa
	integer*2 rval(4)	!:o: real value (float_d)
	logical*4 overflow	!:o: overflow detected (exp out or range)
	logical*4 is_zero	!:i: true zero?
c#
	integer*4 lib$extzv
c
	integer*4 mant1,exp
c
	rval(1) = 0
	rval(2) = 0
	rval(3) = 0
	rval(4) = 0
	call lib$insv(sign,15,1,rval(1))
	if(is_zero) goto 90
c
	exponent = exponent + 129
	exp = min(254,max(1,exponent))
	overflow = exp .ne. exponent
c
	call lib$insv(exp,7,8,rval(1))
	mant1 = lib$extzv(25,7,mantisse)
	call lib$insv(mant1,0,7,rval(1))
c
	mant1 = lib$extzv(9,16,mantisse(1))
	call lib$insv(mant1,0,16,rval(2))
c
	mant1 = lib$extzv( 0,9,mantisse(1))
	call lib$insv(mant1,7,9,rval(3))
	mant1 = lib$extzv(25,7,mantisse(2))
	call lib$insv(mant1,0,7,rval(3))

	mant1 = lib$extzv(9,16,mantisse(2))
	call lib$insv(mant1,0,16,rval(4))
90	return
	end	
c
	subroutine dix_con_cvt_set_h(sign,exponent,mantisse,rval,
     1                              overflow,is_zero)
	implicit none
c
c The routine to build a float_h value from the various parts
c	
	integer*4 sign		!:i: sign
	integer*4 exponent	!:i: exponent 
	integer*4 mantisse(*)	!:i: mantissa
	integer*2 rval(*)	!:o: real value (float_h)
	logical*4 overflow	!:o: overflow detected (exp out or range)
	logical*4 is_zero	!:i: true zero?
c#
	integer*4 lib$extzv
c
	integer*4 exp,mant1
c
	rval(1) = 0
	rval(2) = 0
	rval(3) = 0
	rval(4) = 0
	rval(5) = 0
	rval(6) = 0
	rval(7) = 0
	rval(8) = 0
	call lib$insv(sign,15,1,rval(1))
	if(is_zero) goto 90
c
	exponent = exponent + 16385
	exp = min(32766,max(1,exponent))
	overflow = exp .ne. exponent
c
	call lib$insv(exp,0,15,rval(1))
c
	mant1 = lib$extzv(16,16,mantisse(1))
	call lib$insv(mant1,0,16,rval(2))
c
	mant1 = lib$extzv( 0,16,mantisse(1))
	call lib$insv(mant1,0,16,rval(3))
c
	mant1 = lib$extzv(16,16,mantisse(2))
	call lib$insv(mant1,0,16,rval(4))
c
	mant1 = lib$extzv( 0,16,mantisse(2))
	call lib$insv(mant1,0,16,rval(5))
c
	mant1 = lib$extzv(16,16,mantisse(3))
	call lib$insv(mant1,0,16,rval(6))
c
	mant1 = lib$extzv( 0,16,mantisse(3))
	call lib$insv(mant1,0,16,rval(7))
c
	mant1 = lib$extzv(16,16,mantisse(4))
	call lib$insv(mant1,0,16,rval(8))
90	return
	end	
c
	subroutine dix_con_cvt_set_s(sign,exponent,mantisse,rval,
     1                              overflow,is_zero)
	implicit none
c
c The routine to build a float_s value from the various parts
c
	integer*4 sign		!:i: sign
	integer*4 exponent	!:i: exponent (clipped)
	integer*4 mantisse(4)	!:i: mantissa
	integer*4 rval		!:o: real value (float_s)
	logical*4 overflow	!:o: overflow detected (exp out or range)
	logical*4 is_zero	!:i: true zero?
c#
	integer*4 exp,mant
	integer*4 lib$extzv
c
	rval = 0
c
	call lib$insv(sign,31,1,rval)
	if(is_zero) goto 90
c
	exponent = exponent+127
	exp = min(254,max(1,exponent))
	overflow = exp .ne. exponent
	call lib$insv(exp,23,8,rval)
c
	mant = lib$extzv(9,23,mantisse)
	call lib$insv(mant,0,23,rval)
c
90	return
	end	
c
	subroutine dix_con_cvt_set_t(sign,exponent,mantisse,rval,
     1                              overflow,is_zero)
	implicit none
c
c The routine to build a float_t value from the various parts
c
	integer*4 sign		!:i: sign
	integer*4 exponent	!:i: exponent (clipped)
	integer*4 mantisse(4)	!:i: mantissa
	integer*2 rval(4)	!:o: real value (float_t)
	logical*4 overflow	!:o: overflow detected (exp out or range)
	logical*4 is_zero	!:i: true zero?
c#
	integer*4 exp,mant
	integer*4 lib$extzv
c
	rval(1) = 0
	rval(2) = 0
	rval(3) = 0
	rval(4) = 0
	call lib$insv(sign,15,1,rval(4))
	if(is_zero) goto 90
c
	exponent = exponent+1023
	exp = min(2046,max(1,exponent))
	overflow = exp .ne. exponent
	call lib$insv(exp,4,11,rval(4))
c
	mant = lib$extzv(28,4,mantisse(1))
	call lib$insv(mant,0,4,rval(4))
c
	mant = lib$extzv(12,16,mantisse(1))
	call lib$insv(mant,0,16,rval(3))
c
	mant = lib$extzv( 0,12,mantisse(1))
	call lib$insv(mant,4,12,rval(2))
c
	mant = lib$extzv(28,4,mantisse(2))
	call lib$insv(mant,0,4,rval(2))
c
	mant = lib$extzv(12,16,mantisse(2))
	call lib$insv(mant,0,16,rval(1))
90	return
	end	
c
c
	subroutine dix_con_cvt_set_x(sign,exponent,mantisse,rval,
     1                              overflow,is_zero)
	implicit none
c
c The routine to build a float_x value from the various parts
c
	integer*4 sign		!:i: sign
	integer*4 exponent	!:i: exponent (clipped)
	integer*4 mantisse(4)	!:i: mantissa
	integer*2 rval(*)	!:o: real value (float_s)
	logical*4 overflow	!:o: overflow detected (exp out or range)
	logical*4 is_zero	!:i: true zero?
c#
	integer*4 exp,mant1
	integer*4 lib$extzv
c
	rval(1) = 0
	rval(2) = 0
	rval(3) = 0
	rval(4) = 0
	rval(5) = 0
	rval(6) = 0
	rval(7) = 0
	rval(8) = 0
	call lib$insv(sign,15,1,rval(8))
	if(is_zero) goto 90
c
	exponent = exponent+16383
	exp = min(32766,max(1,exponent))
	overflow = exp .ne. exponent
	call lib$insv(exp,0,15,rval(8))
c
	mant1 = lib$extzv(16,16,mantisse(1))
	call lib$insv(mant1,0,16,rval(7))
c
	mant1 = lib$extzv( 0,16,mantisse(1))
	call lib$insv(mant1,0,16,rval(6))
c
	mant1 = lib$extzv(16,16,mantisse(2))
	call lib$insv(mant1,0,16,rval(5))
c
	mant1 = lib$extzv( 0,16,mantisse(2))
	call lib$insv(mant1,0,16,rval(4))
c
	mant1 = lib$extzv(16,16,mantisse(3))
	call lib$insv(mant1,0,16,rval(3))
c
	mant1 = lib$extzv( 0,16,mantisse(3))
	call lib$insv(mant1,0,16,rval(2))
c
	mant1 = lib$extzv(16,16,mantisse(4))
	call lib$insv(mant1,0,16,rval(1))
c
90	return
	end	
	function dix_con_compare(control,des_rec,nb_data,data_rec,
     1                           nb_binary,binary_data,sear,
     1                           case_sensitive)
	implicit none
c
c Compare the field defined in des_rec to the string sear
c  the result will be
c  2  : some error
c  -1 : field(des_rec) < sear
c   0 : field(des_rec) = sear
c  +1 : field(des_rec) > sear
c
	include 'dix_def.inc'
	record /control/ control	!:i: contol block
	record /des_rec/ des_rec	!:i: descriuption
	integer*4 nb_data		!:i: length of databuffer
	byte data_rec(*)		!:i: the databuffer

	integer*4 nb_binary		!:i: #bits binary data
	byte binary_data(*)		!:i: beinary data to find
	character*(*) sear		!:i: the ascii of the binary data
	logical*4 case_sensitive	!:i: case sensitive?
	integer*4 dix_con_compare	!:f: funcitn result
c#
	integer*4 max_size,nk,nk1,nk2,offs,sub(8),src(8),sea(8),typ,k
	integer*4 nkar,istat,max_len
	character*(max_buf) work,work1
	character*(max_line_length) line
	character*(max_short_line_length) line1,line2
c
	record /strdef/ res
c
	integer*4 sign1,exp1,mant1(4),mantz1,isz1
	integer*4 sign2,exp2,mant2(4),mantz2,isz2
c
	integer*4 str$compare
	integer*4 dix_con_test_decimal
c	integer*4 dix_con_ascint
	integer*4 dix_con_intasc
	integer*4 dix_eval_strfun
c
	record /des_rec/ des_rec_loc
c
c Special compares for integer (+dat,prot,vfc,id..), reals decimal strings
c All others just ascii compare
c  For all others it is dependend ot the type
c
	max_size = nb_data - des_rec.bit_offset/bits_per_byte
c
	typ = des_rec.ent_type
	nk = min((des_rec.size+bits_per_byte-1)/bits_per_byte,max_size)
c
	des_rec_loc = des_rec
	des_rec_loc.bit_offset = 0
c
	offs = des_rec.bit_offset/bits_per_byte+1
c
	if    (typ .eq. enttyp_int .or. 
     1         typ .eq. enttyp_uint .or. 
     1         typ .eq. enttyp_dat    .or. 
     1         typ .eq. enttyp_deltatime .or. 
     1         typ .eq. enttyp_prot   .or. 
     1         typ .eq. enttyp_vfc    .or. 
     1         typ .eq. enttyp_revint .or. 
     1         typ .eq. enttyp_fid    .or. 
     1         typ .eq. enttyp_cpu) then
c
c  Binary integers
c Get the source
c  if type=revint (*4) we need to swap high and low word
c
	  call dix_util_copy_bits(des_rec.size,des_rec.bit_offset,
     1                data_rec,src,8)
	  if(typ .eq. enttyp_revint) src(1) = ishftc(src(1),16,32)
c
c Extract the data from the compare block
c  if type=revint (*4) we need to swap high and low word
c
	  call dix_util_copy_bits(nb_binary,0,binary_data,sea,8)
	  if(typ .eq. enttyp_revint) sea(1) = ishftc(sea(1),16,32)
c
          if((control.debug .and. debug_find) .ne. 0) then
	    call sys$fao('!8XL!8XL',nk1,line,%val(src(2)),%val(src(1)))
	    line1 = '%x'//line(17-nk*2:16)
	    call sys$fao('!8XL!8XL',nk2,line,%val(sea(2)),%val(sea(1)))
	    line2 = '%x'//line(17-nk*2:16)
	    nk1 = nk*2 + 2
	    nk2 = nk*2 + 2
          endif
c 
	  if(nk .gt. 4) then
	    call lib$subx(src,sea,sub)
	    if(sub(2) .lt. 0) istat = -1	
	    if(sub(2) .eq. 0) then
	      if(sub(1) .lt. 0) istat = -1	
	      if(sub(1) .eq. 0) istat =  0 	
	      if(sub(1) .gt. 0) istat = +1	
	    endif
	    if(sub(2) .gt. 0) istat = +1	
	    sub(1) = sub(2)
	  else
	    sub(1) = src(1) - sea(1)
	    if(sub(1) .lt. 0) istat = -1	
	    if(sub(1) .eq. 0) istat =  0 	
	    if(sub(1) .gt. 0) istat = +1	
	  endif
          if((control.debug .and. debug_find) .ne. 0) then
            call sys$fao('    Comparing integers !AS to !AS,'//
     1                   ' result !SL',
     1           nk,line,
     1           line1(1:nk1),line2(1:nk2), %val(istat))
            call dix_main_print_debug(control,debug_find,line(1:nk))
	  endif
	elseif(typ .eq. enttyp_real_f .or. 
     1         typ .eq. enttyp_real_g .or. 
     1         typ .eq. enttyp_real_d .or. 
     1         typ .eq. enttyp_real_h .or. 
     1         typ .eq. enttyp_real_s .or. 
     1         typ .eq. enttyp_real_t .or. 
     1         typ .eq. enttyp_real_x) then
c
c Real formats , must always be byte aligned.
c Now split off all parts
c
	  call dix_con_cvt_float_split(control,data_rec(offs),
     1                             typ,sign1,exp1,mant1,mantz1,isz1)
	  call dix_con_cvt_float_split(control,binary_data,
     1                             typ,sign2,exp2,mant2,mantz2,isz2)
c
c And do the compare, first check the signs
c
	  if(sign1 .ne. 0 .and. sign2 .eq. 0) then
c
c Src <0, and sear >0
c
	    istat = -1
	  elseif(sign1 .eq. 0 .and. sign2 .ne. 0) then
c
c Src >0, and sear <0
c
	    istat = + 1
	  else
c
c Signs are equal, now check for exponents
c
	    if(exp1 .lt. exp2) then
	      istat = -1
	    elseif(exp1 .gt. exp2) then
	      istat = + 1
	    else
	      do k=1,4
	        if(mant1(k) .lt. mant2(k)) then
	          istat = -1
	          goto 14
	        elseif(mant1(k) .gt. mant2(k)) then
	          istat = 1
	          goto 14
	        endif
	      end do
	      istat = 0
	    endif
14	  endif
          if((control.debug .and. debug_find) .ne. 0) then
            call sys$fao('    Comparing floats, result !SL',nk,line,
     1           %val(istat))
            call dix_main_print_debug(control,debug_find,line(1:nk))
	  endif
c
	elseif(typ .eq. enttyp_decimal) then
c
c Ascii numeric strings
c a bit more complex
c convert to ascii both strings
c
	  call dix_con_decimal_intasc(nk,data_rec(offs),work,nk)
	  call dix_con_decimal_intasc(nk,binary_data,work1,nk1)
c
c Create a dynamic string descriptor and subtract the both
c
	  call dix_eval_init_char(res)	  
	  istat = dix_eval_strfun('S',work(1:nk),work1(1:nk1),res,nk,0)
	  if(.not. istat) goto 80
c
c And do the compare
c
	  istat = dix_con_test_decimal(res)
          if((control.debug .and. debug_find) .ne. 0) then
            call sys$fao('    Comparing fixeddec, result !SL',nk,line,
     1           work (1:min(nk,30)),
     1           work1(1:min(nk1,30)),
     1           %val(istat))
            call dix_main_print_debug(control,debug_find,line(1:nk))
	  endif
	  call dix_util_free_descr(res)	  
	else
c
c General case, convert to ascii and compare general
c
	  istat = dix_con_intasc(max_size,des_rec,data_rec,
     1                           work,nkar,.false.,
     1                           max_len,control)
	  if(.not. istat) goto 80
c
	  if(.not. case_sensitive) 
     1        call str$upcase(work(1:nkar),work(1:nkar))
	  nk1 =len(sear)
	  if(.not. case_sensitive) then
	    call str$upcase(work1(1:nk1),sear)
	  else
	    work1(1:nk1) = sear
	  endif	  
	  istat = str$compare(work(1:nkar),work1(1:nk1))
c
c
          if((control.debug .and. debug_find) .ne. 0) then
            call sys$fao('    Comparing ASC !AS to !AS, result !SL',
     1                   nk,line,
     1           work1(1:min(nk1,30)),work(1:min(30,nk)),
     1            %val(istat))
            call dix_main_print_debug(control,debug_find,line(1:nk))
	  endif
	endif
	goto 90
c
80	istat = 2
	goto 90
90	dix_con_compare = istat
	return
	end
	function dix_con_test_decimal(result)
	implicit none
c
	character*(*) result
	integer*4 dix_con_test_decimal
c
	integer*4 k,istat
c
	if(result(1:1) .eq. ' ') then
	  istat = -1
	else
	  do k=1,len(result)
	    if(result(k:k) .ne. '0') then
	      istat = 1
	      goto 90
	    endif
	  enddo
	  istat = 0
	endif
90	dix_con_test_decimal = istat
	return
	end
	function dix_con_check_field_size(typ,size,nb_reserved,
     1                              field_mode,field_ok,
     1                              is_variable,known)
	implicit none
	include 'dix_def.inc'
c
c Check if typ/size valid for field_mode
c  updates size for variable fields
c
	integer*4 typ			!:i: data type
	integer*4 size			!:io: size (may be updated)
	integer*4 nb_reserved		!:o: nb reserved
	logical*4 field_mode		!:i: field mode	
	logical*4 field_ok		!:o: valid item for field_mode?
	logical*4 is_variable		!:o: is this a variable field
	logical*4 known			!:o: is this a known field
	logical dix_con_check_field_size	!:f: error if not right
c
	integer*4 default_size
c	
	dix_con_check_field_size = .false.
	field_ok    = .true.
	is_variable = .false.
	nb_reserved = 0
	known       = .true.
c
	if(field_mode) then
	  default_size = bits_per_byte
	else
	  default_size = 4*bits_per_byte
	end if
c
	if(typ .eq. enttyp_int) then
c
c (signed) integer must be >1 and <=64 bits
c
	  if(size .eq. 0) size = default_size
	  if(size .le. 1 .or. size .gt. 8*bits_per_byte) goto 90
	elseif(typ .eq. enttyp_uint) then
	  if(size .eq. 0) size =  default_size
	  if(size .lt. 1 .or. size .gt. 8*bits_per_byte) goto 90
	elseif(typ .eq. enttyp_bits) then
	  if(size .eq. 0) size = default_size
	  if(field_mode) then
	    if(size .lt. 1 .or. size .gt. 4*bits_per_byte) goto 90
	  else
	    if(size .lt. 1 .or. size .gt. 8*bits_per_byte) goto 90
	  end if
	elseif(typ .eq. enttyp_rbits) then
	  if(size .eq. 0) size = default_size
	  if(field_mode) then
	    if(size .lt. 1 .or. size .gt. 4*bits_per_byte) goto 90
	  else
	    if(size .lt. 1 .or. size .gt. 8*bits_per_byte) goto 90
	  end if
	elseif(typ .eq. enttyp_log) then
	  if(size .eq. 0) size = default_size
	  if(size .lt. 1 .or. size .gt. 8*bits_per_byte) goto 90
	elseif(typ .eq. enttyp_rlog) then
	  if(size .eq. 0) size = default_size
	  if(size .lt. 1 .or. size .gt. 4*bits_per_byte) goto 90
	elseif(typ .eq. enttyp_dat) then
	  if(size .eq. 0) size = 8*bits_per_byte
	  if(size .ne. 4*bits_per_byte .and. 
     1       size .ne. 8*bits_per_byte) goto 90
	elseif(typ .eq. enttyp_deltatime) then
	  if(size .eq. 0) size = 8*bits_per_byte
	  if(size .ne. 8*bits_per_byte) goto 90
	elseif(typ .eq. enttyp_cpu) then
	  if(field_mode) goto 68
	  if(size .eq. 0) size = 4*bits_per_byte
	  if(size .ne. 4*bits_per_byte) goto 90
	elseif(typ .eq. enttyp_uic) then
	  if(field_mode) goto 68
	  if(size .eq. 0) size = 4*bits_per_byte
	  if(size .ne. 4*bits_per_byte) goto 90
	elseif(typ .eq. enttyp_identifier) then
	  if(field_mode) goto 68
	  if(size .eq. 0) size = 4*bits_per_byte
	  if(size .ne. 4*bits_per_byte) goto 90
	elseif(typ .eq. enttyp_vfc) then
	  if(field_mode) goto 68
	  if(size .eq. 0) size = 1*bits_per_byte
	  if(size .ne. 1*bits_per_byte) goto 90
	elseif(typ .eq. enttyp_prot) then
	  if(field_mode) goto 68
	  if(size .eq. 0) size = 2*bits_per_byte
	  if(size .ne. 2*bits_per_byte) goto 90
	elseif(typ .eq. enttyp_fid) then
	  if(field_mode) goto 68
	  if(size .eq. 0) size = 6*bits_per_byte
	  if(size .ne. 6*bits_per_byte) goto 90
	elseif(typ .eq. enttyp_revint) then
	  if(field_mode) goto 68
	  if(size .eq. 0) size = 4*bits_per_byte
	  if(size .ne. 4*bits_per_byte) goto 90
	elseif(typ .eq. enttyp_real_f) then
	  if(field_mode) goto 68
	  if(size .eq. 0) size = 4*bits_per_byte
	  if(size .ne. 4*bits_per_byte) goto 90
	elseif(typ .eq. enttyp_real_g) then
	  if(field_mode) goto 68
	  if(size .eq. 0) size = 8*bits_per_byte
	  if(size .ne. 8*bits_per_byte) goto 90
	elseif(typ .eq. enttyp_real_h) then
	  if(field_mode) goto 68
	  if(size .eq. 0) size = 16*bits_per_byte
	  if(size .ne. 16*bits_per_byte) goto 90
	elseif(typ .eq. enttyp_real_x) then
	  if(field_mode) goto 68
	  if(size .eq. 0) size = 16*bits_per_byte
	  if(size .ne. 16*bits_per_byte) goto 90
	elseif(typ .eq.enttyp_real_s) then
	  if(field_mode) goto 68
	  if(size .eq. 0) size = 4*bits_per_byte
	  if(size .ne. 4*bits_per_byte) goto 90
	elseif(typ .eq. enttyp_real_t) then
	  if(field_mode) goto 68
	  if(size .eq. 0) size = 8*bits_per_byte
	  if(size .ne. 8*bits_per_byte) goto 90
	elseif(typ .eq. enttyp_real_d) then
	  if(field_mode) goto 68
	  if(size .eq. 0) size = 8*bits_per_byte
	  if(size .ne. 8*bits_per_byte) goto 90
	elseif(typ .eq. enttyp_acl) then
	  if(field_mode) goto 68
	  if(size .ne. 0) goto 90
	  is_variable = .true.
	elseif(typ .eq. enttyp_diskmap) then
	  if(field_mode) goto 68
	  if(size .ne. 0) goto 90
	  is_variable = .true.
	elseif(typ .eq. enttyp_chr) then
	  if(size .eq. 0) size = 1*bits_per_byte	!char = char*1
	  if(size .le. 0 .or. size .gt. bits_per_byte*65535) goto 90
	  if(field_mode) goto 68
	elseif(typ .eq. enttyp_decimal) then
	  if(field_mode) goto 68
	  if(size .le. 0 .or. size .gt. bits_per_byte*65535) goto 90
	elseif(typ .eq. enttyp_string) then
	  if(field_mode) goto 68
	  if(size .lt. 0 .or. size .gt. 255*bits_per_byte) goto 90
	  nb_reserved = 1
	  if(size .eq. 0) is_variable = .true.
	elseif(typ .eq. enttyp_wstring) then
	  if(field_mode) goto 68
	  nb_reserved = 2
	  if(size .lt. 0 .or. size .gt. 65535*bits_per_byte) goto 90
	  if(size .eq. 0) is_variable = .true.
	elseif(typ .eq. enttyp_lstring) then
	  if(field_mode) goto 68
	  nb_reserved = 4
	  if(size .lt. 0 .or. size .gt. 65535*bits_per_byte) goto 90
	  if(size .eq. 0) is_variable = .true.
	elseif(typ .eq. enttyp_hstring) then	!terminated by 8bitchar
	  if(field_mode) goto 68
	  if(size .lt. 0 .or. size .gt. 255*bits_per_byte) goto 90
	  if(size .eq. 0) is_variable = .true.
	elseif(typ .eq. enttyp_zstring) then	!terminated by 0
	  if(field_mode) goto 68
	  nb_reserved = 1
	  if(size .lt. 0 .or. size .gt. 255*bits_per_byte) goto 90
	  if(size .eq. 0) is_variable = .true.
	else
c
c Accept all others
c
	  known = .false.
	endif
	dix_con_check_field_size = .true.
	goto 90	
c
68	field_ok = .false.
c
90	return
	end

