Skip to main content

Hello

I am testing the new-ish 'DT' conversion code in UV 11.3.5 (on RHEL8) and am having no success getting it to do what seems like simple conversions.

I put together the following test code to give it a go:

--

* Testing the new DT conversion code

sys.VAL     = system(99)
now.VAL     = now()
local.VAL   = datetimel()
utc.VAL     = datetimez()

crt "NLS status : ":oconv(system(100),"S;'On';'Off'")
crt "system(99) : ":sys.VAL
crt "now()      : ":now.VAL
crt "local      : ":local.VAL
crt "utc        : ":utc.VAL

lst.TESTS = ''
lst.TESTS<-1> = "O": @VM: sys.VAL: @VM: "DT"
lst.TESTS<-1> = "O": @VM: sys.VAL: @VM: "dt"
lst.TESTS<-1> = "O": @VM: now.VAL: @VM: "DT"
lst.TESTS<-1> = "O": @VM: now.VAL: @VM: "dt"
lst.TESTS<-1> = "I": @VM: local.VAL: @VM: "DT"
lst.TESTS<-1> = "I": @VM: local.VAL: @VM: "dt"
lst.TESTS<-1> = "I": @VM: utc.VAL: @VM: "DTIS"
lst.TESTS<-1> = "I": @VM: utc.VAL: @VM: "dtis"
lst.TESTS<-1> = "I": @VM: local.VAL: @VM: "DT"
lst.TESTS<-1> = "I": @VM: local.VAL: @VM: "dt"
lst.TESTS<-1> = "I": @VM: utc.VAL: @VM: "DTIS"
lst.TESTS<-1> = "I": @VM: utc.VAL: @VM: "dtis"

qty.TESTS = dcount(lst.TESTS,@AM)

$OPTIONS DEFAULT
crt
crt "Testing under DEFAULT mode (IDEAL UniVerse)"

for test.NUM = 1 to qty.TESTS
   this.TEST = lst.TESTS<test.NUM>
   crt test.NUM "4R":" ":
   call TEST_CONV( this.TEST<1,1>, this.TEST<1,2>, this.TEST<1,3>)
next test.NUM

$OPTIONS PICK
crt
crt "Testing under PICK mode (Generic PICK)"

for test.NUM = 1 to qty.TESTS
   this.TEST = lst.TESTS<test.NUM>
   crt test.NUM "4R":" ":
   call TEST_CONV( this.TEST<1,1>, this.TEST<1,2>, this.TEST<1,3>)
next test.NUM

$OPTIONS INFORMATION
crt
crt "Testing under INFORMATION mode (Prime INFORMATION)"

for test.NUM = 1 to qty.TESTS
   this.TEST = lst.TESTS<test.NUM>
   crt test.NUM "4R":" ":
   call TEST_CONV( this.TEST<1,1>, this.TEST<1,2>, this.TEST<1,3>)
next test.NUM


status.DESCS = convert(";",@am,"Conversion Successful;Value not convertable by conversion code;Invalid conversion code;Successful conversion of possible invalid date")
qty = dcount(status.DESCS,@AM)
crt
crt "Code  Description"
for num.DESC = 1 to qty
   crt (num.DESC-1) "3R": "   ":status.DESCS<num.DESC>
next num.DESC
crt

end


* Local subroutine
sub TEST_CONV( direction, in.VAL, in.CODE)

* reset the STATUS() value before we start
assign 0 to status()

if upcase(direction[1,1]) = "O" then
   crt "OCONV(\\":in.VAL:"\\,\\":in.CODE:"\\) = ":
   crt squote( oconv( in.VAL, in.CODE) ):
end else
   crt "ICONV(\\":in.VAL:"\\,\\":in.CODE:"\\) = ":
   crt squote( iconv( in.VAL, in.CODE) ):
end

stat.CODE = status()
crt "   status()=":stat.CODE

return

--

Running this gives me no successful conversions

--

>TEST.DT.CONV
NLS status : On
system(99) : 1757645301
now()      : 1757645301609
local      : 2025-09-12 12:48:21.609845
utc        : 2025-09-12 02:48:21.609848

