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



Maybe use something like:

select cast ( dec13 * .001 AS DECIMAL(13,3) ) from library1/file1

where dec13 is a 13,0 Decimal number

the SQL cast is used to avoid truncation of field or column dec13

in STRSQL that select statement returns:
....+....1....+...
CAST function
1,100.001





-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Gqcy
Sent: Thursday, January 08, 2015 7:51 AM
To: midrange-l@xxxxxxxxxxxx
Subject: bad, bad field misuse. need to turn into to SQL.

I need to get length and width out of our item master via SQL..
database field defined: Packed 11,4 (IXXXX)


old, <charles barkley>TERRIBLE</cb> desire usage of field:
width: positions 1 -5, 3 decimal positions
length: positions 6-11, 3 decimal positions

good ole RPGII code to do this:

C IXXXX MULT 10000 IXXXX0 11 0
C MOVEL IXXXX0 IWIDE 5 3
C MOVE IXXXX0 ILENG 6 3


or, we also did...
D ds
D IXXX4 11 4
D Width 5 3 overlay(IXXX4:1)
D length 6 3 overlay(IXXX4:6)


C IXXX4 = IXXXX;


when I try the following:

select substr((IXXXX * 10000),1,5) as width, substr((IXXXX *
10000),6,6) as length, IPROD
from ......

I get my length and width as whole numbers, but when I try to push the math any further (by multiplying by .001), I get zeros in my fields...


I know my penitence will be great for this...



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.