When receiving text files that are larger than 9999 records, I need to split the file into one or more files. I have been able to accomplish this by reading, tokenizing into a string list and then looping and creating two different string lists. My issue is with being able to write the split files back as text files with a CRLF at the end of each row. I do not see a function to write a string list to a file but may have been staring at this too long. Any help would be appreciated.
can you provide screenshot of your code or loop. how are you dividing the file, may be we will be able to provide you better idea.
you can try flatfile schema. if you want to deal purely in files and string.
then use stringToFile service from WmPublic folder. and in data input variable you can provide CRLF
For your requirement I have two approaches that might help you.
1> Based on your input text files, you may create a flat file dictionary and schema and process the files using convertToString, you may also write the file directly using this service
2> Based on your comment you have mentioned " I do not see a function to write a string list to a file but may have been staring at this too long. Any help would be appreciated"
Try to loop over the stringlist and inside the loop call stringToFile (make sure you have selected append=true) for more details refer BIS
3> Writing a java service which will take stringList as input and code a service stringListToFile. This might take some time to be invested.
Let me know your comments.
I discovered that my issue is that the CTL file does not allow for writing in my environment. Another group maintains this file and does not want files written. Since these items are ultimately destined for MQ, I’ll just loop through and submit one by one. It’s not the most elegant solution but what I am left with.