Testing under DEFAULT mode (IDEAL UniVerse)
   1 OCONV(\\1757645301\\,\\DT\\) = ''   status()=2
   2 OCONV(\\1757645301\\,\\dt\\) = '20t05t4237'   status()=0
   3 OCONV(\\1757645301609\\,\\DT\\) = ''   status()=2
   4 OCONV(\\1757645301609\\,\\dt\\) = '13t10t9943'   status()=0
   5 ICONV(\\2025-09-12 12:48:21.609845\\,\\DT\\) = ''   status()=2
   6 ICONV(\\2025-09-12 12:48:21.609845\\,\\dt\\) = ''   status()=1
   7 ICONV(\\2025-09-12 02:48:21.609848\\,\\DTIS\\) = ''   status()=2
   8 ICONV(\\2025-09-12 02:48:21.609848\\,\\dtis\\) = ''   status()=2
   9 ICONV(\\2025-09-12 12:48:21.609845\\,\\DT\\) = ''   status()=2
  10 ICONV(\\2025-09-12 12:48:21.609845\\,\\dt\\) = ''   status()=1
  11 ICONV(\\2025-09-12 02:48:21.609848\\,\\DTIS\\) = ''   status()=2
  12 ICONV(\\2025-09-12 02:48:21.609848\\,\\dtis\\) = ''   status()=2

Testing under PICK mode (Generic PICK)
   1 OCONV(\\1757645301\\,\\DT\\) = ''   status()=2
   2 OCONV(\\1757645301\\,\\dt\\) = '20t05t4237'   status()=0
   3 OCONV(\\1757645301609\\,\\DT\\) = ''   status()=2
   4 OCONV(\\1757645301609\\,\\dt\\) = '13t10t9943'   status()=0
   5 ICONV(\\2025-09-12 12:48:21.609845\\,\\DT\\) = ''   status()=2
   6 ICONV(\\2025-09-12 12:48:21.609845\\,\\dt\\) = ''   status()=1
   7 ICONV(\\2025-09-12 02:48:21.609848\\,\\DTIS\\) = ''   status()=2
   8 ICONV(\\2025-09-12 02:48:21.609848\\,\\dtis\\) = ''   status()=2
   9 ICONV(\\2025-09-12 12:48:21.609845\\,\\DT\\) = ''   status()=2
  10 ICONV(\\2025-09-12 12:48:21.609845\\,\\dt\\) = ''   status()=1
  11 ICONV(\\2025-09-12 02:48:21.609848\\,\\DTIS\\) = ''   status()=2
  12 ICONV(\\2025-09-12 02:48:21.609848\\,\\dtis\\) = ''   status()=2

Testing under INFORMATION mode (Prime INFORMATION)
   1 OCONV(\\1757645301\\,\\DT\\) = ''   status()=2
   2 OCONV(\\1757645301\\,\\dt\\) = '20t05t4237'   status()=0
   3 OCONV(\\1757645301609\\,\\DT\\) = ''   status()=2
   4 OCONV(\\1757645301609\\,\\dt\\) = '13t10t9943'   status()=0
   5 ICONV(\\2025-09-12 12:48:21.609845\\,\\DT\\) = ''   status()=2
   6 ICONV(\\2025-09-12 12:48:21.609845\\,\\dt\\) = ''   status()=1
   7 ICONV(\\2025-09-12 02:48:21.609848\\,\\DTIS\\) = ''   status()=2
   8 ICONV(\\2025-09-12 02:48:21.609848\\,\\dtis\\) = ''   status()=2
   9 ICONV(\\2025-09-12 12:48:21.609845\\,\\DT\\) = ''   status()=2
  10 ICONV(\\2025-09-12 12:48:21.609845\\,\\dt\\) = ''   status()=1
  11 ICONV(\\2025-09-12 02:48:21.609848\\,\\DTIS\\) = ''   status()=2
  12 ICONV(\\2025-09-12 02:48:21.609848\\,\\dtis\\) = ''   status()=2

Code  Description
  0   Conversion Successful
  1   Value not convertable by conversion code
  2   Invalid conversion code
  3   Successful conversion of possible invalid date

