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



Scott

Thank you for your addition Scott but Larry Ducie point it me in the write 
direction and my problem is resolved.

Regards,

Emmanuel

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Scott Klement
Sent: 11 November 2005 5:25 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: 3440:Operation not supported when trying to read an IFS
file.



> 2) When using the open API I pass the address of the variable containing the 
> file name + 2 because the variable is VARYING and the first 2 bytes contain 
> the length. If you don't use a VARYING field then remove the "+ 2" part, but 
> be aware that trailing blanks in a fixed-length field can be interpreted as 
> part of the file name - hence the common use of adding a trailing null to 
> terminate the string.

This is both incorrect and unnecessary. For a fixed-length variable, the 
following code is all you need:

           fd = open(%trimr(filename): . . .)

For a VARYING variable, it's the same, except you don't need to code 
%trimr():

           fd = open(filename: . . .)

Notes:
-- You do not need to use %addr() or pass a pointer.  In fact, if you
    _do_, you'll create problems, because the automatic x'00' will no
    longer be added.

-- You do not need to add x'00' manually, options(*string) adds it for
    you as long as you're bright enough not to pass a pointer.

-- You do not need to add 2 to the address. Since you're not passing
    a pointer, but are using the functionality of the RPG language, it
    KNOWS that your field is VARYING.  It KNOWS that the intended result
    is a null-terminated string.  It'll convert it for you.

The really frustrating part is that I've already explained this to 
Emmanuel, and a day later you come and do it wrong, and convince him to do 
it wrong. It's enough to make you want to chew your own foot off!

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.