Search and Replace

Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.

Search and Replace

Postby Clarky » Mon Aug 10, 2009 10:45 am

I want to search an IFS file for multiple characters and replace them with a different set of characters. For example, I want to "convert" the following characters:

 --> A
Ä --> A
À --> A
Á --> A
à --> A
Å --> A
â --> a
ä --> a
à --> a
á --> a
ã --> a
å --> a

Is there a way to do this in 1 task, or does each character have to be specified on it's own Search and Replace task?

Thanks in advance,

John
Clarky
Verified User
 
Posts: 2
Joined: Mon Aug 10, 2009 10:39 am

Re: Search and Replace

Postby Support_Erick » Mon Aug 10, 2009 1:47 pm

Currently (as of version 2.3.0), the Search and Replace task only supports the replacement of a single character or a collection of contiguous characters (such as a word or sentence). So, the only way to achieve this effect within GoAnywhere is to add one Search and Replace task for each character or word you wish to replace. This approach, however, would cause the project to scan the entire file once for each search and replace task within the project.

All data translation tasks, such as CSV, XML, Fixed-Width, etc... support an encoding option that allows you to specify the character set of the file you are working with. This allows GoAnywhere to work with these special characters, which, in many cases, eliminates the need to remove such characters from the data.

Would you provide more information as to why you need to change the character set? And what outcome are you trying to achieve? There may be an alternative approach depending on what you need.
Support_Erick
Support Specialist
 
Posts: 11
Joined: Thu Mar 05, 2009 10:20 am

Re: Search and Replace

Postby Clarky » Tue Aug 11, 2009 12:32 pm

For this project, we were picking up some files from an affiliate. We then put them to the IFS. From there, we use CL commands to upload these files to the AS400 and process them. The problem is that these files occasionally contain some "foreign" characters. When uploading these files using the CPYFRMSTMF command, these characters are not translated properly. I have tried finding a solution with the CPYFRMSTMF command and the proper CCSID's, but haven't had any luck. So I was hoping I could do it in GoAnywhere before the CPYFRMSTMF ever sees the data.

For example, the following data may be in the file:

CAÑON CITY

After copying this info up to the AS400, it may convert it to the following:

CAÃ ON CITY

Not only did it convert the character, but it also added a space.

So, anyway, I am looking for a solution to either convert these characters before the CPYFRMSTMF is performed, or to find a solution to the CPYFRMSTMF bad conversion.

Thanks,

John
Clarky
Verified User
 
Posts: 2
Joined: Mon Aug 10, 2009 10:39 am

Re: Search and Replace

Postby Support_Erick » Fri Aug 14, 2009 2:33 pm

There are a couple ways to get this to work:

1) If you wish to use the CPYFRMSTMF command to upload the file, try setting the Stream File CCSID (STMFCCSID) option to *PCASCII. This CCSID preserves those characters.

2) If the file is one of the GoAnywhere supported file types (Fixed width or CSV), you could create a Read CSV or Read Fixed Width task within your project to read the data out of the file, then use an SQL task to insert the data into the physical file. This also preserves the characters.
Support_Erick
Support Specialist
 
Posts: 11
Joined: Thu Mar 05, 2009 10:20 am


Return to Community Forum

Who is online

Users browsing this forum: No registered users and 2 guests

cron