>
--

Has anyone been able to successfully use the 'DT' conversion code?
If so, what results do you get from the above test program?



------------------------------
Gregor Scott
Software Architect
Pentana Solutions Pty Ltd
Mount Waverley VIC AU
------------------------------

Hello

I am testing the new-ish 'DT' conversion code in UV 11.3.5 (on RHEL8) and am having no success getting it to do what seems like simple conversions.

I put together the following test code to give it a go:

--

* Testing the new DT conversion code

sys.VAL     = system(99)
now.VAL     = now()
local.VAL   = datetimel()
utc.VAL     = datetimez()

crt "NLS status : ":oconv(system(100),"S;'On';'Off'")
crt "system(99) : ":sys.VAL
crt "now()      : ":now.VAL
crt "local      : ":local.VAL
crt "utc        : ":utc.VAL

lst.TESTS = ''
lst.TESTS<-1> = "O": @VM: sys.VAL: @VM: "DT"
lst.TESTS<-1> = "O": @VM: sys.VAL: @VM: "dt"
lst.TESTS<-1> = "O": @VM: now.VAL: @VM: "DT"
lst.TESTS<-1> = "O": @VM: now.VAL: @VM: "dt"
lst.TESTS<-1> = "I": @VM: local.VAL: @VM: "DT"
lst.TESTS<-1> = "I": @VM: local.VAL: @VM: "dt"
lst.TESTS<-1> = "I": @VM: utc.VAL: @VM: "DTIS"
lst.TESTS<-1> = "I": @VM: utc.VAL: @VM: "dtis"
lst.TESTS<-1> = "I": @VM: local.VAL: @VM: "DT"
lst.TESTS<-1> = "I": @VM: local.VAL: @VM: "dt"
lst.TESTS<-1> = "I": @VM: utc.VAL: @VM: "DTIS"
lst.TESTS<-1> = "I": @VM: utc.VAL: @VM: "dtis"

qty.TESTS = dcount(lst.TESTS,@AM)

$OPTIONS DEFAULT
crt
crt "Testing under DEFAULT mode (IDEAL UniVerse)"

for test.NUM = 1 to qty.TESTS
   this.TEST = lst.TESTS<test.NUM>
   crt test.NUM "4R":" ":
   call TEST_CONV( this.TEST<1,1>, this.TEST<1,2>, this.TEST<1,3>)
next test.NUM

$OPTIONS PICK
crt
crt "Testing under PICK mode (Generic PICK)"

for test.NUM = 1 to qty.TESTS
   this.TEST = lst.TESTS<test.NUM>
   crt test.NUM "4R":" ":
   call TEST_CONV( this.TEST<1,1>, this.TEST<1,2>, this.TEST<1,3>)
next test.NUM

$OPTIONS INFORMATION
crt
crt "Testing under INFORMATION mode (Prime INFORMATION)"

for test.NUM = 1 to qty.TESTS
   this.TEST = lst.TESTS<test.NUM>
   crt test.NUM "4R":" ":
   call TEST_CONV( this.TEST<1,1>, this.TEST<1,2>, this.TEST<1,3>)
next test.NUM


status.DESCS = convert(";",@am,"Conversion Successful;Value not convertable by conversion code;Invalid conversion code;Successful conversion of possible invalid date")
qty = dcount(status.DESCS,@AM)
crt
crt "Code  Description"
for num.DESC = 1 to qty
   crt (num.DESC-1) "3R": "   ":status.DESCS<num.DESC>
next num.DESC
crt

end


* Local subroutine
sub TEST_CONV( direction, in.VAL, in.CODE)

* reset the STATUS() value before we start
assign 0 to status()

if upcase(direction[1,1]) = "O" then
   crt "OCONV(\\":in.VAL:"\\,\\":in.CODE:"\\) = ":
   crt squote( oconv( in.VAL, in.CODE) ):
end else
   crt "ICONV(\\":in.VAL:"\\,\\":in.CODE:"\\) = ":
   crt squote( iconv( in.VAL, in.CODE) ):
end

stat.CODE = status()
crt "   status()=":stat.CODE

return

--

