|
GKern@xxxxxxxxxxxxxxxx wrote:
I think that's similar to what I ended up doing. Below is the code that works: C Eval String_V = *Blanks C Eval String_V = %TrimR(String) + Ifs_RecEnd + x'00' ... C Callp WriteIFSRec(%STR(%ADDR(String_V)):File1)
Sorry, I missed something when I replied before. If your code is indeed working like this, you are actually writing the first 2 "length" bytes of the varying variable. If you really want to do that, your code will not work if the length of the string is less than 256 _or_ if the length is divisible by 256, because the 2-byte binary value would contain x'00'. %STR will find that x'00' and not bother with the rest of the string. (For example, the 2-byte binary value of 10 is x'000A'; 255 is x'00FF'; 256 is x'0100', 512 is x'0200'.) So, if you do need to write the first 2 length bytes, you need to code like this, just passing %ADDR and not doing the %STR. C Eval String_V = *Blanks C Eval String_V = %TrimR(String) + Ifs_RecEnd + x'00' ... C Callp WriteIFSRec(%ADDR(String_V):File1)
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.