Focal Point
[SOLVED] EDIT(field,'99999999999999999999'); stops at first blank space

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/2457008136

June 28, 2013, 11:42 AM
BGronli
[SOLVED] EDIT(field,'99999999999999999999'); stops at first blank space
From this post, Pat (PBrightwell) posted:
quote:
When using EDIT in FOCUS or WebFOCUS you only need to mask the positions that you are using. So to extract the first 5 postitions of any string you would need:
S/A5=EDIT(Y,'99999');

IF you want the second 5, you would need
S/A5=EDIT(Y,'$$$$$99999');

You only need to mask the entire string if the characters you want are at the end.


My problem is that the field I am editing is defined as VARCHAR and teh EDIT stops when it hits a blank. So, if the field contains the string
quote:
This message goes on and on and on and on...
, I should be getting back
quote:
This message on and
. Instead I get
quote:
This
.

How can I ensure that I will get the full 20 characters?

Thank you,
Brad.

This message has been edited. Last edited by: BGronli,


7.7, z/OS & Win7, excel & pdf
8.2 testing
June 28, 2013, 12:18 PM
RSquared
Can you please post your code snippet.


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
June 28, 2013, 01:54 PM
BGronli
DEFINE FILE IWNEWS 
TXT/A20 = EDIT(NEWS_TXT,'99999999999999999999'); 
END  



7.7, z/OS & Win7, excel & pdf
8.2 testing
June 28, 2013, 03:00 PM
RSquared
Please post the field definition in the .mas file.


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
June 28, 2013, 06:38 PM
j.gross
I would use SUBSTRV() rather then EDIT()
June 29, 2013, 01:02 AM
badri
Hello brad,
Do you want the first 20 characters irrespective of whatever value is in that field or is it something else?
thanks
Badri


WF 7.6.11,
oracle 11g ,windows
PDF , excel, AHTML
June 29, 2013, 01:25 AM
badri
I agree with j.gross.
USE SUBSTR() if its a fixed length field
OR SUBSTV() if the field is of variable lengths as defined in ur master file.

Thanks
Badri


WF 7.6.11,
oracle 11g ,windows
PDF , excel, AHTML
July 01, 2013, 09:43 AM
BGronli
RSquared, the field is defined as follows:
FIELD=NEWS_TXT          ,NEWS_TXT          ,A200V  ,A200V,MISSING=OFF,$  


badri,
Correct, I want the first 20 postions of the field regardless of value.

j.gross & badri,
I modified the code in my DEFINE as follows:
NEWS_TXTV/A200V = TRIMV('T',NEWS_TXT, 200,' ', 1, NEWS_TXTV);
ALEN/I4 = LENV(NEWS_TXTV,ALEN); 
TXT/A20V = SUBSTV(ALEN, NEWS_TXTV, 1, 20, TXT);                  

and had the same results. I am only getting characters up to the first blank space. NEWS_TXT, on the database contains: This is a test of the Information Warehouse News Message entry system and table. If this had been an actual Information Warehouse News Message, you would have been informed of something meaningful.

What is returned is: This


7.7, z/OS & Win7, excel & pdf
8.2 testing
July 01, 2013, 09:47 AM
Tom Flynn
Try This:
  
X_NEWS_TXT/A200 = NEWS_TXT;
X_NEWS_20/A20   = SUBSTR(200, XNEWS_TXT, 1, 20, 20, 'A20'); 



Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
July 01, 2013, 10:55 AM
BGronli
Thank you all for the replies. I have determined the problem was between the seat and the keyboard. It actually had to do with another piece of the define which builds the html I am returning to the page:
TXTBOX1/A69 = '<input type=text size="25" maxlength="25" value='||TXT;
TXTBOX2/A86 = TXTBOX1||' name='||''''|MTXT||''''|' id='||'''';  
TXTBOX3/A121 = TXTBOX2||MTXT||''''|' readonly="readonly"'; 
TXTBOX/A156 = TXTBOX3||' style="background-color:#cccccc;">';   

When I worked these DEFINE lines as follows:
TXTBX1/A41 = '<input type=text size="25" maxlength="25"';             
TXTBX2/A81 = TXTBX1||' value='|''''|TXT||''''|' name='|''''|MTXT;     
TXTBX3/A102 = TXTBX2||''''|' id='|''''|MTXT||''''|' readonly=';       
TXTBOX/A147 = TXTBX3||'"readonly" style="background-color:#cccccc;">';  

I get the data back that I am expecting and it works whether I use:
PARA_TXT/A210 = PARAG(200, NEWS_TXT, '~', 20, PARA_TXT); 
TXT/A20 = GETTOK(PARA_TXT, 210, 1, '~', 20, TXT);          
or
NEWS_TXTV/A200V = TRIMV('T',NEWS_TXT, 200,' ', 1, NEWS_TXTV);   
ALEN/I4 = LENV(NEWS_TXTV,ALEN);                                 
TXT/A20V = SUBSTV(ALEN, NEWS_TXTV, 1, 20, TXT);                   
or
TXT/A20 = EDIT(NEWS_TXT,'99999999999999999999');  

The only difference being the first one does not split in the middle of a word which is fine.


7.7, z/OS & Win7, excel & pdf
8.2 testing
July 02, 2013, 10:14 AM
EricH
Incidentally, you might want to try something like this:

-SET &QT = '''' ;
  


and then use &QT instead of the 4 quote marks. I find this a little easier on the eyes.

EricH