PDA

View Full Version : How do I convert a string to a 80 byte file


Rebecca
07-18-2002, 12:14
What's the best way to convert a large string to a 80 byte file? I am using the generateFA service in the EDI Adapter package in IS 4.6. The output 997 is one string. I want to save this to a 80 byte file. Thanks for any input.

Rebecca

reamon
07-18-2002, 12:35
I'm completely baffled by this question. Can you elaborate on the specifics of what you're trying to do?

Rebecca
07-18-2002, 13:09
The generateFA service generates a EDI X12 997. The output is a string that is more that 80 bytes. I want to save this string to a text file in 80 byte increments.

I would be glad to email you my output files offline if that would help. Thanks.


Rebecca

dgreen
07-18-2002, 13:19
So, 80 characters per output file line, you mean?

Rebecca
07-18-2002, 13:22
Yes, that is correct.

reamon
07-18-2002, 14:06
You need a Java service to write to a file. Someone has posted the code for that in one of the discussions here and/or on Advantage.

For writing the string, here's a rough approach:

<PRE>
set an index var to 0
while index to end of string > 80
{
write chars from index to index+80
write a CR/LF (or just LF if Unix)
add 80 to index
}
write chars from index to end of string
write a CR/LF if desired
</PRE>