June 04, 2007, 04:50 PM
Denny99Need to Extract a text string that varies, from a variable string
I work at a bank and telephone calls and emails are sent to work queues awaiting some technician to take ownership of the Help Desk ticket. Now for the problem-- I have a database filed named "Work Description" and within this field I'm only concerned with extracting the "TO" queue information. For example the following work description "from WIP Dispatched to Queue DFW - PACE.", I'm only interested in extracting "DFW - PACE" nothing else and within work description "from WIP C E No to Queue DFW - Staffware Suppt." I'm only interested in extracting "DFW - Staffware Suppt". Thus I'm only interested in anything that follows "to Queue " and excludes the ending period(".").
I've been trying various verbs (i.e. Gettok, Posit etc...) with no success. Is there any one out there that can lead me in the correct direction? Thanks a million!
June 04, 2007, 05:22 PM
susannahDennis, POSIT will very definitely work, in combination with SUBSTR function.
POSIT , where the string you're searching for is 'to Queue', would give you the integer 21, the position of the 't' in your example.
and then SUBSTR will extract the substring of the inbound string starting with postion 30, or the value of POSIT + 9 (the length of 'to Queue ')
June 04, 2007, 05:44 PM
Darin LeeYou would probably have to use POSIT to get the position of the period as well as it can be in a variable spot depending on length of the queue name. Then calculate the sublength (end - (start+9)) and use it in SUBSTR
SUBSTR(inlength, parent, start, end, sublength, outfield)
June 05, 2007, 03:15 AM
Alan BSusannah and Darin are correct in one approach, but there are always multiple choices:
inField/A100 = 'from WIP Dispatched to Queue DFW - PACE.';
shortString/A100 = GETTOK(STRREP(100,inField,9,'to Queue ',1,'%',100,'A100'),ARGLEN(100,inField,'I3')-9,-1,'%',100,'A100');