|
You can use the %trimr BIF to right trim the input field or checkr to find the last space and then substring it. Also, when you read from the IFS, the read() API returns the number of bytes it read. You can either substring based off of that value or use the %len BIF to update the length of your varying length field after you set it. Matt -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of GKern@xxxxxxxxxxxxxxxx Sent: Tuesday, January 16, 2007 4:45 PM To: rpg400-l@xxxxxxxxxxxx Subject: Assigning the actual length of a variable length field. I found the following statement by Jon Paris in the archive: When you assign a fixed length field to a varying length field - which is effectively what you do when you assign a literal - the length of the variable length field is set to the length of the fixed length field. All data is then copied in - there is no more special significance to spaces in a varying length field than in a fixed length field. My question is: how do I capture only the value and length from the fixed field and apply it to the varying field? What is happening is I'm reading data from the IFS, modifying it and writing it out. I start with a file that is 1k but end up with a file that is 64k even though the data string (input and output) is less than 500 bytes. My fixed length field is 64512. I have a varying field also defined as 64512 long max. I know that equates to the 64k I'm seeing, but I want to only write the data into the varying field, and have it only occupy the space required (ie 1k). Thanks! 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.