FWIW, I concur with Dan. I don't think OS/400 even knows that your records are different lengths. If you're using a S/36 type file, you've defined the whole file (regardless of the individual record contents) with a single record length. I don't think it's even possible to define different records with different lengths, unless they are in separate PFs.

So there's not going to be any general-purpose tools that create the output with the record lengths you want.

You're going to have to write it yourself. And I also concur with Dan that you should write your output to a stream file in the IFS. That way, you can make sure everything is precisely the way you want it down to the last detail.

Finally, you can send that file to the remote server in binary mode, and rest assured that they receive it in exact the same format.

Dan Kimmel wrote:
If you're put'ing from a physical file on the AS400 to flat file on a
pc or unix or whatever
1) OS400 sees that file as one record length 2) OS400 doesn't have
any idea what the transaction formats are in that file 3) OS400 will
translate the characters from EBCDIC to ASCII 4) OS400 will add a
CR/LF at the end of what it thinks is the record, that is the record
length of the physical file, same for all records. If you only have
characters in the first 38 bytes, OS400 will pad the remaining with
blanks to the end of the file record length and then and the CR/LF.

Here's one way to handle it:
Write a program to copy all the records to a stream file using the
write function from C (you can use it in RPG as a subprocedure).
Write x0d, x0a at the end of what you think is the correct record
length. When you read a 38 character "record", for instance, write
the first 38 and then write x0d x0a (or CR/LF). Then FTP the stream
file from wherever you put it in the IFS. >

This thread ...


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

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