Wrtiting to a flat file in IS version 6

I am having difficulty writing to a fixed length flat file.

I need to read records from an AS400 physical file then write them to a flat file on a windows 2000 server. I can read the file from the AS400 using execsql but am not sure how to write the records to the fixed length flat file, I have created a flat file schema to be used in the flow. I have tried using convertToString service but am getting no data in the “string” output of this service even though data is going in to the service. I have also created a simple service that maps two fields in to convertToString but again no output from service, the errorArray contains null.

Any help/quidence greatly appreciated


Tony Mundy


Create a record based on the schema (highlight the schema, go to the “Flat File Structure” tab, click the “Create Document Type” icon).

Create a reference to that document type in the pipeline, map your data to the reference.

Map the reference document to ffValues (Service In for convertToString).

Set the schema variable in convertToString the correct schema.

Set the outputFileName variable in convertToString to the correct file path.

If the schema works properly when you test it with an example file, this should write the file that matches the fixed length schema. This assumes that there is no record delimiter (e.g. no !, @, newlines, etc. between records.)

If there are record delimiters you will have to create a dictionary and a schema to get this to work. Create the dictionary, define the schema based on the dictionary. In the schema Flat File Defintion tab, set Record Parser to Delimiter define the Record Character as !, @, etc. (the delimiter value). Now go to the first step above and continue.

-Phillip Jewell

Thanks Phillip from your quick response.

I have had some success with your suggestions.

I have started with a very simple schema. Because the records do not have an identification field I have created a dictionary with a record definition. In my schema I have referenced the dictionary, from the schema I created the document type as you sugested. In the flow I have a map service, input to this is a document with 2 fields both 10 long. I map the the input fields into the document created from the schema. In convertToString service I map the document (top level) to ffValues, ffSchema contains the schema name (cut and pased).

When I run the service and enter 2 value I get no output from the convertToString, but if I just set (hard code) the values in the document I get output. Another problem, if I enter a file name and path I get an error “null pointer exception” but the file is created in the directory and it contains the correct values.

Thanks once again for any help

Tony Mundy


Haven’t seen either of these occur. May be easier to take this off wmforum and come back with an answer later. Contact information is below. Please contact me by phone or email, and let’s work on this. Thanks. -Phillip

Phillip Jewell
Training Course Development
email: pjewell@webmethods.com
office: 313-885-1057
mobile: 313-506-5960

Hi guys,

This is great! But how to do this in 4.6? I mean how to save a file with fixed record/ field length in ASCII format on the server? Is writing the service in Java the only way? Is there some place where one could download “shareware” packages with such kind of utilities?

Thanks a lot!

I have the same “null pointer exception” error.
In convertToString:
the document is mapped to ffValues,
ffSchema contains the schema name,
delimiters contains the record, field and subfield delimiters,
outputFileName contains the path and file name.
When I run the flow service, I get an error “com.wm.app.b2b.server.ServiceException: java.lang.NullPointerException” for the service convertToString but the file is created in the directory specified in and it contains the correct values.
In AuditLog, the service is displayed as “failed”.

Where does this error come from ?

Upgrade to 6.01. You should see this error disappear after the upgrade.


I am facing a similar problem, If I pass a record with few fields as null it does not create any output string and if I hardcode these variables to some value the converttostring is able to create a string.

Any solution to this ?