Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Erratic behavoiur when concatenating

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Erratic behavoiur when concatenating
 Login/Join
 
Platinum Member
posted
Hi Everyone

I just discovered a strange problem and it is really bugging me, since I fail to understand what could cause this.

I am concatenating onto a field and sometimes it leaves a space after the field and sometimes it does not.

Here is an example.
DEFINE FILE SOMETABLE
THEJOIN/A22= SERV | 'A';
WHATEVER/A1='X';
END
-*-
TABLE FILE SOMETABLE
SUM
SOMEMEASURE
BY THEJOIN
BY WHATEVER
END


This keeps a space. THEJOIN looks like this "VALUE A"

However if I remove WHATEVER from displaying... like this...

DEFINE FILE SOMETABLE
THEJOIN/A22= SERV | 'A';
END
-*-
TABLE FILE SOMETABLE
SUM
SOMEMEASURE
BY THEJOIN
END


Then I am getting no space in THEJOIN. It looks like this "VALUEA".

So the final data is exactly the same in both cases except there is a space in the first example and no space in the second example.

This is causing me all kinds of trouble since the space is erratically showing up and I use that field in a join later on.

Of course I can get around the problemn with a strong concat everywhere.

But I want to understand why this is happening. Is it a bug? Any ideas?

Thanks

Jodye

PS this forum really needs a "preview post" before it is posted. Smiler


WF 8.0.0.5M
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Report This Post
Expert
posted Hide Post
DEFINE FILE CAR
THEJOIN/A22= COUNTRY | 'A';
WHATEVER/A1='X';
END
-*-
TABLE FILE CAR
SUM
SEATS
BY THEJOIN
BY WHATEVER
END

---------------------------

DEFINE FILE CAR
THEJOIN/A22= COUNTRY | 'A';
END
-*-
TABLE FILE CAR
SUM
SEATS
BY THEJOIN
END


The space stays when I use the CAR file, with or without BY WHATEVER.

Is the field a variable length field?


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
quote:
THEJOIN/A22= SERV | 'A';
WHATEVER/A1='X';


Try using the Strong '||' concatenation if it is an issue with a space after what is in SERV.


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Virtuoso
posted Hide Post
What's the Format of SERV?


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Platinum Member
posted Hide Post
Hi

Francis: Yes I tried to replicate the problem with CAR and I don't see it either. The field is A20.

Leah: I know that strong concat will fix the problem. I simply want to understand what is going on. Why is there sometimes a space for the exact same data? Why should adding a defined field change the behaviour of a totally unrelated field?

Thanks!

Jodye


WF 8.0.0.5M
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Report This Post
Platinum Member
posted Hide Post
Hi JG

It is A20. If I view source I see that the value is either

"value               a"


or "valuea"

depending on whether or not the additional BY is there. So the weak concatenation is not working in one case.

thx


WF 8.0.0.5M
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Report This Post
Master
posted Hide Post
Try this:
DEFINE FILE SOMETABLE
THEJOIN/A22= SERV || (' ' | 'A');
END


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006Report This Post
Virtuoso
posted Hide Post
jodye,

If SERV is A20 and THEJOIN is A22, try
THEJOIN/A22= SERV | ' A';


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Expert
posted Hide Post
Jodye,

I take it that the output is HTML? I would trap the SET values and also check out the source to see if there's a font issue? Can't see that being the case myself but ....

T

This message has been edited. Last edited by: Tony A,



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Virtuoso
posted Hide Post
The code you posted is obviously an example.
Maybe it helps if you provide us with the 'real' code that is giving you headaches. Since you want to understand what is happening (alongside solving your problem) I think we can do that best with your real code.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Platinum Member
posted Hide Post
Jodye

Is your data source - SOMETABLE - coming from a relational DB? If so, which one?

EricH
 
Posts: 164 | Registered: March 26, 2003Report This Post
Virtuoso
posted Hide Post
Is the format of the SERV field A20 and not A20V - just wanted to check because this WOULD cause the problem you are seeing. The extra V is due to a VARCHAR field in the DB and WF translates it to a variable length Alpha field in which case, there are no trailing spaces.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Platinum Member
posted Hide Post
Hi Everyone

First of all, you guys rock. This forum is such an excellent resource. I wish I was going to the conference this year to meet you all. Maybe next year.