Running this gives me no successful conversions

--

>TEST.DT.CONV
NLS status : On
system(99) : 1757645301
now()      : 1757645301609
local      : 2025-09-12 12:48:21.609845
utc        : 2025-09-12 02:48:21.609848

Testing under DEFAULT mode (IDEAL UniVerse)
   1 OCONV(\\1757645301\\,\\DT\\) = ''   status()=2
   2 OCONV(\\1757645301\\,\\dt\\) = '20t05t4237'   status()=0
   3 OCONV(\\1757645301609\\,\\DT\\) = ''   status()=2
   4 OCONV(\\1757645301609\\,\\dt\\) = '13t10t9943'   status()=0
   5 ICONV(\\2025-09-12 12:48:21.609845\\,\\DT\\) = ''   status()=2
   6 ICONV(\\2025-09-12 12:48:21.609845\\,\\dt\\) = ''   status()=1
   7 ICONV(\\2025-09-12 02:48:21.609848\\,\\DTIS\\) = ''   status()=2
   8 ICONV(\\2025-09-12 02:48:21.609848\\,\\dtis\\) = ''   status()=2
   9 ICONV(\\2025-09-12 12:48:21.609845\\,\\DT\\) = ''   status()=2
  10 ICONV(\\2025-09-12 12:48:21.609845\\,\\dt\\) = ''   status()=1
  11 ICONV(\\2025-09-12 02:48:21.609848\\,\\DTIS\\) = ''   status()=2
  12 ICONV(\\2025-09-12 02:48:21.609848\\,\\dtis\\) = ''   status()=2

Testing under PICK mode (Generic PICK)
   1 OCONV(\\1757645301\\,\\DT\\) = ''   status()=2
   2 OCONV(\\1757645301\\,\\dt\\) = '20t05t4237'   status()=0
   3 OCONV(\\1757645301609\\,\\DT\\) = ''   status()=2
   4 OCONV(\\1757645301609\\,\\dt\\) = '13t10t9943'   status()=0
   5 ICONV(\\2025-09-12 12:48:21.609845\\,\\DT\\) = ''   status()=2
   6 ICONV(\\2025-09-12 12:48:21.609845\\,\\dt\\) = ''   status()=1
   7 ICONV(\\2025-09-12 02:48:21.609848\\,\\DTIS\\) = ''   status()=2
   8 ICONV(\\2025-09-12 02:48:21.609848\\,\\dtis\\) = ''   status()=2
   9 ICONV(\\2025-09-12 12:48:21.609845\\,\\DT\\) = ''   status()=2
  10 ICONV(\\2025-09-12 12:48:21.609845\\,\\dt\\) = ''   status()=1
  11 ICONV(\\2025-09-12 02:48:21.609848\\,\\DTIS\\) = ''   status()=2
  12 ICONV(\\2025-09-12 02:48:21.609848\\,\\dtis\\) = ''   status()=2

Testing under INFORMATION mode (Prime INFORMATION)
   1 OCONV(\\1757645301\\,\\DT\\) = ''   status()=2
   2 OCONV(\\1757645301\\,\\dt\\) = '20t05t4237'   status()=0
   3 OCONV(\\1757645301609\\,\\DT\\) = ''   status()=2
   4 OCONV(\\1757645301609\\,\\dt\\) = '13t10t9943'   status()=0
   5 ICONV(\\2025-09-12 12:48:21.609845\\,\\DT\\) = ''   status()=2
   6 ICONV(\\2025-09-12 12:48:21.609845\\,\\dt\\) = ''   status()=1
   7 ICONV(\\2025-09-12 02:48:21.609848\\,\\DTIS\\) = ''   status()=2
   8 ICONV(\\2025-09-12 02:48:21.609848\\,\\dtis\\) = ''   status()=2
   9 ICONV(\\2025-09-12 12:48:21.609845\\,\\DT\\) = ''   status()=2
  10 ICONV(\\2025-09-12 12:48:21.609845\\,\\dt\\) = ''   status()=1
  11 ICONV(\\2025-09-12 02:48:21.609848\\,\\DTIS\\) = ''   status()=2
  12 ICONV(\\2025-09-12 02:48:21.609848\\,\\dtis\\) = ''   status()=2

