|
Thanks Barbara. I can now see the problem with the MOVEL I am moving the 1st 3 chars of C02NAM only. I will fix the code as you suggested, luckily the users only type from the left. Frank Kolmann >From: bmorris@ca.ibm.com >>From: Frank.Kolmann@revlon.com >>Date: Fri, 8 Mar 2002 08:18:19 +1000 >> >> >>I am using varying length fields to check if a string >>exists in some other field. >>I am having to set the length of the varying field >>before I do a MOVEL. >>I thought I was imagining things where the MOVEL >>itself was previously setting the length. >>I dont mind setting the length as it makes the code >>obvious as to what I am intending. >> >>D C02NAMV S 32 VARYING >>D C02NAM S 30 >> >>C Eval %len(C02NAMV) = %len(%trim(C02NAM)) >>C MOVEL C02NAM C02NAMV >>C Eval pos = %scan(C02NAMV : S02NAM) > >Frank, you can merge the first two statements to a single EVAL: > >C Eval C02NAMV = %trim(C02NAM) > >And assuming you only need CO2NAMV for the %scan, you can do >the whole thing in one statement and skip even defining CO2NAMV. > >C Eval pos = %scan(%trim(C02NAM) : S02NAM) > >By the way, your code has a bug if it's possible for CO2NAM to >have leading blanks, say ' abc '. CO2NAMV would have its length >set to 3, and then the MOVEL would set it to ' ab'. > >Barbara Morris
As an Amazon Associate we earn from qualifying purchases.
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.