Ok here is some clarification. I am not really concatenating the letter "A". What I am really doing is extracting data from two different sources and then joining the hold files. The problem I found yesterday is that sometimes the join works and sometimes it does not. And after some debugging, I found the problem.

This will demonstrate.

PLEASE NOTE: In the following, FIELD1 and FIELD2 in the defines for THEJOIN are exatcly the same in both extracts. They come from SOURCE3. Also, this is sample code. Please assume that I have a good reason for extracting the data separately and then joining the hold files.


-*************
-*extract 1
-*************
JOIN CLEAR *
JOIN ID IN SOURCE1 TO ID IN SOURCE3 AS J1 END
-RUN

DEFINE FILE SOURCE1
THEJOIN/A100=FIELD1 | FIELD2; 
END

TABLE FILE SOURCE1
SUM
X
Y
BY THEJOIN
ON TABLE HOLD AS H1 FORMAT FOCUS INDEX THEJOIN
END

-*************
-*extract 2
-*************
JOIN CLEAR *
JOIN ID IN SOURCE2 TO ID IN SOURCE3 AS J1 END
-RUN

DEFINE FILE SOURCE2
THEJOIN/A100=FIELD1 | FIELD2;
END
TABLE FILE SOURCE2
SUM
Z
BY THEJOIN
ON TABLE HOLD AS H2 FORMAT FOCUS INDEX THEJOIN
END



Then once I have the data I join the hold files using THEJOIN.

Now, getting back to the problem at hand.... I am getting an extra space some of the time.
So.. like I said... here is what is happening. In the following, I changed FIELD2 to "A" because it makes the problem more clear.
FIELD1 is A20 and NOT A20V. A typical value for FIELD1 is "CANADA".

So once again... here is an illustration... using only one table, since the problem happens with either table.

-****************************
this code gives me THEJOIN="CANADAA"

DEFINE FILE SOURCE2
THEJOIN/A21=FIELD1 | 'A';
W_AVAIL/P12=IF W_AVAIL LT 0 THEN 0 ELSE W_AVAIL;
END
TABLE FILE SOURCE2
SUM
Z
W_AVAIL
BY THEJOIN
ON TABLE HOLD AS H2 FORMAT FOCUS INDEX THEJOIN
END
-****************************
this code gives me THEJOIN="CANADA A"

DEFINE FILE SOURCE2
THEJOIN/A21=FIELD1 | 'A';
W_AVAIL/P12=IF W_AVAIL LT 0 THEN 0 ELSE W_AVAIL;
END
TABLE FILE SOURCE2
SUM
Z
-*commented out W_AVAIL
BY THEJOIN
ON TABLE HOLD AS H2 FORMAT FOCUS INDEX THEJOIN
END
-****************************


As you can see the only difference is that I commented out the SUM OF W_AVAIL in the second example. The problem occurs in excel as well as HTML.

Now I feel like I have opened a can of worms. Please note, I am NOT asking how to fix the problem. I can fix it in 2 seconds by using strong concatenation. Rather, I am asking WHY is the extra space sometimes there and sometimes not. That is all I need to know. I figure that there must be an explanation for this and that I should know what it is. It is driving me crazy actually.

Unfortunately I cannot replicate the problem using CAR or any other sample. My source is TeraData by the way.

Thanks again.


WF 8.0.0.5M
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Report This Post
Expert
posted Hide Post
Is there a posibility, the data is bad?

Have you looked at the values in Field1 ?

You can use UFMT to show the HEX version of the data.
Hex/A40 = UFMT(Field1,20, Hex);

check to see if the tail of the data is all 20's


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!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
quote:
Unfortunately I cannot replicate the problem using CAR or any other sample. My source is TeraData by the way


That's a toughie. Can you duplicate this using another field or table in Teradata? The fact that you can't reproduce using other data sources would lead me to believe that it is related to Teradata and/or the Teradata adapter, both of which I unfortunately have never used.

There are a few settings like "Transaction Mode" that are unique to each data adapter. You might want to have a look at the Adapter Administration manual Chapter on the Teradata Adapter and see if anything rings a bell.

Any other Teradata users out there?


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Expert
posted Hide Post
We use Teradata a lot here. However, noone has complained. I'd actually take a look at Waz' suggestion and see if you have a non-printable character in some of the data fields. At this point, it sounds like the only plausible reason for this to be happening.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Platinum Member
posted Hide Post
Hi Again

