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 to produce a pipe-delimited file that has TWO header lines. The first line has file information, the second is the names of the fields. Here's a sample
I've tried using FILEDEF (APPEND with two HOLD commands. It seems to take either the first heading or the second. I've tried -WRITE and can't get it to work. Here's the current version of code:
FILEDEF H001 DISK H001.FTM -RUN
SQL SQLORA PREPARE SQLOUT FOR SELECT 'FH', 'AROpenRepairOrders','1.0','ACA',TO_CHAR(SYSTIMESTAMP, 'YYYY-MM-DD HH24:MI:SS'),'joe.doe@hotmail.com|' FROM DUAL ; END
TABLE FILE SQLOUT PRINT * ON TABLE PCHOLD AS H001 FORMAT DFIX DELIMITER | HEADER NO END -RUN -* SQL SQLORA ALTER SESSION SET CURRENT_SCHEMA = ODB; END SQL SQLORA PREPARE SQLOUT FOR .... long SQL here
FILEDEF H001 DISK H001.FTM (APPEND -RUN
TABLE FILE SQLOUT PRINT * ON TABLE PCHOLD AS H001 FORMAT DFIX DELIMITER | HEADER YES END -RUN
This gives me the file header line, but not the field-names line. I am a neophyte and will be grateful for any help.This message has been edited. Last edited by: MaryMacLean,
You need to issue the FILEDEF twice, once to start, then once with APPEND for the rest:
FILEDEF H001 DISK H001.FTM
-RUN
TABLE FILE CAR
PRINT
COMPUTE HEADER/A100 = COUNTRY || '|' || 'JOE.DOE@HOTMAIL.COM';
WHERE COUNTRY EQ 'ENGLAND';
ON TABLE PCHOLD AS H001 FORMAT DFIX DELIMITER | HEADER NO
END
-RUN
FILEDEF H001 DISK H001.FTM (APPEND
TABLE FILE CAR
PRINT *
WHERE COUNTRY EQ 'ENGLAND'
ON TABLE PCHOLD AS H001 FORMAT DFIX DELIMITER | HEADER YES
END
-RUN
This message has been edited. Last edited by: Francis Mariani,
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
Any ideas why it doesn't appear? It seems like the HEADER YES option should have produced it. If I comment out the part that produces the first line and just use the second, the field names ARE produced. So what's happening?
It is strange, but it works for HOLD, but not for PCHOLD. I would open a case with Tech Support, providing the two examples.
Meanwhile, the workaround might be to use HOLD - if you can access the location on the reporting server where the FILEDEF can create a file...
This works:
FILEDEF H001 DISK baseapp/h001dfix.ftm
-RUN
TABLE FILE CAR
PRINT
COMPUTE HEADER/A100 = COUNTRY || '|' || 'joe.doe@hotmail.com';
WHERE COUNTRY EQ 'ENGLAND';
ON TABLE HOLD AS H001 FORMAT DFIX DELIMITER | HEADER NO
END
-RUN
FILEDEF H001 DISK baseapp/h001dfix.ftm (APPEND
TABLE FILE CAR
PRINT
COUNTRY
CAR
MODEL
LENGTH
WEIGHT
HEIGHT
WHERE COUNTRY EQ 'ENGLAND'
ON TABLE HOLD AS H001 FORMAT DFIX DELIMITER | HEADER YES
END
-RUN
FILEDEF H001 DISK h001dfix.ftm
-RUN
TABLE FILE CAR
PRINT
COMPUTE HEADER/A100 = COUNTRY || '|' || 'joe.doe@hotmail.com';
WHERE COUNTRY EQ 'ENGLAND';
ON TABLE PCHOLD AS H001 FORMAT DFIX DELIMITER | HEADER NO
END
-RUN
FILEDEF H001 DISK h001dfix.ftm (APPEND
TABLE FILE CAR
PRINT
COUNTRY
CAR
MODEL
LENGTH
WEIGHT
HEIGHT
WHERE COUNTRY EQ 'ENGLAND'
ON TABLE PCHOLD AS H001 FORMAT DFIX DELIMITER | HEADER YES
END
-RUN
I guess as a workaround you could use the two HOLDs that Francis talks about. Then create a generic master so you can PCHOLD the output.
-* Allocate the flat file
FILEDEF H001 DISK h001.ftm (APPEND
-RUN
TABLE FILE CAR
PRINT
COMPUTE HEADER/A100 = COUNTRY || '|' || 'JOE.DOE@HOTMAIL.COM';
WHERE COUNTRY EQ 'ENGLAND';
ON TABLE HOLD AS H001 FORMAT DFIX DELIMITER | HEADER NO
END
-RUN
TABLE FILE CAR
PRINT
COUNTRY CAR MODEL BODYTYPE SEATS DEALER_COST RETAIL_COST SALES
LENGTH WIDTH HEIGHT WEIGHT WHEELBASE FUEL_CAP BHP RPM MPG ACCEL
WHERE COUNTRY EQ 'ENGLAND';
ON TABLE HOLD AS H001 FORMAT DFIX DELIMITER | HEADER YES
END
-RUN
-* Create master for flat file
FILEDEF HMAST DISK hdata.mas
-RUN
-WRITE HMAST FILENAME=HDATA, SUFFIX=DFIX, DATASET=h001.ftm, $
-WRITE HMAST SEGMENT=HDATA, SEGTYPE=S0, $
-WRITE HMAST FIELDNAME=COLUMN1, ALIAS=COLUMN1, USAGE=A4000, ACTUAL=A4000, $
-RUN
-* Output the flat file using PCHOLD
TABLE FILE HDATA
PRINT
COLUMN1 AS ''
ON TABLE PCHOLD FORMAT DFIX DELIMITER | HEADER NO
END
-RUN