Focal Point
[CLOSED] Unwanted Space

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

June 27, 2016, 12:51 PM
GavinL
[CLOSED] Unwanted Space
I'm not sure what happen, but all of a sudden we have spaces in our variables that we can't remove.

I've tried both TRIM_ and TRUNCATE and there is still a space there, but the default is '', no space at all, so where is this space coming from?

Code:
-SET &CLIENTPATH = '';
-TYPE CLIENTPATH = >>&CLIENTPATH<<
-SET &CLIENTPATH = TRIM_(BOTH, ' ', &CLIENTPATH);
-TYPE CLIENTPATH = >>&CLIENTPATH<<
-SET &CLIENTPATH = TRUNCATE(&CLIENTPATH);
-TYPE CLIENTPATH = >>&CLIENTPATH<<


Response:
CLIENTPATH = >> <<
CLIENTPATH = >> <<
CLIENTPATH = >> <<

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



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
June 27, 2016, 06:05 PM
Waz
Is it a space ?

Can you try using UFMT to check.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

June 28, 2016, 05:13 AM
Ruchika Gusain
Hi GavinL,
I don't think so, it is a space because when i apply ARGLEN function on the variable it is giving zero length.

-SET &CLIENTPATH ='';
-TYPE CLIENTPATH = >>&CLIENTPATH<<

-SET &LENGTH=ARGLEN(50, &CLIENTPATH, 'I2');
-TYPE &LENGTH

Thanks

WebFCOUS
8.1.04
June 28, 2016, 06:47 AM
dbeagan
My understanding is that variables always have at least one character, zero length values are not supported.


WebFOCUS 8.2.06
June 28, 2016, 09:52 AM
GavinL
Well, I just did another test and I guess WebFOCUS evaluates spaces with blanks.. This day an age, not able to evaluate spaces. What odd results..

-SET &CLIENTPATH = '';
-SET &MC = &CLIENTPATH.LENGTH;
-SET &MV = IF &CLIENTPATH EQ ' ' THEN 'YES' ELSE 'NO';
-SET &MV2 = IF &CLIENTPATH EQ '' THEN 'YES' ELSE 'NO';
-TYPE MC = >>&MC<<
-TYPE MV = >>&MV<<
-TYPE MV2 = >>&MV2<<
-TYPE CLIENTPATH = >>&CLIENTPATH<<
-SET &CLIENTPATH = TRIM_(BOTH, ' ', &CLIENTPATH);
-TYPE CLIENTPATH = >>&CLIENTPATH<<
-SET &CLIENTPATH = TRUNCATE(&CLIENTPATH);
-TYPE CLIENTPATH = >>&CLIENTPATH<<
-SET &STROUT = STRREP (&CLIENTPATH.LENGTH, &CLIENTPATH, 1, ' ', 0, '', &CLIENTPATH.LENGTH, 'A&CLIENTPATH.LENGTH');
-TYPE STROUT = >>&STROUT<<


Results:
 MC = >>01<<
 MV = >>YES<<
 MV2 = >>YES<<
 CLIENTPATH = >> <<
 CLIENTPATH = >> <<
 CLIENTPATH = >> <<
 STROUT = >> <<




- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
June 28, 2016, 10:01 AM
Francis Mariani
Here's something interesting:

-SET &MYVAR0 = ;
-SET &MYVAR1 = '';
-SET &MYVAR2 = ' ';
-SET &MYVAR3 = '  ';
-TYPE MYVAR0 LENGTH: &MYVAR0.LENGTH
-TYPE MYVAR1 LENGTH: &MYVAR1.LENGTH
-TYPE MYVAR2 LENGTH: &MYVAR2.LENGTH
-TYPE MYVAR3 LENGTH: &MYVAR3.LENGTH


&MYVAR0 has a length of zero. I don't know if this code is valid.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
June 28, 2016, 10:10 AM
GavinL
Interesting in deed! I think you found an undocumented feature. Smiler

Even set to _FOC_NULL returns 09. You found the only thing that returns what is expected.



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
June 28, 2016, 02:05 PM
susannah
Francesco, add this
-TYPE MYVAR0 LENGTH: &MYVAR0.LENGTH &MYVAR0.EXIST
-TYPE MYVAR1 LENGTH: &MYVAR1.LENGTH &MYVAR1.EXIST

and you'll see that myvar0 doesn't exist, but myvar1 does
so I use that feature to nuke some &vars that I've been messing with in a fex to make sure they don't overstay their welcome.
-SET &myvar0 = ;
and its gone




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
June 28, 2016, 02:46 PM
Francis Mariani
"I see", said the blind man as he fell over the cliff...


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
June 28, 2016, 06:23 PM
Waz
Yes, we use -SET &var =; to effectively null the variable.

In fact its a way to stop prompting if you don't want to use -DEFAULTH


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

June 29, 2016, 03:57 AM
Wep5622
quote:
Originally posted by Francis Mariani:
"I see", said the blind man as he fell over the cliff...

Miracle cure!


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
June 30, 2016, 05:22 PM
Doug
Have you considered CTRAN?




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206