>Select StringobjectNo >SCAN >cReplacedText=ALLTRIM(STR(FObjectno))+" 0 obj <</Type /Page /Parent 2 0 R /MediaBox" >nMissingObjectStartPosition=AT('_123456789_123456789',cFile,1) >cFindMissingText=SUBSTR(cFile,nMissingObjectStartPosition,47) > >* Here I Have Taken Length as 47 assuming that the 1st Word of 'Mediabox' will be included within the span of 47, However, this is not always the case as there can be Strings whose Length can be Far far more than 47. So I need some Logical Improvement on This part particularly. > >*My overall Object is to Extract the String which is '_123456789_123456789.....Mediabox' and replace it with cReplacedText. > >nMissingObjectEndPosition=AT('MediaBox',cFindMissingText,1)+8 > >cMissingText=SUBSTR(cFile,nMissingObjectStartPosition,nMissingObjectEndPosition) > >cFile=STRTRAN(cFIle,cMissingText,cReplacedText,1,1) >ENDSCAN >>
CLEAR MyLongString = "_123456789_123456789_Ym30251_414_5268YYUHnY_/Mediabox" MyStartString = "_123456789_123456789" MyEndString = "Mediabox" MyStringToGetReplaced = SUBSTR(m.MyLongString, AT(m.MyStartString, m.MyLongString, 1) + LEN(m.MyStartString), AT(m.MyEndString, m.MyLongString, 1) - LEN(m.MyStartString) - 1) * should be "_Ym30251_414_5268YYUHnY_/" ?m.MyStringToGetReplaced MyLongString = "_123456789_123456789_Ym30251_7jgu92l02klk414_5268YYU**1HnY_/Mediabox" MyStartString = "_123456789_123456789" MyEndString = "Mediabox" MyStringToGetReplaced = SUBSTR(m.MyLongString, AT(m.MyStartString, m.MyLongString, 1) + LEN(m.MyStartString), AT(m.MyEndString, m.MyLongString, 1) - LEN(m.MyStartString) - 1) * should be "_Ym30251_7jgu92l02klk414_5268YYU**1HnY_" ?m.MyStringToGetReplaced