Removing duplicate characters from a string

I was asked how I would remove duplicate characters from a string just using RPG. I has been some time since I came up with an all RPG solution, so I accepted the challenge.

The string of data is in a file, TESTFILE, in the field F1. The sample string I used in F1 was:

SELECT F1 FROM TESTFILE ;

F1
——————–
abcdefghabcdijkl

I have more than one of these characters in the string: a, b, c, and d. And only one of these: f, g, h, i, j, k, and l. My goal is for a single character of all of these.

Read more »

Special offer for IBM i (formerly “AS/400”) Customers: Our 2 powerful SQL products are now FREE*. Today through August 31, 2022 SQL iQuery and SQL Tools are waiving their initial up-front license fee. That’s right, if you order and pay for SWMA for either…

Special offer for IBM i (formerly “AS/400”) Customers:
Our 2 powerful SQL products are now FREE*.
Today through August 31, 2022 SQL iQuery and SQL Tools are waiving their initial up-front license fee. That’s right, if you order and pay for SWMA for either…lnkd.in/gsxyFfZ3

– SQL iQuery for #IBMi (@sqliquery)13:51 – Jun 22, 2022

The #IBMi #PowerHA June 2022 enhancements are now available including: 1. Reduced data transfer during resynchronization with Geographic Mirroring compression 2. Enhanced FlashCopy automation in environments with Geographic Mirroring Learn more here:

The #IBMi #PowerHA June 2022 enhancements are now available including:
1. Reduced data transfer during resynchronization with Geographic Mirroring compression
2. Enhanced FlashCopy automation in environments with Geographic Mirroring
Learn more here: bit.ly/HAJune2022 pic.twitter.com/4eHPOJa9sk

– Brian Nordland (@BrianNordland)11:23 – Jun 22, 2022

Register now & join us this evening to find out what’s brand new as of May, 2022, in #IBMi #RPG! IBM’s lead developer for RPG compilers, Barbara Morris, will be presenting this free for all webinar! @BarbaraM_IBMi

Register now & join us this evening to find out what’s brand new as of May, 2022, in #IBMi #RPG! IBM’s lead developer for RPG compilers, Barbara Morris, will be presenting this free for all webinar! @BarbaraM_IBMi oceanusergroup.org pic.twitter.com/jWeGdOQbRw

– OCEAN User Group (@OCEANUserGroup)09:17 – Jun 21, 2022

Verified by MonsterInsights