|
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" <emmanuel.zannis@xxxxxxxxxxx>
> Date: Thu, July 07, 2005 10:58 am
> To: "Midrange Systems Technical Discussion" <midrange-l@xxxxxxxxxxxx>
>
> 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.
>
> -----Original Message-----
> From: midrange-l-bounces@xxxxxxxxxxxx
> [mailto:midrange-l-bounces@xxxxxxxxxxxx]On Behalf Of rob@xxxxxxxxx
> Sent: 07 July 2005 3:44 PM
> To: Midrange Systems Technical Discussion
> Subject: RE: MOVEA in RPG Free
>
>
> <SNIP>
> D Ar2 S 1A Dim(9)
> D Wrk_Field S 5A
> ...
> C Movea Ar2 Wrk_Field
> <ENDSNIP>
>
>
> OPTION I:
> D Ar2DS ds
> D Ar2 1A Dim(9)
> D Wrk_Field S 5A
> ...
> Wrk_Field=Ar2DS;
>
>
> OPTION II:
> D Ar2 S 1A Dim(9)
> D Wrk_Field S 5A
> D x s 5i 0
> ...
> For x=1 to %elem(Ar2);
> %subst(Wrk_Field:x:1)=Ar2(x);
> EndFor;
>
>
> OPTION III:
> Reevaluate the logic. Do you really need to move the field from one to
> the other? Maybe the whole logic is based on obsolete restrictions?
>
>
> Additional archival search words: free format MOVEA rpg rpgle rpgile ile
>
> >From the archives:
> > Barb had a little contest on to see if anyone could find a good use for
> > MOVEA. So far no clear winners.
>
> Rob Berendt
> --
> Group Dekko Services, LLC
> Dept 01.073
> PO Box 2000
> Dock 108
> 6928N 400E
> Kendallville, IN 46755
> http://www.dekko.com
>
> --
> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
> To post a message email: MIDRANGE-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/midrange-l
> or email: MIDRANGE-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/midrange-l.
>
> The above information is confidential to the addressee and may be privileged.
> Unauthorised access and use is prohibited. If you received this message in
> error please tell us by reply (or telephone the sender) and delete all copies
> from your system.
>
> Internet communications are not secure and therefore this Company does not
> accept legal responsibility for the contents of this message. This e-mail
> message has been swept by Activis e:)scan for the presence of detectable
> computer viruses, but we cannot guarantee that it is virus-free and you
> should scan this email for viruses prior to opening or saving any attachments.
>
> If you are not the intended recipient, any disclosure, copying, distribution
> or any action taken or omitted to be taken in reliance on it, is prohibited
> and may be unlawful.
>
> Please note that communications sent by or to any person through our computer
> systems may be viewed by other members of the Hogg Robinson group.
>
> Hogg Robinson plc
> Registered Office: Abbey House, 282 Farnborough Road, Farnborough, Hampshire
> GU14 7NJ
> Registered in England and Wales No 2107443
>
> --
> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
> To post a message email: MIDRANGE-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/midrange-l
> or email: MIDRANGE-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/midrange-l.
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.