Posted Tue, 10 Sep 2013 13:18:00 GMT by Portal Admin

Have a single field in the format 'Lastname, Firstname MI Title'.
I want to join this file to a file containing 2 Key fields 'LASTNAME' and 'FIRSTNAME'.
Any way to do this using Sequel? Not aware of any way to scan or parse-

Can sequel call a user function maybe that could return the two strings (could be done easily with a small RPG utility).

Posted Thu, 16 Jun 2016 05:00:00 GMT by Portal Admin

Hi there,

You can do this using the SPLIT function:

SPLIT

Extract delimited values from a string

 

SPLIT(charexp, charexp, int) or (charexp, charexp)

 

This example view:

SELECT TRIM(cname) NAME(str),

split(str," ") LEN(15) COLHDG("First" "name"),

split(str," ",2) LEN(15) COLHDG("Second" "name"),

split(str," ",3) LEN(15) COLHDG("Third" "name")

FROM sequelex/custmast

 

Will produce the following:

First Second Third

STR name name name

NBCO Corporation Inc. NBCO Corporation Inc.

Obell Group Sales Obell Group Sales

PCE Corp. PCE Corp. n/a

UCE Corp. UCE Corp. n/a

Xcme Corp. Xcme Corp. n/a

State Corp. State Corp. n/a

Lim-Equipment Co. Lim-Equipment Co. n/a

Please let us know if you need anything else!

Jackie Daugherty

Originally Posted By jdaugherty

You must be signed in to post in this forum.