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



Are you trying to simulate a VARYING field? Looks like it to me.

D TextDS    DS                       BASED(textPtr)
D  TextLen                     5I 0
D  TextData                32766A


If you use BASED, no storage is allocated for TEXTDS, so it does not matter
if you declare TEXTDATA as a 32K variable. That way SUBST and other
operation will work the way you want.

If you want to NOT use this suggestion, and you simply want to copy from
that memory location, use this:

  Eval     memcpy(%addr(target) : textPtr + 2: some-length-here )



But why not just use a VARYING field?

-Bob



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Dave Murvin
Sent: Thursday, December 16, 2004 5:29 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Extract variable string from a based DS using a pointer

HI,

I trying to extract a variable string from a data structure like the
following:

DTextDS          DS                  Based(TextPtr)
D TextLen                  1      2B 
0 

  *TEXTData                3      3

Note that TEXTData is not even defined at this point.

What I know is the value of the Text Pointer and the length of the text 
data (from TextLen).  I am having a hard time trying to figure out how to 
retrieve the text string from this structure into a variable character 
field that I can work with.  The TEXTData field should not even need to be 
defined in the DS as long as I know the address where it starts and how 
long it is.  Compiler did not like %Subst(TextDS : 3 : TextLen) because 3 
is larger than the defined DS.

I am just not seeing the solution to this.  I am trying to do this without 
having to specify a specific length to the TEXTData field or the DS.  I was 
thinking there must be some sort of C function that lets be extract from 
memory into a string, but I haven't found it yet.   Something like give me 
the string at TextPtr + 2 for TextLen positions.

Suggestions?

Thanks


Dave Murvin
DRM Enterprises, Inc.


-- 
This is the RPG programming on the AS400 / iSeries (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 ...

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.