T24: OCONV Function

5,470 views
Skip to first unread message

Williams

unread,
Nov 9, 2010, 3:57:31 PM11/9/10
to jB...@googlegroups.com
I need help regarding the piece of code below:
 
    SUBROUTINE TEST.DATES
    $INSERT I_COMMON
    $INSERT I_EQUATE
   
    CALC.DATE = '20101102'
    DAY.STR = OCONV(CALC.DATE,'DWA')
    PRINT DAY.STR
 
END
 
The system returns SUNDAY. I expect this to be TUESDAY because 20101102 is Tuesday.
 
Anybody with idea please.
 
Williams

Simon Verona

unread,
Nov 9, 2010, 4:16:42 PM11/9/10
to jb...@googlegroups.com
I think it's not reading the number as a literal external date but an internal date - 20101102 days after Dec 31, 1967.

I'm not going to work out what the actual date is, but I'm sure that will be the issue ... Try replacing with 11/02/2010 (or 02/11/2010 if not in the US)

Regards

Simon

=========================
Simon Verona
Director
Dealer Management Services Ltd

T: 0845 686 2300

Sent from my iPhone
--
Please read the posting guidelines at: http://groups.google.com/group/jBASE/web/Posting%20Guidelines
 
IMPORTANT: Type T24: at the start of the subject line for questions specific to Globus/T24
 
To post, send email to jB...@googlegroups.com
To unsubscribe, send email to jBASE-un...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en

Phil Knight

unread,
Nov 10, 2010, 5:37:21 AM11/10/10
to jBASE
The standard T24 subroutine DIETER.DATE is useful for converting dates
between T24 format and various jBASE formats in both directions. See
example code to demonstrate usage:

DIETER.DATE.DEMO
001 PROGRAM DIETER.DATE.DEMO
002 * Demonstrates the usage of the standard T24 subroutine
DIETER.DATE.
003
004 GLOBUS.DATE = "20101102"
005
006 * Convert T24 format to jBase formats
007 DATE.CONV.FMT = ""
008 GOSUB SHOW.CONV.DATE
009
010 DATE.CONV.FMT = "D4"
011 GOSUB SHOW.CONV.DATE
012
013 DATE.CONV.FMT = "DWA"
014 GOSUB SHOW.CONV.DATE
015
016 * Convert jBase internal (Pick) format back to Globus/T24
(YYYYMMDD)
017 GLOBUS.DATE = ""
018 JBASE.INT.DATE = "15647"
019 DATE.CONV.FMT = ""
020 CALL DIETER.DATE(GLOBUS.DATE, JBASE.INT.DATE, DATE.CONV.FMT)
021 CRT
022 CRT "jBase to T24 converted date = ":GLOBUS.DATE
023
024 STOP
025
026 SHOW.CONV.DATE:
027 JBASE.CONV.DATE = ""
028 CALL DIETER.DATE(GLOBUS.DATE, JBASE.CONV.DATE, DATE.CONV.FMT)
029 CRT
030 CRT "T24 to jBase Converted Date = ":JBASE.CONV.DATE
031
032 RETURN

jsh Oceanic_Prod ~ -->RUN PHIL.BP DIETER.DATE.DEMO

T24 to jBase Converted Date = 15647

T24 to jBase Converted Date = 02 NOV 2010

T24 to jBase Converted Date = TUESDAY

jBase to T24 converted date = 20101102


Regards
Philip

Mahmoud

unread,
Nov 10, 2010, 5:51:03 AM11/10/10
to jBASE
Hi Williams,

I think the routine should be written like this:

SUBROUTINE TEST.DATES
$INSERT I_COMMON
$INSERT I_EQUATE

CALC.DATE = '20101102'
DAY.STR = OCONV(ICONV(CALC.DATE,"D2"),'DWA')

PRINT DAY.STR

END


That system should return TUESDAY because the OCONV should be used on
a D2 format

Regards
Mahmoud Elhawary

Mike Preece

unread,
Nov 10, 2010, 7:50:42 AM11/10/10
to jBASE
I concur with Simon. An OCONV works on an internal date and converts
it to external form. The 20101102 is therefore being treated as
internal form, 20 thousand or so days on from day 1.

Harish Venugopal

