Help on Pattern search and replace in uniface 9.6.

Author: lalitpct@gmail.com (lalitpct)

String 1. Unix Command [. $HOME/prj1 SERVER; abc; jkl;Nmsn;] Need to search for "Unix Command [" and then first semicolon (;) after that replace it by X I was able to get postion for "Unix Command [" using scan output, "Unix Command [?" but Not sure how to get first semicolon. String 2. DB PID: 67 DB server: SERVERNAME DB date: Apr 13 2015 12:04:25PM Here also I need to block SERVERNAME which has DB Server: as fixed pattern but dont know how to get end location. Thanks in advance

4 Comments

  1. What about this codeSmile v_STR  = "command[abc;xyz" v_POS1 = $scan(v_STR,"command[")+$length("command[") v_POS2 = $scan(v_STR[v_POS1],";")+v_POS1-1   Ingo


    Author: istiller (i2stiller@gmx.de)
  2. istiller said What about this codeSmile v_STR  = "command[abc;xyz" v_POS1 = $scan(v_STR,"command[")+$length("command[") v_POS2 = $scan(v_STR[v_POS1],";")+v_POS1-1   Ingo

    Thanks a ton this works perfect


    Author: lalitpct (lalitpct@gmail.com)
  3. Hi lalit, as uniface does not provide a split functionality its good practise to replace the delimiters with <GOLD>; so you can use the string commands


    Author: ulrich-merkel (ulrichmerkel@web.de)
  4. istiller said What about this codeSmile v_STR  = "command[abc;xyz" v_POS1 = $scan(v_STR,"command[")+$length("command[") v_POS2 = $scan(v_STR[v_POS1],";")+v_POS1-1   Ingo

    Here's an alternative solution using $split:     v_STR = "Unix Command [. $HOME/prj1 SERVER; abc; jkl;Nmsn;]"     v_Status = $split(v_STR, 1, "Command [", "", v_STR2)     v_Status = $split(v_STR2, 1, ";", v_STR2)     ; v_STR2 = ". $HOME/prj1 SERVER" And it also seems that in the given scenario $split is slightly faster than $scan. Hope this helps. Daniel


    Author: diseli (daniel.iseli@uniface.com)