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.
I was thinking of a segment with a setting occurs=variable but that would only work if the length is fixed.This message has been edited. Last edited by: FrankDutch,
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006
Well, I tried fooling around with the OCCURS=VARIABLE and using a variable format but that didn't work.
Using MacGyver or Dialogue Manager, you could substring the pieces doing a GETTOK for the space and write each entry on a separate record, hold, then report.
Or isn't there a filetype where you can specify the delimiter, a space in your case.
Is there a limit to the number of strings that can occur? If so, just DEFINE that many fields and use GETTOK to extract the strings. Although I'm not sure what is returned if you try to extract token 10 and there are not that many. If it returns blanks you're OK and you could set a field to MISSING if so. You could even set this up in the MFD. Otherwise you could read the dataset to find out many occurences are in the longest record (count number of delimiters(space) + 1 and then use DM to lop and define that many fields to re-read the file.
That's a tricky one. Nothing like trying to read your data when you don't know what your data contains, huh?
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, 2007
i use this master to read a file of pipe delimited fields, the Actual can be some gigantic number, big enough to accomodate the biggest possible goofy thing in the inbound data; you don't have to know the max record length. you don't have to have all the fields populated on the inbound. but it will read the fields in order...so if you have missing fields at the end of the record..that's ok...but if you have missing data in the middle... its not going to know...if it were pipe delimited and you had 2 consecutive pipes, that would work, but for space delim with 2 consecutive spaces?? hmmm. that might be a toughy ....This message has been edited. Last edited by: susannah,
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003
The problem with DFIX is that multiple delimiters are treated as missing data. So unless keyfield and keyname are always the same length it will throw in extra columns and real data could be lost.
In the ideal world support for OCCURS=VARIABLE with DFIX applied at segment level for a multi-segment description is what is needed.
Darins suggestion of redefining the data based on a maximum number of occurences is just about the only way to go as the private exits that exist in FOCUS are not available in WebFOCUS.
If the token exceeds the maximum available then there is no problem and it returns nothing.
Lot of suggestions to work out. The last one might bring me a step in the good direction, but the disadvantage is that each field gets a different name, so I need to make an extra step. I can do a table on this database, put it in a hold file and create a new mfd with the occurs is variable since the hold file has all the fields in fixed length.
Thanks for the help.
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006
Ah so multiple spaces, if they were to exist, would cause problems. so i'ld read the file under a 1-field master SQUEEZ out the extra blanks CTRAN the blanks to a pipe (or STRREP) and then read the result with DFIX master.. with the delimiter being a |. As Frank says, this is such a cool language. so many ways.
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003
There are probably more efficient ways, but here is a way to manipulate the file with a single TABLE command.
It reads the line one char at a time and build the rows.
EX -LINES 7 EDAPUT MASTER,tst_data,CV,FILE
FILENAME=tst_data, SUFFIX=FIX,$
SEGNAME=ROOT,
FIELD=FCHAR,ALIAS= ,A1 ,A1,$
SEGNAME=OCCRS, OCCURS=VARIABLE
FIELD=CHAR,ALIAS= ,A1 ,A1,$
FIELD=COUNTER, ORDER, I9, I4,$
FILEDEF TST_DATA DISK tst_data.ftm
-RUN
-* keyfield keyname manyfieldsstring
-WRITE TST_DATA 123 operdoc abdss sjsjsj sjskaa sjswkwk sjsjsjsj jddkskk kwkqa djsaa kskka
-WRITE TST_DATA 125 subdoc1 sajaaa ejwjw wwwwwjwww wjwjqkak dkdodes sjs sj ajaaaa sjskdld ddkdkssa skskaak
-WRITE TST_DATA 112 subdoc2 sjsjaa sh ahaa ah sj sjs dkdodes
-RUN
DEFINE FILE TST_DATA
WORDTXT/A255 = IF COUNTER EQ 1
THEN FCHAR | CHAR
ELSE
IF CHAR EQ ' '
THEN LAST WORD
ELSE
IF LAST CHAR EQ ' '
THEN CHAR
ELSE SUBSTR(255,LAST WORD,1,254,254,'A254') || CHAR ;
WORDNO/I9 = IF COUNTER EQ 1
THEN 1
ELSE
IF CHAR EQ ' '
THEN LAST WORDNO
ELSE
IF LAST CHAR EQ ' ' AND CHAR NE ' '
THEN LAST WORDNO + 1
ELSE LAST WORDNO ;
LINENO/I9 = IF COUNTER EQ 1 THEN LAST LINENO + 1 ELSE LAST LINENO ;
FIELD1/A255 = IF WORDNO EQ 1 THEN WORDTXT ELSE LAST FIELD1 ;
FIELD2/A255 = IF WORDNO EQ 2 THEN WORDTXT ELSE LAST FIELD2 ;
END
TABLE FILE TST_DATA
SUM
MAX.FIELD1
MAX.FIELD2
LST.WORDTXT
BY LINENO
BY WORDNO
WHERE TOTAL WORDNO GT 2
END