× 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.



Shows how long it has been since I used from/to - couldn't work out how 8 decimals fitted into a 5 digit field and that the 8 must be a typo! Another good reason to never use from/to!

In my DS example simply change the def of packed fields to packed(9:8) and all is well.


Jon P.

On Mar 27, 2024, at 11:26 AM, Daniel Gross <daniel@xxxxxxxx> wrote:

Hi Greg,

Am 27.03.2024 um 16:03 schrieb Greg Wilburn <gwilburn@xxxxxxxxxxxxxxxxxxxxxxx>:

The table I'm reading contains a character field IDFL03 that contains a packed decimal value.

The previous extraction method (reading the file with RPG) simply defined a DS "overlay"
D ds
D idfl03 1 5a stored here in sa326
D idpml 1 5p 8 payment multiplier

How about using a pointer?

dcl-s packedField packed(9:8) based(pointerCharField);
...
pointerCharField = %addr(idfl03);
...
// now use packedField

Another idea is using SQLs built in INTERPRET function?

SELECT INTERPRET(idfl03 AS DECIMAL(9, 8) FROM ...

This should also work.

Of course the best solution would be converting this column to a numeric value.

HTH
Daniel

P.S.: I'm on holidays right now - so no chance to check my ideas ...
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.



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.