|
Thanks Matt - adding the null to the end of the string did the trick. My output file is now 1k. "Now I just have to get the (first) two bytes representing the actual lenght out of the data itself." Tommy: "Couldn't you just use substring? mydata = %subst(data:3:datalen);" I thought of that too and tried it but it truncated the first two bytes of real data. I'm pretty sure that by nature, the variable length field will always have a hex value representing the actual data length in the first two bytes. As it turns out it is not a problem, since the next program in the job stream knows how to look for the characters that represent the beginning of the 'real' data. At this point I can consider the problem solved. Simon: "Then you're not doing it properly. The VARYING variable *WILL* be set correctly using %TRIMR(fixed-variable)." It was correct after I added a x'00' to the end of the data as suggested by Matt. "If you're writing a varying length buffer and you already have the length available why are you using a VARYING variable. Seems very backwards to me." I'm not sure what you are saying here. I use varying length variables because of the nature of the application. I access large streams of data (HL7) from hospitals outside of my domain. I then need to read it into an RPG program so that I can update some of that data to make it compatible with my in-house electronic medical record system (EMR). Since the input data is manipulated to remove some bytes and add others, I never know how long an actual HL7 message (read or writte) may be. Some are less than 1000 bytes and some could be 25,000+ bytes, hence the 64k varying variable. Thanks to all of you for your input. I have reached the point where I have my application working as expected. I can now follow up on trying some of the suggestions and techniques as suggested by Scott Klement and Bob Cozzi. Regards, Jerry Gerald Kern - MIS Project Leader Lotus Notes/Domino Administrator IBM Certified RPG IV Developer The Toledo Clinic, Inc. 4235 Secor Road Toledo, OH 43623-4299 Phone 419-479-5535 gkern@xxxxxxxxxxxxxxxx This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please inform the sender by reply e-mail and destroy this and all copies of this message.
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.