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 have a requirement in which I am required to create a pipe delimited file. The solution that has been developed is below. I writing to find out if anyone has any other suggestions.
Thanks
DEFINE FILE BE_MERCHANT
PIPE/A1 = '|';
END
-RUN
TABLE FILE BE_MERCHANT
PRINT
MERCHANT AS 'Merchant'
PIPE AS ''
BANK_NUMBER AS 'Bank'
PIPE AS ''
ASSOCIATION AS 'Association'
PIPE AS ''
MERCH_SIC_CD AS 'SIC Code'
PIPE AS ''
WHERE BANK_NUMBER = '3865'
WHERE RECORDLIMIT EQ 50
ON TABLE PCHOLD FORMAT ALPHA
END
-RUN
Prod: WebFOCUS 7.6.10 MRE Oracle/Sybase Test: DevStudio 7.6.6 WF Server 7.6.6 Report Caster 7.6.6 Web Server - Tomcat MS Windows XP SP2 Output: HTML, Excel 2000 , PDF, CSV, DOC
your way is a good one. i take it one step further. your report produces a fixed length record I then re-read this fixed length record file using a master with a single field MYSTUFF, , A80 , A80, $ (I write the master in my fex , and filedef it to my agent, nice and clean, but you can have just a dummy master hanging about somewhere on your path.. )
and then redefine a field that uses the SQUEEZ function to take out all double blanks...makes a tighter file and doesn't look quite so silly when passing to somebody else's app...but if that's of no matter, then your way is fine. The question i have for you is, do you need column titles in your output? If so, then your way alone won't work, it won't produce titles in your output; FORMAT WP or FORMAT DOC will work, but it has baggage, that icky dotted line under the titles.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
Alternatively, you could make a DEFINE'd field that contains the entire string. Make it as long as needed to contain all separate fields and the pipe symbols. Like:
DEFINE FILE BE_MERCHANT
TOT_STRING/A200 = MERCHANT || '|' ||
BANK_NUMBER || '|' ||
ASSOCIATION || '|' ||
MERCH_SIC_CD || '|';
END
-RUN
TABLE FILE BE_MERCHANT
PRINT TOT_STRING
WHERE BANK_NUMBER = '3865';
WHERE RECORDLIMIT EQ 50;
ON TABLE PCHOLD FORMAT ALPHA
END
Hope this helps ...
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007
Seeing Alan B's reply to the "string problem" post, it got me thinking that you could achieve this fairly easily with headings. Table out your extract and place in a comma delimited file with titles (FORMAT COMT) and then create a dummy master description for that temporary file and use a version of Alan's function to change the commas to "pipes". You could easily get rid of the double quotes around the alpha fileds as well if you needed to.
DEFINE FUNCTION repChar (string/A200,search/A1,repStr/A1)
repChar/A200 = STRREP(200,string,1,search,1,repStr,200,'A200');
END
TABLE FILE CAR
SUM RCOST
DCOST
BY COUNTRY
BY CAR
BY MODEL
ON TABLE HOLD AS PREPIPE FORMAT COMT
END
-RUN
FILEDEF PREPMAS DISK PREPALT.MAS
FILEDEF PREPALT DISK PREPIPE.CSV
-RUN
-WRITE PREPMAS FILE=PREPALT,SUFFIX=FIX
-WRITE PREPMAS SEGNAME=SEG1
-WRITE PREPMAS FIELD=PREPALT_REC, ,A200 ,A200 , $
-RUN
TABLE FILE PREPALT
PRINT COMPUTE OUTPUTSTR/A200 = repChar(repChar(PREPALT_REC,',','|'),'"','');
ON TABLE SAVE AS POSTPIPE FORMAT ALPHA
END
-RUN
CMD TYPE POSTPIPE.*
OK, you are double handling your data and you have to consider the run time on large files, but it gives you a sweet output.
T
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, 2004
I agree that Alan's suggestion of nested strreps is a good idea. We often forget that we can nest functions to obtain our output(s).
However, some many struggle with being able to clearly see the various parameters within the combined syntax and thereby get errors, but in Alan's function it uses the code to good effect by reducing the number of attributes required and thereby makes the actual COMPUTE syntax less complex (as some of the required strrep parms are repetative) and therefore easy to read = easier maintenance!!
This approach could also be benificial for Frank's SD calculations etc.
T
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, 2004
Thanks Tony, Susannah, GamP, Leah, and Ginny Jakes for all of your helpful suggestions related to my "Pipe Delimited" file questions. I Hope to meet each of you guys at Summit.
Prod: WebFOCUS 7.6.10 MRE Oracle/Sybase Test: DevStudio 7.6.6 WF Server 7.6.6 Report Caster 7.6.6 Web Server - Tomcat MS Windows XP SP2 Output: HTML, Excel 2000 , PDF, CSV, DOC