unread,
Nov 9, 2010, 9:07:12 PM11/9/10
to jb...@googlegroups.com
Hi Williams,
         What Simon has stated is correct. This is the issue with the internal interpretation of dates in jbase since 31-12-1967 midnight. However a little change in the code helped arrive at the correct result.

    PROGRAM TEST.DATES

    $INCLUDE GLOBUS.BP I_COMMON

    $INCLUDE GLOBUS.BP I_EQUATE

 

    CALC.DATE = '20101102'

    CALC.DATE=ICONV(CALC.DATE,'D')

    DAY.STR = OCONV(CALC.DATE,'DWA')

    PRINT DAY.STR

    STOP                                                                       

 

OUTPUT:

Object TEST.DATES cataloged successfully

TEST.DATES

TUESDAY                                  

 
Hope this helps.

Cheers,
Harish

Mike Preece

unread,
Nov 10, 2010, 12:09:37 PM11/10/10
to jBASE
Does this work on jBase...

CRT ICONV(20101110 '££££-££-££','DS') 'DWA'

...as it does on Reality?


On Nov 10, 2:07 am, Harish Venugopal <venugopal.har...@gmail.com>
wrote:
> Hi Williams,
>          What Simon has stated is correct. This is the issue with the
> internal interpretation of dates in jbase since 31-12-1967 midnight. However
> a little change in the code helped arrive at the correct result.
>
>     PROGRAM TEST.DATES
>
>     $INCLUDE GLOBUS.BP I_COMMON
>
>     $INCLUDE GLOBUS.BP I_EQUATE
>
>     CALC.DATE = '20101102'
>
>     CALC.DATE=ICONV(CALC.DATE,'D')
>
>     DAY.STR = OCONV(CALC.DATE,'DWA')
>
>     PRINT DAY.STR
>
>     STOP
>
> *OUTPUT:*
>
> Object TEST.DATES cataloged successfully
>
> TEST.DATES
>
> TUESDAY
>
> Hope this helps.
>
> Cheers,
> Harish
>
> On Wed, Nov 10, 2010 at 5:16 AM, Simon Verona <si...@dmservices.co.uk>wrote:
>
>
>
> > I think it's not reading the number as a literal external date but an
> > internal date - 20101102 days after Dec 31, 1967.
>
> > I'm not going to work out what the actual date is, but I'm sure that will
> > be the issue ... Try replacing with 11/02/2010 (or 02/11/2010 if not in the
> > US)
>
> > Regards
>
> > Simon
>
> > =========================
> > Simon Verona
> > Director
> > Dealer Management Services Ltd
>
> > T: 0845 686 2300
>
> > Sent from my iPhone
>
> > On 9 Nov 2010, at 20:57, Williams <wadefi...@yahoo.co.uk> wrote:
>
> > I need help regarding the piece of code below:
>
> >     SUBROUTINE TEST.DATES
> >     $INSERT I_COMMON
> >     $INSERT I_EQUATE
>
> >     CALC.DATE = '20101102'
> >     DAY.STR = OCONV(CALC.DATE,'DWA')
> >     PRINT DAY.STR
>
> > END
>
> > The system returns SUNDAY. I expect this to be TUESDAY because 20101102 is
> > Tuesday.
>
> > Anybody with idea please.
>
> >  *Williams*
>
> >  --
> > Please read the posting guidelines at:
> > <http://groups.google.com/group/jBASE/web/Posting%20Guidelines>
> >http://groups.google.com/group/jBASE/web/Posting%20Guidelines
>
> > IMPORTANT: Type T24: at the start of the subject line for questions
> > specific to Globus/T24
>
> > To post, send email to <jB...@googlegroups.com>jB...@googlegroups.com
> > To unsubscribe, send email to <jBASE-un...@googlegroups.com>
> > jBASE-un...@googlegroups.com
> > For more options, visit this group at
> > <http://groups.google.com/group/jBASE?hl=en>
> >http://groups.google.com/group/jBASE?hl=en
>
> >  --
> > Please read the posting guidelines at:
> >http://groups.google.com/group/jBASE/web/Posting%20Guidelines
>
> > IMPORTANT: Type T24: at the start of the subject line for questions
> > specific to Globus/T24
>
> > To post, send email to jB...@googlegroups.com
> > To unsubscribe, send email to jBASE-un...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/jBASE?hl=en- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages