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     Joining Tables w/Flat Files

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Joining Tables w/Flat Files
 Login/Join
 
Member
posted
Hi,

I'm trying to join a flat file to some tables in a DB cause I need data out of both the tables and flat files. Here's the code:

-*****************Define flat file*****************
-SET &LOC = '/home/dppeda8/ibi/srv43/wfs/catalog';
FILEDEF ytf0656 DISK &LOC/ytf0656.txt
-**************************************************
-*********Join PO_HDR table to flat file************
JOIN
PO_HDR.PO_NBR TO ytf0656.PO_NBR AS J1
END
-***************************************************
-***************Join Oracle Tables********************
JOIN IPC AND PO_NBR IN PO_HDR TO IPC AND PO_NBR IN PO_LINE AS J3
*****************************************************
-IF &XPRT_SP EQ 'NO' THEN GOTO SCREEN ELSE GOTO EXCEL;
-SCREEN
TABLE FILE PO_HDR
HEADING CENTER
"Header Text Here"
PRINT
PO_NBR
PO_LINE_NBR AS 'PO LINE'
PO_LINE.DATE_CREATED AS 'LINE CREATED'
VENDOR_CODE AS 'VEND'
RECORDING_CO AS 'REC CO'
ITEM_ID
MR_REFERENCE_NBR
MR_LINE_NBR AS 'MR LINE'
DATE_NEEDED AS 'NEEDED'
DATE_RECEIVED AS 'RECEIVED'
QTY_PURCHASED AS 'QTY PURCH'
INVC_QTY
INVC_AMT
UNIT_PRICE
EXPEDITE_MESSAGE1
COST_ELEM_CODE AS 'CEC'
ORG_CODE
LOC_REMOTE
WORK_ORDER_NBR AS 'WO NUMB'
CHG_TO_ACCOUNT AS 'ACCT'
PO_LINE_STATUS AS 'LINE STAT'
DET_MSG1 AS 'Sub Labor Ops Region Code'

Thanks as always....


Webfocus 5.3.4, Unix, Oracle DB, Apache Tomcat
 
Posts: 9 | Location: Irving, TX | Registered: October 30, 2007Report This Post
Platinum Member
posted Hide Post
pbv,

What issue are you having? Getting errors?

Dan


Dev: WebFOCUS 7.6.10, Data Migrator 7.6.10
QA: WebFOCUS 7.6.10, Data Migrator 7.6.10
Prod: WebFOCUS 7.6.2, Data Migrator 7.6.8
Windows 2K3, Tomcat 5.5.17, IIS 6
Usage: HTML, PDF, Excel, Self-serve, BID and MRE
 
Posts: 197 | Location: Roseville, CA | Registered: January 24, 2005Report This Post
Member
posted Hide Post
Getting no data. I know the values I'm inputting are fine because I'm using a PO_NBR from the flat file in my search...


Webfocus 5.3.4, Unix, Oracle DB, Apache Tomcat
 
Posts: 9 | Location: Irving, TX | Registered: October 30, 2007Report This Post
Virtuoso
posted Hide Post
quote:
JOIN
PO_HDR.PO_NBR TO ytf0656.PO_NBR AS J1
END


I don't think your join is correct you need to say IN ... TO ... IN ...


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Expert
posted Hide Post
Your join syntax is incorrect for WebFOCUS.

Also, and of more importance, you should NEVER join flat files to DB2 or any relational engine. One technique is to extract the foreign keys from the flat file and put them in a SAVE file. Then use the WHERE IN FILE syntax against the DB2 file and hold that result in a FOCUS file with an index.

The SAVE file must be 16000 bytes max.

For example:
TABLE FILE flatfile
PRINT DST.PO_NBR
WHERE screening conditions
ON TABLE SAVE
END
TABLE FILE db2table
PRINT/SUM  whatever
WHERE DB2_PO_NBR IN FILE SAVE
etc.
END  


Now I did notice that you where using 2 fields to join on the DB2 table.

You might want to give us more information on that.


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
Virtuoso
posted Hide Post
Leah's comment would definitely cause your problem. Apart from that, there is one other issue I have run into when joining to flat files. If the field I am joining to is not in proper sort order in the flat file, I found that the join doesn't work sometimes. In other words, if you are joining to PO_NBR in ytf0656, then ytf0565 would need to be sorted in PO_NBR sequence.

May or may not be the problem - you'll have to fix the join first as Leah suggests, then see what you get.


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
Virtuoso
posted Hide Post
Found the reference from the manual that mentions the problem I was trying to describe:

In fixed sequential files, the cross-referenced field can be any field. However, both the host and cross-referenced file must be retrieved in ascending order on the named (key) field. If the data is not in the same sort order, errors are displayed. If the cross-referenced file contains only one segment, the host file must have a segment declaration.


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
Virtuoso
posted Hide Post
Hi,
You can join a flat file to a relational table. It is the opposite that you cannot do. However, remember that when you join a flat file to a DB WebFocus does the JOIN and not the DB. So if your flat file is very big it will be slow.


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
In reality you can join from Flat to Relational or Relation to Flat.

There are some things that need to be taken into account.

1. For joining to a flat file, you file MUST be in the right order, if the join field is out of sequence, it will not match. A simple TABLE HOLD will fix this.

2. Joining from a flat file will cause many "Calls" to the realtional DB, which may be inefficient, always have extra WHERE clauses that filter on a column in the relational table, this will improve the performance.

I would suggest for your problem, do the following.


  • Check the order of the flat file join field, if it is not sorted ascending, pre sort it.
  • Remove the second JOIN and test, see if you get info with the one join to the flat file.
  • Set ALL to PASS, and see what data come out.


After this you should have more info on pinpointing the 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
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Joining Tables w/Flat Files

Copyright © 1996-2020 Information Builders