You might search the archives, I seem to recall Scott mentioning that
code on the web site was pretty outdated and IIRC that RdLine in
particular was not designed for production use.

Having said that, looks like you may have an updated version as the
code on the web calls the procedure readline().

In any event the prototype is
D readline PR 10I 0
D fd 10I 0 value
D text * value
D maxlen 10I 0 value

So no, passing a varying like you are doing isn't going to work.
What's happening is that the first 2 bytes which are supposed to hold
the length of the string are being overwritten by the first two bytes
of you data.

What you need to do is

readReturned = RdLine(cli: (%addr(Input_String) + 2):56:*On) < 0;
if readReturnd < 0;
%len(Input_String) = readReturned;
// at this point you have a good variable length string.

HTH,
Charles


On Wed, Jul 15, 2009 at 2:07 PM, <GKern@xxxxxxxxxxxxxxxx> wrote:
I have the following code in which I encounter two problems. First when
viewing the Input_String variable in debug, only the last 54 bytes are
shown - the first two are truncated. (The string sent contains 56 bytes).
The debugger monitor says the field is 56 bytes, as does the dump listing.
Second the "If %Len(Input_String) < 1 Or %Len(Input_String) > 56;"
triggers an RNX0115 (Length of varying length variable is out of range).
Does Rdline not work with a variable length field? (The RdLine code is
from Scott Klements tutorial.)


    D Input_String    S             56A   Varying

    If RdLine(cli: %addr(Input_String):56:*On) < 0;
    Callp Die('Error calling RdLine()');
    Callp close(cli);
    Return;
    Endif;


    If %Len(Input_String) < 1 Or %Len(Input_String) > 56;
      Error = Yes;
      Return_String = %Trim(Return_String) + Error00;
      LeaveSr;
    EndIf;

Thanks!

Regards, Jerry

Gerald Kern - MIS Project Leader
Lotus Notes/Domino Administrator
IBM Certified RPG IV Developer
The Toledo Clinic, Inc.
4235 Secor Road
Toledo, OH 43623-4299
Phone 419-479-5535
gkern@xxxxxxxxxxxxxxxx


This e-mail message, including any attachments, is for the sole use of the
intended recipient(s) and may contain confidential and privileged
information. Any unauthorized use, disclosure or distribution is
prohibited. If you are not the intended recipient, please inform the
sender by reply e-mail and destroy this and all copies of this message.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



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.