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.
It leaves extra spaces to fill up the 27 allowed characters after the session code. I want to get rid of those. I tried putting a || after the session code and the program errors telling me that I am missing an arguement.
MalindaThis message has been edited. Last edited by: Malinda,
WebFOCUS 7.6.11 Windows all output (Excel, HTML, PDF)
I mentioned in a similar post yesterday - when you define a field as A27, it will ALWAYS have 27 characters, so it will always pad with trailing spaces to fit the length specified. You can play with an A27V format which elminates those, but then you have 5 characters at the beginning of the field that specify how long the field actually is. You can also look at TRUNC and SQUEEZ, but as long as the format is A27, it will pad with 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, 2007
One way to solve this would be to COMPUTE only one output field, concatenating all the fields you require into that one field, including the commas and quotes. Something like this:
SET HOLDLIST=PRINTONLY
SET HOLDFORMAT=ALPHA
FILEDEF HCOMM1 DISK baseapp/hcomm1.prn
TABLE FILE CAR
PRINT
COMPUTE
OUTPUT1/A200 = '"' || COUNTRY || '","' || CAR || '","' || MODEL || '"';
ON TABLE HOLD AS HCOMM1 FORMAT ALPHA
END
You still will have some trailing blanks at the end of the data row.
Or magically, like this, with no trailing blanks:
-*-- trailing2.fex - Create a file with variable length records, no trailing blanks
SET HOLDLIST=PRINTONLY
SET HOLDFORMAT=ALPHA
FILEDEF H001 DISK baseapp/h001.prn
-RUN
TABLE FILE CAR
SUM
COMPUTE COSTX/A7 = FTOA(DEALER_COST, '(D7Lc)', 'A7'); NOPRINT
COMPUTE SALESX/A6 = EDIT(SALES); NOPRINT
COMPUTE ALPHA_LINE/A200 = '"' || COUNTRY || '","' || COSTX || '","' || SALESX || '"';
BY COUNTRY NOPRINT
ON TABLE HOLD AS H001 FORMAT TAB
END
-RUN
It appears that TAB delimited does not produce trailing blanks and since there is only one output field, there are no tabs either.
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
So if I try to SQUEEZ a field first in order to only leave 1 blank then I can TRIM the last blank.....my problem is that my field lengths vary so when I format my field to a certain length I have to go with the longest..... How would this work. In my term field, some are just Fall 2010 and others are Fall 2010 1st 8 Weeks so the Fall 2010 has a lot more trailing spaces than the Fall 2010 1st 8 Weeks.
Malinda
WebFOCUS 7.6.11 Windows all output (Excel, HTML, PDF)
-*-- trailing2.fex - Create a file with variable length records, no trailing blanks
SET HOLDLIST=PRINTONLY
SET HOLDFORMAT=ALPHA
FILEDEF H001 DISK baseapp/h001.prn
-RUN
TABLE FILE CAR
SUM
COMPUTE COSTX/A7 = FTOA(DEALER_COST, '(D7Lc)', 'A7'); NOPRINT
COMPUTE SALESX/A6 = EDIT(SALES); NOPRINT
COMPUTE ALPHA_LINE/A200 = '"' || COUNTRY || '","' || COSTX || '","' || SALESX || '"';
BY COUNTRY NOPRINT
ON TABLE HOLD AS H001 FORMAT TAB
END
-RUN
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
Yes I tried combining everything into 1 line with my commas included but it still is leaving a bunch of trailing spaces at the very end. And when i tell it format tab it says no query information to decode.
Malinda
WebFOCUS 7.6.11 Windows all output (Excel, HTML, PDF)
I guess I was trained to use pchold.....Here is what I switched it to:
SET HOLDLIST=PRINTONLY
SET HOLDFORMAT=ALPHA
FILEDEF SAKAI DISK c:/sakai.csv
DEFINE FILE CALLHLD
SITE_ID/A11=IF CALLHLD.SEG01.SITE_ID_SEQ EQ ' ' THEN CALLHLD.SEG01.SITE_ID_CLASS ELSE CALLHLD.SEG01.SITE_ID_SEQ;
START_DATE/A10=DATETRAN(START_DT,'(YYMD)','(-)','EN', 10,START_DATE);
END_DATE/A10=DATETRAN(END_DT,'(YYMD)','(-)','EN', 10,END_DATE);
-*DELIM/A01=',';
-*TERM_OUT/A51= CALLHLD.SEG01.TERM | DELIM;
LINE_OUT/A66 = CALLHLD.SEG01.TERM|| '",' ||CALLHLD.SEG01.SITE_ID;
END
TABLE FILE CALLHLD
PRINT
LINE_OUT
-*COMPUTE TERM_SQ/A51 = SQUEEZ(51, TERM_OUT, 'A51');
-* 'CALLHLD.SEG01.TERM'
-* 'CALLHLD.SEG01.SITE_ID'
-* START_DATE
-* 'CALLHLD.SEG01.TITLE'
-* 'CALLHLD.SEG01.COURSE_ID'
-* 'CALLHLD.SEG01.DESCR'
-* 'CALLHLD.SEG01.PUBLISH'
-* END_DATE
-* 'CALLHLD.SEG01.TEMPLATE'
BY CALLHLD.SEG01.TERM NOPRINT
BY CALLHLD.SEG01.COURSE_ID NOPRINT
HEADING
""
FOOTING
""
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE HOLD AS SAKAI FORMAT TAB
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
and I get this:
0 NUMBER OF RECORDS IN TABLE= 414 LINES= 207 0 NUMBER OF RECORDS IN TABLE= 22 LINES= 11 0 NUMBER OF RECORDS IN TABLE= 207 LINES= 207 0 NUMBER OF RECORDS IN TABLE= 207 LINES= 207 0 ERROR AT OR NEAR LINE 411 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC350) ERROR WRITING OUTPUT FILE: SAKAI
WebFOCUS 7.6.11 Windows all output (Excel, HTML, PDF)
Regarding the removal of trailing blanks, you could try using the technique of specifying output format with a field value. Here function ARGLEN is used to determine the non-blank length of each COUNTRY/CAR/MODEL string. The string length is attached to the letter 'A' to become the output format for the PRINTed string.
DEFINE FILE CAR
CCM/A200 = COUNTRY || '-' || CAR || ',' || MODEL ;
CCM_FMT/A10 = 'A' || EDIT(ARGLEN(200,CCM,'I3'));
END
-*
TABLE FILE CAR
PRINT CCM/CCM_FMT
END
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
If you PCHOLD a DFIX it will give you the master file.
Try this
TABLE FILE CAR
PRINT COUNTRY CAR MODEL
ON TABLE HOLD AS COMMA FORMAT DFIX DELIMITER ,
END
-RUN
SET HTMLFORMTYPE=COMMA
-*SET HTMLFORMTYPE=XLS
-HTMLFORM COMMA
I would agree with Waz, DFIX is probably your best solution. However remember that there are more parmaeters than just DELIMITER -
DEFINE FILE CAR
LINEOUT/A100 = COUNTRY || (' ' | CAR) || '-' || MODEL;
END
TABLE FILE CAR
PRINT LINEOUT
BY COUNTRY
BY CAR
BY MODEL
ON TABLE HOLD AS TESTDFIX FORMAT DFIX DELIMITER , ENCLOSURE " HEADER NO
END
CMD COPY TESTDFIX.* c:\somefolder\etc\etc
This will give you similar output as FORMAT COMMA and changing to HEADER YES will give you similar output as FORMAT COMT - however, you will not have trailing spaces.
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
DEFINE FILE CAR
LONGTXT/A200=MODEL || '-' || BODYTYPE || '-' || 'THIS IS A LONG FIELD';
END
TABLE FILE CAR
PRINT LONGTXT COUNTRY CAR
ON TABLE HOLD FORMAT COMT
END
In my envrionment (Linux), none of the fields or rows have trailing blanks.
HOLD FORMAT TABT and COMT remove trailing blanks in fields
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, 2006
I would agree with Waz, DFIX is probably your best solution. However remember that there are more parmaeters than just DELIMITER -
DEFINE FILE CAR LINEOUT/A100 = COUNTRY || (' ' | CAR) || '-' || MODEL; END TABLE FILE CAR PRINT LINEOUT BY COUNTRY BY CAR BY MODEL ON TABLE HOLD AS TESTDFIX FORMAT DFIX DELIMITER , ENCLOSURE " HEADER NO END CMD COPY TESTDFIX.* c:\somefolder\etc\etc
This will give you similar output as FORMAT COMMA and changing to HEADER YES will give you similar output as FORMAT COMT - however, you will not have trailing spaces.
And it mostly seems to work after all the report formatting and the end I say cmd copy sakaicrs.* c:\documents and it says that it has copied the files but nowhere can I acutally find it.
WebFOCUS 7.6.11 Windows all output (Excel, HTML, PDF)
I finally got it to work!!! Since several colleges are sharing WebFocus servers so it isn't installed directly on my pc. So this is what I had to do to get it to output in a csv format with no padding. Thanks for the help everyone!!!
DEFINE FILE CALLHLD
SITE_ID/A11=IF CALLHLD.SEG01.SITE_ID_SEQ EQ ' ' THEN CALLHLD.SEG01.SITE_ID_CLASS ELSE CALLHLD.SEG01.SITE_ID_SEQ;
START_DATE/A10=DATETRAN(START_DT,'(YYMD)','(-)','EN', 10,START_DATE);
END_DATE/A10=DATETRAN(END_DT,'(YYMD)','(-)','EN', 10,END_DATE);
COMBINED_FIELDS/A234= CALLHLD.SEG01.TERM || ',' || CALLHLD.SEG01.SITE_ID || ',' || START_DATE || ',' || CALLHLD.SEG01.TITLE || ',' || CALLHLD.SEG01.COURSE_ID || ',' || CALLHLD.SEG01.DESC || ',' || CALLHLD.SEG01.PUBLISH || ',' || END_DATE || ',' || CALLHLD.SEG01.TEMPLATE;
END
TABLE FILE CALLHLD
PRINT
COMBINED_FIELDS
BY CALLHLD.SEG01.TERM NOPRINT
BY CALLHLD.SEG01.COURSE_ID NOPRINT
HEADING
""
FOOTING
""
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT DFIX DELIMITER , ENCLOSURE " HEADER NO
WebFOCUS 7.6.11 Windows all output (Excel, HTML, PDF)