You wrote it out with a bunch of NULLS.

Need to know the actual IFS data length to write back to the file.

Richard Schoen
RJS Software Systems Inc.
Where Information Meets Innovation
Document Management, Workflow, Report Delivery, Forms and Business Intelligence
Email: richard@xxxxxxxxxxxxxxx
Web Site:
Tel: (952) 736-5800
Fax: (952) 736-5801
Toll Free: (888) RJSSOFT


message: 1
date: Sat, 24 Mar 2012 11:46:55 -0500
from: Vern Hamberg <vhamberg@xxxxxxxxxxx>
subject: How to trim end of IFS file


I have an IFS file which was originally 9,544 characters long, ending with an ASCII CRLF. Space allocated is 16,384. After some processing, it has length 32,256, allocated space 65,536. The original contents were modified, using 1 less character, so the desired length is now 9,543.
The CCSID coming in is 1252, coming out it is 5348 (1252 with euro - not sure why, but it's probably not important in this case - this is on a
V5R4 box, by the way).

The remainder of the 32,256 is nulls (x'00'). I need to get a file with the new length, without the extra nulls. To be fully open here, I want to avoid using the IFS APIs - I have a reason that is not germane to this discussion.

I have tried a couple things in QShell - head -n 1 seems to work by redirecting to another file. Trouble is, it copies the data as CCSID 37, removes the ASCII CRLF and appends an EBCDIC LF.

So I looked at strip - that works well with strip -b 9543 [filename] [prefix] - trouble is, it creates 4 files in this case. The first one is just right, CCSID is correct, it's the exact contents I need. So the others need only be deleted. Still, not the most elegant solution.

I have another possibility I will be testing today after lunch, which may make any QShell usage unnecessary.

Still, I want to know more about this. Oh, yeah, I looked at tr
(translate) and wondered about sed (stream editor).


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 by 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.