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



hi Rob,

I see Barbara has already explained why you're getting the MCH1210 (trying to assign -2 to an unsigned intermediate result.)

But, I would also like you to think about how you're handling the DrillDownDir parameter, because the way you're doing it seems a little silly.

1) Why limit the length to 640? Technically a pathname can be as large as 16mb. Though, CL commands typically use TYPE(*PNAME) LEN(5000). I would recommend using 5000 as the length unless you have a good reason not to. (Such as compatibility with other software that you can't change.)

2) Why use a fixed-length string? This seems like a bad idea, since the trailing blanks that are automatically added to fixed-length strings will muck up the IFS APIs. (This is why you need to do something kludgy like DirectoryName=%trim(DirectoryName) + x'00') Consider using VARYING.

3) Assuming your program does not modify the DirectoryName/DrillDownDir (and it shouldn't) please consider using CONST to make that clear.

So I would do this (and make the PR match):

D CRTINDSTMF pi
D DirectoryName 5000a varying const

If you're calling this from a *CMD, I would put this on the parameter to make it return a VARYING to the RPG:

TYPE(*PNAME) LEN(5000) VARY(*YES)

On the DrillDownDir parameter, I would do the same as above, use VARYINg and CONST.

I would eliminate the code that does %trim() + x'00', and instead put a %trimr() on the opendir() call.

dirh = opendir(%trimr(DrillDownDir));

Does that make sense in your environment?

-SK



On 11/20/2012 2:16 PM, rob@xxxxxxxxx wrote:
I am getting a MCH1210 error
Statement in Error . . . . . . . . . . : 00001273
RPG Routine . . . . . . . . . . . . . : DRILLDOW
Number of Parameters . . . . . . . . . :
Message Type . . . . . . . . . . . . . : MCH
Additional Message Info . . . . . . . : 1210
Message Data . . . . . . . . . . . . . :
Receiver value too small to hold result.

DrillDown(DirectoryName); // MCH1210 error here!!!!!

Source listing
http://code.midrange.com/2c08ed8d39.html

Compile listing
http://code.midrange.com/598444bec7.html

Dump
http://code.midrange.com/24669d27c8.html


Rob Berendt


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.