× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



It would have helped if you had posted your “overlay method” code - then we could have commented on that because it should work.

Assuming that you want an RPG solution … I have no time to try this but it should work if you just take a base date 0001/01/01 and add the number of days.

So:

date = D’0001-01-01’ + %Days( julianNumber ); // Where “data” is a real date field in any 4 digit year format.

You might need %Days( julianNumber - 1 ) instead depending on how they view the base of the Julian date.

If you then want the field date in numeric or character form use %Char or %Dec as appropriate.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Nov 24, 2014, at 11:23 AM, Brian <belstsrv@xxxxxxxxx> wrote:

Hello List,

I have a complicated date conversion I am trying to accomplish. Here is the situation, with some example data. I've just not been able to figure out how to handle this so hopefully someone can assist.

I am receiving from an ERP system a hex value for a Julian date. This is a real Julian date, not a JDE type of date. Ultimately I need to convert this to YYYYMMDD format.

The hex is just simple text like this: 257D96
This hex should convert to a decimal value of: 2456982
When putting in this value on a Julian date conversion page, I get this as the date: 11/20/2014

This all works awesome when I do it by hand using Notepad++ and a web page :)

Problem is, I can't seem to figure out how to do the same in RPG.

I was able to use 'cvtch' to get my text representation of the hex number converted in to real hex. But, I've tried the overlay method of getting the decimal equivalent of the hex number and that has not worked.

To be honest though, I am not sure what the exact best approach here should be anyway. So, rather than maybe explain how I would try and do this or think I should, I'll ask the group and see what you all think.

Thanks in advance for any advice. It is appreciated.

Brian
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.