# ConvertToString Performance

**URL:** <https://techcommunity.softwareag.com/t/converttostring-performance/107354>\
**Category:** Forum\
**Tags:** EDI\
**Created:** [January 14, 2005, 3:43am UTC](https://techcommunity.softwareag.com/t/converttostring-performance/107354 "2005-01-14T03:43:20Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mbehrns](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@mbehrns](https://techcommunity.softwareag.com/u/mbehrns)\
**Post date:** [January 14, 2005, 3:43am UTC](https://techcommunity.softwareag.com/t/converttostring-performance/107354/1 "2005-01-14T03:43:20Z")

</div>

Hello fellow wM Users,

I am selecting a large (35K) number of small rows from a DB, which I need to write to a flat file and then ftp. The steps are as follows:

Select records  
Loop over  
…CovertToString (to create flat file)  
…Map  
End Loop  
blah blah blah

The process is working, but convertToString is taking a very long time. Any ideas on how to maximize performance???

---

<div class="post-metadata">

**Author:** ![ralf.tullius.11060](https://avatars.discourse-cdn.com/v4/letter/r/e480ec/32.png) [@ralf.tullius.11060](https://techcommunity.softwareag.com/u/ralf.tullius.11060)\
**Post date:** [January 14, 2005, 1:22pm UTC](https://techcommunity.softwareag.com/t/converttostring-performance/107354/2 "2005-01-14T13:22:21Z")

</div>

Hi,  
have you tried to get the numbers as strings directly out of the DB with your SQL-Statement (like: to\_char(numberfield)

Ralf

---

<div class="post-metadata">

**Author:** ![mbehrns](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@mbehrns](https://techcommunity.softwareag.com/u/mbehrns)\
**Post date:** [January 14, 2005, 9:04pm UTC](https://techcommunity.softwareag.com/t/converttostring-performance/107354/3 "2005-01-14T21:04:17Z")

</div>

The convertToString function writes the data to a flat file. We need it…

---

<div class="post-metadata">

**Author:** ![terori](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@terori](https://techcommunity.softwareag.com/u/terori)\
**Post date:** [January 15, 2005, 6:00pm UTC](https://techcommunity.softwareag.com/t/converttostring-performance/107354/4 "2005-01-15T18:00:05Z")

</div>

How about building the records from database first before you use the convertToString?

Loop Over (in:Database Conditions; out:outRecords)  
select from database and map to outRecords  
End Loop

convertToString(outRecords)

of couse you need to make sure ur schema records change to record list

---

<div class="post-metadata">

**Author:** ![rpendem.11190](https://avatars.discourse-cdn.com/v4/letter/r/a6a055/32.png) [@rpendem.11190](https://techcommunity.softwareag.com/u/rpendem.11190)\
**Post date:** [January 15, 2005, 8:24pm UTC](https://techcommunity.softwareag.com/t/converttostring-performance/107354/5 "2005-01-15T20:24:07Z")

</div>

WriteToFile service can be used to write records to the file.

---

<div class="post-metadata">

**Author:** ![harishnamdeo](https://avatars.discourse-cdn.com/v4/letter/h/51bf81/32.png) [@harishnamdeo](https://techcommunity.softwareag.com/u/harishnamdeo)\
**Post date:** [July 8, 2007, 6:20pm UTC](https://techcommunity.softwareag.com/t/converttostring-performance/107354/6 "2007-07-08T18:20:07Z")

</div>

hi i m using webmethod 6.1 but I am unable to find out "Sample.io.test:writetofile" service  
  
   
 can any one give the idea to write into file without using this or its alternative plz…

---

<div class="post-metadata">

**Author:** ![Ram\_Challuri](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@Ram\_Challuri](https://techcommunity.softwareag.com/u/Ram_Challuri)\
**Post date:** [July 9, 2007, 7:46am UTC](https://techcommunity.softwareag.com/t/converttostring-performance/107354/7 "2007-07-09T07:46:15Z")

</div>

Hi,

Going back to the performance issue, according to my experience you will get a very good performance boost if you convert the convert to String invoke step to a transformer step. My two cents explanation for performance improvement is as follows.

If you invoke a service, webMethods will try to create a copy of input pipeline , do the processing and then merge the results into already created copy of output pipeline. This is very important to do the way webMethods is doing, but for a task like covertToString, if you have declared the service signature properly not relying on the implicit variables, then you should be able to convert the invoke service to Transformer, by doing this webMethods only deals with what has been mapped as the input and what has been mapped as the output, and hence a lot of memory declaration is avoided. When you do these test on 1 or 100 records you won’t find a huge performance difference. But when you test this on a large number of records then you will for sure will find it to be better (or atleast I found it).

Cheers,  
Ram

---

<div class="post-metadata">

**Author:** ![gupta\_r.17495](https://avatars.discourse-cdn.com/v4/letter/g/9fc348/32.png) [@gupta\_r.17495](https://techcommunity.softwareag.com/u/gupta_r.17495)\
**Post date:** [July 9, 2007, 8:38pm UTC](https://techcommunity.softwareag.com/t/converttostring-performance/107354/8 "2007-07-09T20:38:36Z")

</div>

You can also find this service in PSUtilities package…You can copy this service into your custom package and use it.

HTH,  
RMG

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 3:04pm UTC](https://techcommunity.softwareag.com/t/converttostring-performance/107354/9 "2021-04-02T15:04:45Z")

</div>


