|
Or take a look at strtok, which is another of those C functions that returns
the components of a string that are separated by a character (or characters?)
you specify - default is white space. You use this function in a loop, also,
until it returns to say no more token ("word") delimiters.
-------------- Original message --------------
> Oh...then I'd do it this way...
>
> D InFld 9A
> D OutFld 5A
> D I 2 0
> D J Like(I)
>
> /Free
> For I = 1 to %Len(InFld);
> If %SubSt(InFld:I:1) <> *Blanks;
> J +=1;
> %SubSt(OutFld:J:1) = %SubSt(InFld:I:1); // Appropriate error
> checking of course...
> EndIf;
> EndFor;
> /End-Free
>
> But that's just the way I think about code. I wouldn't use an array
> myself because the elements of the array aren't the same in terms of
> usage - they're part of a string. So I would use a string manipulation
> function to do it. Then, you could make this a procedure so other
> programs could use it too.
>
> > -------- Original Message --------
> > Subject: RE: MOVEA in RPG Free
> > From: "Emmanuel Zannis"
> > Date: Thu, July 07, 2005 10:58 am
> > To: "Midrange Systems Technical Discussion"
> >
> > The whole story: Incoming variable has value (9a) of "1 34 6789". I need to
> extract the values 13467. Jerry's solutions and your option II solution allow
> me
> to pass the value of the variable to a work array where in a loop the non
> blanks
> elements are passed to a second array. When the loop end the element values
> "13467" are then passed to a variable which is 5A.
> >
> > Thank you for your reply.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.