× 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 Barbara,

Thanks for jumping in.  You're saying that when I use VALUE, it just copies
the entire value on the stack?  No conversion takes place as with CONST?
Perhaps you can explain the following to me (sorry about the length):

In the following, Text does not appear to be varying, i.e. debugger does not
show the length when I "EVAL TEXT:X".  In addition, the program gets an
RNX0115: "Length of varying length variable is out of range."

Caller:
0047.00 d CnvRec          s            128a   varying
...
0226.00 c                   eval      CnvRec = 'GL CONVERSION ' + @TapeID +
x'25'
0227.00 c                   callp     IFS_prt(hCnvFile:CnvRec)

Callee:
0342.00 p IFS_prt         b                   export
0343.00
0344.00 d IFS_prt         pi
0345.00 d  hFile                              like(int) value
0346.00 d  Text                      32766a   value varying
0347.00
0348.00 d NbrWritten      s                   like(int)
0349.00
0350.00 c                   eval      NbrWritten = api_write(
0351.00 c                                          hFile:
0352.00 c                                          %addr(Text):
0353.00 c                                          %len(%trimr(Text)))
0354.00
0355.00 p                 e

EVAL cnvrec:x
   00000     0041C7D3 40C3D6D5 E5C5D9E2 C9D6D540   - . GL CONVERSION
   00010     E385A2A3 40E2D9E5 C9C6E240 40404040   - Test SRVIFS
   00020     40404040 40404040 40404040 40404040   -
   00030     40404040 40404040 40404040 40404040   -
   00040     40402500 00000000 00000000 00000000   -   ..............
   00050     00000000 00000000 00000000 00000000   - ................
   00060     00000000 00000000 00000000 00000000   - ................
   00070     00000000 00000000 00000000 00000000   - ................

EVAL text:x
   00000     C7D340C3 D6D5E5C5 D9E2C9D6 D540E385   - GL CONVERSION Te
   00010     A2A340E2 D9E5C9C6 E2404040 40404040   - st SRVIFS
   00020     40404040 40404040 40404040 40404040   -
   00030     40404040 40404040 40404040 40404040   -
   00040     25404040 40404040 40404040 40404040   - .
   00050     40404040 40404040 40404040 40404040   -
   00060     40404040 40404040 40404040 40404040   -
   00070     40404040 40404040 40404040 40404040   -
   00080     40404040 40404040 40404040 40404040   -
   00090     40404040 40404040 40404040 40404040   -
   000A0     40404040 40404040 40404040 40404040   -
   000B0     40404040 40404040 40404040 40404040   -
   000C0     40404040 40404040 40404040 40404040   -

Based on what you said, it is copying the value of CNVREC onto the stack
(without the length), but the procedure believes the length is there and
thinks the length is x'C7D3' or 51,155.  That really seems like a bug to me.
I can work around it, but I'm trying to get a clear picture in my head of
what CONST and VALUE do.  So far I'm pretty sure I understand CONST, but
VALUE has a ways to go.

Btw, Scott Klement if you're monitoring this, it looks like somewhere along
the line a copy of the data is going to be made, one way or the other,
although perhaps not the entire 32k.  Since the api I'm calling requires
passing by reference, I can't use CONST and pass it along, I get an
admonishment from the compiler -- I'll have to copy the data to a local
variable.  If I use VALUE, it's either making a copy onto the stack (as
Barbara appears to be saying), or it makes a copy in memory then places a
pointer to that copy on the stack (as you seemed to be saying).

tia,
Peter Dow
Dow Software Services, Inc.
909 425-0194 voice
909 425-0196 fax



----- Original Message -----
From: <bmorris@ca.ibm.com>
Sent: Thursday, December 13, 2001 1:30 PM
Subject: RE: Procedure parameter with VALUE option


> >When the procedure gets this, I believe it is just
> >getting a pointer to your parameter.
> > ...
>
> Jim, the C thing you're thinking of is a char *
> parameter, that is, a pointer to character, where the
> pointer is passed by value.  The RPG equivalent of that
> is a pointer passed by value, or a character variable
> passed by CONST or reference.  What we're discussing
> here is passing the character value itself by value,
> loading all the bytes of the character value onto the
> parameter stack.
>
> Barbara Morris



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



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.