I am having input file which is a comma delimited. Same file can have multiple records in one line. I need to separate these records and write into one output file with fixed format. How can we do that?
Your description of the requirement is very confusing. It's not clear what variations in the layout of the records you can have (maximum length of a field, maximum number of fields in a record, are there only two records or can there be more, etc). It's not clear how the fields separated by blanks fit in or what you want to do with them. Since you used Field1, Field2 and Field3 multiple times, it's impossible to distinguish between them in the input or output.
Please show an example with non-generic values (e.g. ABCDEF,GHI) and explain the possible variations and the "rules" for dealing with them.
Note that 2 records are not separated by comma but they are separated by space.
Huh? Do you mean "2 fields are not separated ..."? There's a big difference between records and fields and when you use incorrect terminology like this, it makes it very difficult to understand what you want.