× 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 will be "kludgy" I think no matter what based on your data

With Embedded SQL, you can set up a cursor and read it into your data structure. It doesn't check the data. Define the whole array as one subfield and overlay that with two arrays, one with the "real" 7p0 and another character with 4 long. Then a for loop to change it.

You maybe already had that but there's no way around it if you want to put zeros in there or do a LOOKUP or something. (There are other ways to do it depending on your purpose)

The alternative for quicker performance is to use an extra IF wherever you're going to use the packed value.

// -------------------------------------
D ITEMDS DS
D CustSts 1
D CustNbr 7s 0
D CustSub#Dta 120 D CustSubC 4a dim( 30 ) overlay(CustSub#Dta)
D CustSub# 7p 0 dim( 30 ) overlay(CustSub#Dta)
// -------------------------------------
For idx = 1 to 30 ;
If CustSubC( idx ) <> *Blanks ;
SummaryTotal += CustSub#( idx ) ;
Endif ;
EndFor ;
// -------------------------------------

--Alan

I have an RPG IV pgm (not ILE) that is reading in an old QS36F program-described file. This file has a "field" that is actually a 30-element packed numeric array (7,0). For records with valid data in this array, everything is fine; but I have some records with spaces (hex '4040404') in this array, and when it hits one of these, the program gives a decimal-data error (understandably so).

I have specified the compile option of FIXNBR(*INPUTPACKED) but the program is not fixing the data at input-time. Does *INPUTPACKED not work for input arrays? It seems to work for single fields.

And yes, I know, I need to fix the data. I intend to but that doesn't guarantee I won't encounter more of these in this file (or other files). I'd like to nail down a viable solution now. We will be converting to externally-described files eventually but for now this is the situation I have to deal with.

And yes, I have tried every conceivable combination of overlays & arrays to program around the problem. Every attempt either wouldn't compile, or gave the DD error when run.

Me duele la cabeza!

Ayuda?


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.