Focal Point
[SOLVED] Output Single Line Text File

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8101007303

October 23, 2008, 04:07 PM
ColdWhiteMilk
[SOLVED] Output Single Line Text File
I am trying to create a text file (TABT) with only one line of text: "ABCD"

I've tried:

TABLE FILE CAR
PRINT *

ON TABLE SUBHEAD 
"ABCD"

ON TABLE PCHOLD FORMAT TABT
END


But it gives me a password error.

Does anyone know how to create a text file where the output is just a single line of text?

This message has been edited. Last edited by: Kerry,


Production - 7.6.4
Sandbox - 7.6.4
October 23, 2008, 04:22 PM
ColdWhiteMilk
I figure out what I was looking for:

SET ASNAMES = ON

DEFINE FILE CAR
TRIGRNAME/A50= '';
END

TABLE FILE CAR
SUM
TRIGRNAME AS 'ABCD'

WHERE RECORDLIMIT EQ 1

ON TABLE PCHOLD FORMAT TABT
END



Production - 7.6.4
Sandbox - 7.6.4
October 23, 2008, 04:35 PM
ColdWhiteMilk
Maybe I don't have this yet.

My solution prints the header line "ABCD", but then has a carriage return and a second row.

I need JUST the header line.

Any ideas?


Production - 7.6.4
Sandbox - 7.6.4
October 23, 2008, 05:58 PM
GinnyJakes
Use Dialogue Manager and -WRITE the file.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
October 23, 2008, 08:02 PM
Waz
The other question here is why do you need a single line tab delimited file ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

October 24, 2008, 02:42 AM
<JG>
1st TABT will always generate at least 2 rows, A header row and a data row.

Use FORMAT TAB not TABT

2nd -WRITE Will not write tabs it replaces them with a space (the parser strips tabs from code)

3rd DEFINE and COMPUTE will not create a field containing tabs for the same reason as in 2 above.

use tab and create each component seperately

TABLE FILE CAR
SUM
COMPUTE A/A50 WITH CAR= 'A';
COMPUTE B/A50 WITH CAR= 'B';
COMPUTE C/A50 WITH CAR= 'C';
COMPUTE D/A50 WITH CAR= 'D';
BY CAR NOPRINT
WHERE RECORDLIMIT EQ 1
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD FORMAT TAB
END
October 24, 2008, 08:49 AM
ColdWhiteMilk
One of my projects requires me to send two files to my customer, the data and a trigger.

The first file, the data is the detailed results of the query.

The second file, the trigger, is a single line text file with the name of the first file as that single line.

The customer's automation looks for the existence of that trigger file to know when/what to process.


Production - 7.6.4
Sandbox - 7.6.4
October 24, 2008, 10:19 AM
jfr99
Here's an example using the CAR file that creates an extract file and a trigger file.

-*---------------------------------------------------------------------------
-SET &DATA_FILE = 'tst_car_extract.txt';
-SET &TRIG_FILE = 'tst_car_trigger.txt';
-*
-TYPE DATA_FILE ---------- &DATA_FILE
-TYPE TRIG_FILE ---------- &TRIG_FILE
-*
FILEDEF OUT_DATA DISK &DATA_FILE
FILEDEF OUT_TRIG DISK &TRIG_FILE
-RUN
-TYPE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-TYPE +++ CREATE EXTRACT FILE +++
-TYPE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
TABLE FILE CAR
PRINT CAR
BY COUNTRY
ON TABLE HOLD AS OUT_DATA FORMAT ALPHA
END
-RUN
-TYPE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-TYPE +++ CREATE TRIGGER FILE +++
-TYPE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-WRITE OUT_TRIG &TRIG_FILE
-RUN
-*----------------------------------------------------------------------------

Jim


WebFocus 8.201M, Windows, App Studio
October 24, 2008, 10:38 AM
GinnyJakes
quote:
-WRITE OUT_TRIG &TRIG_FILE


Isn't that what I said to do several posts ago?


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
October 26, 2008, 04:49 PM
Waz
If you want to table and hold a single line without the CR, then HOLD it.

If you have a single column, its irrelevant what the format is.

If you have multiple columns, try this below.

DEFINE FILE CAR
 Tab/A1 = HEXBYT(9,'A1') ;
END
TABLE FILE CAR
PRINT COUNTRY Tab CAR
ON TABLE HOLD AS NOCR
WHERE RECORDLIMIT EQ 1
END


A HOLD pads the columns out to multiples of 4 bytes, if this is unacceptible, then use ON TABLE HOLD FORMAT INTERNAL.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

October 30, 2008, 03:53 PM
ColdWhiteMilk
Thank you all for your help. I've gotten the solution that I needed!

-CWM


Production - 7.6.4
Sandbox - 7.6.4
October 30, 2008, 03:59 PM
Darin Lee
Could you please let us know what your solution was so that it may be of benefit to others in the future? Thanks.


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
October 30, 2008, 04:52 PM
ColdWhiteMilk
  
DEFINE FILE CAR
TRIGRNAME/A50= '';
END

TABLE FILE CAR
SUM
TRIGRNAME AS 'ABCD'

WHERE RECORDLIMIT EQ 0

ON TABLE PCHOLD FORMAT TABT
END



Production - 7.6.4
Sandbox - 7.6.4