Re: String manipulation a la INSTR
Posted in 2000
"Art S. Kagel" <kagel@bloomberg.net> wrote in message news:397F4564.D1825C23@bloomberg.net... > Jeff Glenn wrote: > > > > In our old DB we have a NAME field. It stores last name, first name, which > > is '/' delimited. I need to parse out the slash so I can extract just the > > last name, or first name, and insert them into the appropriate columns. > > > > I was hoping to find something similar to INSTR but I haven't found an > > equivalent function in IDS. All I've found so far is SUBSTRING and SUBSTR, > > but those require the starting position and the length of the substring to > > be extracted. Doesn't work for me because it's unpredictable. > > > > We are running IDS 9.2, Sequent Dynix/PTX. > > Can you run the load file through an AWK/sed/ or perl script and > replace the slashes with column delimiters? Write an ESQL/C program > (or 4GL program with a C parser) to read in the old data and parse the > record before inserting? Using strtok() this should be trivial. This > is not a job SQL was intended for, use the right tools for the job, > Jeff, in this case it's parsers like AWK/sed/perl/lex/strtok. > > Art S. Kagel > But I wanna do it all in SPL!! Waaaah!