Turns out you guys are right. It is VARCHAR in the table. The person who made tha master file set the field manually to A20 but it is really A20V in the DB.

So why does that cause the extra space to SOMETIMES show? Why doesn't it always show? What factors determine whether the trailing spaces are retained or not?

Thanks so much

Jodye


WF 8.0.0.5M
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Report This Post
Expert
posted Hide Post
hi jodye
in my experience with /AnV fields in some rdbms, (after alot of ageda,) i found that
1) i couldn't just edit the master to change /AnV to /An
2) i couldn't concat, as you found
3) i could redefine the original field, alone, and then the concat worked fine.
DEFINE FILE SOMEFILE
THEJOIN/A20=SERV;
THENEWJOIN/A22=THEJOIN | ' A';
END
What's worse...if the developers in the group want to extract data directly from SOMEFILE,
and they say TABLE FILE SOMEFILE
PRINT .. SERV ...
ON TABLE HOLD AS MYFILE
END
...the data in the .ftm flat file is a screaming MESS because of that /AnV field. (try it, you'll see why you're getting the results that you are). So we had to put a define in the master, and build a Business View master to reveal to the developers. Worked!
Sorry we won't see you at Summit..
-S.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Expert
posted Hide Post
What are your settings for the Teradata connection.

Have you used
ENGINE [SQLDBC] SET VARCHAR OFF

This may fix your problem.


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!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Platinum Member
posted Hide Post
Hi Susannah and Waz

You know what, that is why we started changing A20V to A20 in the master file. Because we were holding data and reading it into ampers and it was totally screwed up. We never noticed before that the nV was causing weird problems with weak concatenation. now that we know we will deal with it accordingly.

Waz: I tried putting
ENGINE SQLDBC SET VARCHAR OFF
in the fex and it did not help. Maybe it has to be in the server configuration file?

I still don't get why the varchar acts so erratically, but it is enough to know that I will expect that from now on and deal with it.

Thanks everyone.


WF 8.0.0.5M
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Report This Post
Expert
posted Hide Post
Jodye,

You have to regen the masters for the VARCHAR OFF setting to have any effect. See current post by Francis M. on the same topic for SQLMSS. The answers apply to you as well.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Member
posted Hide Post
quote:
Originally posted by jodye:
Hi Susannah and Waz

You know what, that is why we started changing A20V to A20 in the master file. Because we were holding data and reading it into ampers and it was totally screwed up. We never noticed before that the nV was causing weird problems with weak concatenation. now that we know we will deal with it accordingly.

Waz: I tried putting
ENGINE SQLDBC SET VARCHAR OFF
in the fex and it did not help. Maybe it has to be in the server configuration file?

I still don't get why the varchar acts so erratically, but it is enough to know that I will expect that from now on and deal with it.

Thanks everyone.



One thing that we have done in conjunction with the "ENGINE SQLDB2 SET VARCHAR OFF" is using the line "ENGINE SQLDB2 SET DEFAULT_CONNECTION [ADAPTER NAME] which may help point to the correct data source if that is the issue.

Another thing you could try when using a -READ is formating the SQL passthrough output to an alpha format, then reading a 6 character length variable, and then the Alpha. For example, if you have a varchar(20) that you want to read:

--------------------------------------------
-DEFAULT &VARLENGTH1 = '[6 SPACES]', &VARIABLE = '[20 SPACES]';
ENGINE SQLDB2
SQL SQLDB2
SELECT VARIABLE
FROM TABLE;
TABLE FILE SQLOUT
PRINT VARIABLE
ON TABLE HOLD AS HOLDTEMP FORMAT ALPHA
END
-RUN
-READ HOLDTEMP &VARLENGTH1.A6., &VARIABLE.A20.
-TYPE &VARLENGTH1;
-TYPE &VARIABLE;

--------------------------------------------


Reading the 6 character length value in the &VARLENGTH1 before reading the &VARIABLE has worked for us. It also allows the use of the variable's length if needed later on.


I hope this helps,

-Jock
 
Posts: 2 | Registered: March 07, 2007Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Erratic behavoiur when concatenating

Copyright © 1996-2020 Information Builders