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



On 2021-07-15 10:34 p.m., Singh, Ashwani (Lake Mary) via RPG400-L wrote:

One critical piece of information that I missed as that it substring of 18Bytes out of 1200 long field which we are talking about.

Also I meant for 90% of records has this 18byes as Char and only 10% has packed numeric data.


For the 10% of cases, do you want to print out the packed data as a number?

To find out whether the entire 18 Bytes has valid packed data, you could use %CHECK:

First check the first 17 bytes. All the half-bytes should be 0-9. Then check the last byte. The first half-byte should be 0-9 and the last half-byte should be the sign, either 'D' or 'F'. (Also 'A' 'B' 'C' and 'E' are actually valid signs, so you could also check for those if you see them in the packed data.)

I tested this a little bit ...

dcl-c valid_first_packed_bytes x'00010203040506070809+
01111213141516171819+
21212223242526272829+
31313233343536373839+
41414243444546474849+
51515253545556575859+
61616263646566676869+
71717273747576777879+
81818283848586878889+
91919293949596979899';
dcl-c valid_last_packed_byte x'0F1F2F3F4F5F6F7F8F9F+
0D1D2D3D4D5D6D7D8D9D';
dcl-s p1 int(10);
dcl-s p2 int(10);

p1 = %check(valid_first_packed_bytes : %subst(num:1:17));
p2 = %check(valid_last_packed_byte : %subst(num:18:1));
if p1 = 0 and p2 = 0;
it is a valid packed value


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.