|
Chris wrote: > Has any one had problems using XLATE? > > d pRawMicrParse pi 10i 0 > d RawMicrIn 80a const varying > > d RawMicr s 80a inz varying > > d cTOAD c const('TOAD 0123456789') > d ctoadl c const('toad 0123456789') > > c ctoadl:cTOAD XLATE RawMicrIn RawMicr > > RawMicrIn = 't123456789t 1234 456789o a123456a' > RawMicr = '' after the XLATE. > > but: > c EVAL RawMicr = RawMicrIn > c ctoadl:cTOAD XLATE RawMicr RawMicr > returns: > RawMicrIn = 'T123456789T 1234 456789O A123456A' > > What Gives? Simon already gave a good answer to the question. I'd just like to add that the behavior is a basic principle behind using varying length strings in the old fixed-form calc specs. In a fixed-form calc, a varying length field works exactly the same as a fixed length field with the same current length. That is, if the current length of a varying length field is 17, it is treated as a fixed length A(17) field, regardless of how long the field is actually declared. It was designed this way to handle the semantics of the fixed- form character operations. For example, many of the fixed- form calcs, such as MOVE, don't change the entire result field. Some modify only the right-most characters, others only the left-most characters. Since EVAL changes the entire result, it can assign a length properly. (BTW, I always like to advertize V5R1 RPG IV features, and here's a good opportunity to mention the new %XLATE built-in function.) Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
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.