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 am creating a CSV file out of Webfocus 7.6.9. Except for the numeric columns, the rest are all enclosed within double quotes. I am using COMT format.
Can any of you kindly let me know what should I have to do if i want even the numeric fields also to be enclosed within double quotes in the generated CSV file.
Please note the columns I choose in the SELECT clause is dynamic and thereby i wouldnt know the datatype of the column before itself.This message has been edited. Last edited by: Kerry,
With the list of columns and formats you can use DM to build computes in the TABLE...HOLD FORMAT COMT
Waz,
we could read the file format but how can we replace the numeric data-type to alpha. So that we can get format to text file where all the numeric values converted to alpha with double-quotes.
WebFOCUS 8.1.03 Windows, Linux All Outputs
Posts: 46 | Location: India | Registered: August 18, 2011
I could read the integers and format it to alpha. But when I retrieve the data to Text file using COMMA, I see spaces in between quotes, this is due to specifying the alpha format to A50. In between the code I couldn't use Trim function. Could you please help me in removing spaces by using Trim function or STRREP.
CHECK FILE CAR HOLD AS H1
-RUN
DEFINE FILE H1
FLAG/D2 = IF FORMAT OMITS 'A' THEN 1 ELSE 0;
END
TABLE FILE H1
PRINT
FIELDNAME
-*WHERE FIELDNAME EQ 'COUNTRY' OR 'CAR' OR 'SALES' OR 'DEALER_COST'
WHERE FLAG EQ 1
ON TABLE SAVE AS H1_SAVE
END
-RUN
-SET &RECS1 = &LINES ;
-SET &CNTR1 = 0;
-REPEAT :ENDREP1 &RECS1 TIMES
-SET &CNTR1 = &CNTR1+1;
-READ H1_SAVE &FLD_NM.&CNTR1.A66
-*-TYPE &FLD_NM.&CNTR1
-SET &NAME.&CNTR1 =&FLD_NM.&CNTR1 ||'_A';
-TYPE &NAME.&CNTR1
-:ENDREP1
-TYPE VALUE IS &FLD_NM1
-TYPE LOOP_CNT IS &RECS1
-RUN
TABLE FILE H1
PRINT
FORMAT
-*WHERE FIELDNAME EQ 'COUNTRY' OR 'CAR' OR 'SALES' OR 'DEALER_COST'
WHERE FLAG EQ 1
ON TABLE SAVE AS H2_SAVE
END
-RUN
-SET &RECS2 = &LINES ;
-SET &CNTR2 = 0;
-REPEAT :ENDREP2 &RECS2 TIMES
-SET &CNTR2 = &CNTR2+1;
-READ H2_SAVE &FMT.&CNTR2.A8
-TYPE &FMT.&CNTR2
-:ENDREP2
-TYPE VALUE IS &FMT1
-TYPE LOOP_CNT IS &RECS2
-RUN
-SET &CNTR3 = 0;
DEFINE FILE CAR
-REPEAT :ENDREP3 &RECS1 TIMES
-SET &CNTR3 = &CNTR3+1;
&NAME.&CNTR3/A50 = FTOA(&FLD_NM.&CNTR3, '(&FMT.&CNTR2)', &NAME.&CNTR3);
-:ENDREP3
END
-SET &CNTR4 = 0;
TABLE FILE CAR
PRINT
-REPEAT :ENDREP4 &RECS1 TIMES
-SET &CNTR4 = &CNTR4+1;
&NAME.&CNTR4
-:ENDREP4
-*ON TABLE SAVE
ON TABLE PCHOLD FORMAT COMMA
END
WebFOCUS 8.1.03 Windows, Linux All Outputs
Posts: 46 | Location: India | Registered: August 18, 2011
Here is something a little simpler you may be able to use.
CHECK FILE CAR HOLD AS CARFIELDS
-RUN
TABLE FILE CARFIELDS
PRINT COMPUTE CODE/A258 = IF EDIT(FORMAT,'9') EQ 'A' THEN FIELDNAME ELSE 'COMPUTE A_' || FIELDNAME || '/A' || EDIT(EXLEN) || '=FTOA(' || FIELDNAME || ',''(' || FORMAT || ')'',A_' || FIELDNAME || ');' ;
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SAVE AS FEX_FIELDS
END
-RUN
TABLE FILE CAR
PRINT
-INCLUDE FEX_FIELDS
ON TABLE PCHOLD FORMAT COMMA
END
Of course you may find other formats that you need to cater for differently, but the important thing is Waz has given you an excellent starting point from which to build.
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