Code  Description
  0   Conversion Successful
  1   Value not convertable by conversion code
  2   Invalid conversion code
  3   Successful conversion of possible invalid date

>
--

Has anyone been able to successfully use the 'DT' conversion code?
If so, what results do you get from the above test program?



------------------------------
Gregor Scott
Software Architect
Pentana Solutions Pty Ltd
Mount Waverley VIC AU
------------------------------

I've tested it like the following.

TIMESTAMP = (SYSTEM(99):'000')
EXTERNAL = OCONV(TIMESTAMP, 'DT')
CRT ' TIMESTAMP: ':TIMESTAMP
CRT '  EXTERNAL: ':EXTERNAL
CRT 'CONVERSION: ':ICONV(EXTERNAL, 'DT')


------------------------------
Joseph von Arx
Software Developer
Data Management Associates Inc DMA
Cincinnati OH US
------------------------------

I've tested it like the following.

TIMESTAMP = (SYSTEM(99):'000')
EXTERNAL = OCONV(TIMESTAMP, 'DT')
CRT ' TIMESTAMP: ':TIMESTAMP
CRT '  EXTERNAL: ':EXTERNAL
CRT 'CONVERSION: ':ICONV(EXTERNAL, 'DT')


------------------------------
Joseph von Arx
Software Developer
Data Management Associates Inc DMA
Cincinnati OH US
------------------------------

Hi @Joseph von Arx

I adjusted your test code to include STATUS() results

TIMESTAMP = (SYSTEM(99):'000')
EXTERNAL = OCONV(TIMESTAMP, 'DT')
SYS1 = STATUS()
CRT ' TIMESTAMP: ':TIMESTAMP
CRT '  EXTERNAL: ':EXTERNAL:"  (":SYS1:")"
CRT 'CONVERSION: ':ICONV(EXTERNAL, 'DT'):"  (":STATUS():")"

This is the output I get

 TIMESTAMP: 1757898313000
  EXTERNAL:   (2)
CONVERSION:   (2)

According to the UV the 'DT' conversion code is not valid (STATUS() returning 2 indicates this) on our system.



------------------------------
Gregor Scott
Software Architect
Pentana Solutions Pty Ltd
Mount Waverley VIC AU
------------------------------

Hi @Joseph von Arx

I adjusted your test code to include STATUS() results

TIMESTAMP = (SYSTEM(99):'000')
EXTERNAL = OCONV(TIMESTAMP, 'DT')
SYS1 = STATUS()
CRT ' TIMESTAMP: ':TIMESTAMP
CRT '  EXTERNAL: ':EXTERNAL:"  (":SYS1:")"
CRT 'CONVERSION: ':ICONV(EXTERNAL, 'DT'):"  (":STATUS():")"

This is the output I get

 TIMESTAMP: 1757898313000
  EXTERNAL:   (2)
CONVERSION:   (2)

According to the UV the 'DT' conversion code is not valid (STATUS() returning 2 indicates this) on our system.



------------------------------
Gregor Scott
Software Architect
Pentana Solutions Pty Ltd
Mount Waverley VIC AU
------------------------------

That's interesting because we are on Universe 11.3.4 and this is what I get.

TIMESTAMP: 1757933886000
EXTERNAL: 2025-09-15 06:58:06  (0)
CONVERSION: 1757933886000  (0)



------------------------------
Joseph von Arx
Software Developer
Data Management Associates Inc DMA
Cincinnati OH US
------------------------------

That's interesting because we are on Universe 11.3.4 and this is what I get.

TIMESTAMP: 1757933886000
EXTERNAL: 2025-09-15 06:58:06  (0)
CONVERSION: 1757933886000  (0)



------------------------------
Joseph von Arx
Software Developer
Data Management Associates Inc DMA
Cincinnati OH US
------------------------------

Hi Both - it claims to be Linux only in the help, but it works on Windows (using 14.1.1) so I guess your mileage will vary with release.



------------------------------
Brian Leach
Director
Brian Leach Consulting
Chipping Norton GB
------------------------------