Focal Point
[CLOSED] Removing Leading/Trailing Spaces

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

July 08, 2015, 10:52 PM
texgator
[CLOSED] Removing Leading/Trailing Spaces
Here are some sample source fields and their format

FIELD1 - A15
FIELD2 - P12.4
FIELD3 - HMDYYS
FIELD4 - A35

I need to output these fields into a pipe delimited ASCII file so the output looks as follows. It is important not to have any leading or trailing spaces. I am struggling to eliminate the trailing spaces. Any suggestions?

FIELD1|FIELD2|FIELD3|FIELD4

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 7.6.10
Windows
all output (Excel, HTML, PDF)
July 09, 2015, 02:03 AM
Rifaz
 DEFINE FILE CAR
FIELD1/A15 = 'Test Alpha';
FIELD2/P12.4 = 1234.5678;
FIELD3/HMDYYS ='2015/01/23 04:34:00.000000';
FIELD4/A35 = 'Test Alpha';
END
TABLE FILE CAR
PRINT FIELD1 FIELD2 FIELD3 FIELD4
BY COUNTRY NOPRINT
ON TABLE PCHOLD FORMAT DFIX DELIMITER |
END 


Any problem with this?


-Rifaz

WebFOCUS 7.7.x and 8.x
July 09, 2015, 03:17 AM
Danny-SRL
Good One


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

July 09, 2015, 05:52 PM
texgator
Rifaz - Thanks much for the tip! There is a slight issue though - this doesn't seem to work with the ON TABLE SAVE command if I do
ON TABLE SAVE FILENAME '\\srvstorage\FILENAME.DAT' FORMAT DFIX DELIMITER |

Is there another way to save this file. Its important that the file name stays in upper case.


WebFOCUS 7.6.10
Windows
all output (Excel, HTML, PDF)
July 10, 2015, 01:54 AM
Rifaz
quote:
ON TABLE SAVE FILENAME '\\srvstorage\FILENAME.DAT' FORMAT DFIX DELIMITER |


I never used FILENAME keyword. So, the problem now is to save the filename in uppercase. Hope this helps.

-SET &_FILENAME=UPCASE(17, 'DELIMITERFILE.DAT', 'A17');
DEFINE FILE CAR
FIELD1/A15 = 'Test Alpha';
FIELD2/P12.4 = 1234.5678;
FIELD3/HMDYYS ='2015/01/23 04:34:00.000000';
FIELD4/A35 = 'Test Alpha';
END
FILEDEF UPPER DISK baseapp/&_FILENAME
-RUN
TABLE FILE CAR
PRINT FIELD1 FIELD2 FIELD3 FIELD4
BY COUNTRY NOPRINT
ON TABLE SAVE AS UPPER FORMAT DFIX DELIMITER |
END 



-Rifaz

WebFOCUS 7.7.x and 8.x
July 13, 2015, 06:02 PM
texgator
Hi Rifaz,
Thanks so much for further input. However, it seems that DFIX only works with PCHOLD or HOLD format. So now I am doing APP HOLD and then TABLE HOLD - however, it always saves the file in lower case when I want upper case (I am trying to use -WINNT command to change filename to uppercase). If you have any smarter way to create an upper case file, please let me know. Also, if you could provide input for this case - would greatly appreciate it. Much thanks!
http://forums.informationbuild...1057331/m/1117032776


WebFOCUS 7.6.10
Windows
all output (Excel, HTML, PDF)
July 14, 2015, 02:26 AM
Rifaz
Please post your complete code. Sorry, have no idea on other post, however, just a thought & hope you'd have SET HOLDLIST=PRINTONLY in your fex.


-Rifaz

WebFOCUS 7.7.x and 8.x
July 14, 2015, 10:00 AM
Francis Mariani
FILEDEF HFILE1 DISK BASEAPP/HFILE.TXT
-RUN

DEFINE FILE CAR
FIELD1/A15 = 'Test Alpha';
FIELD2/P12.4 = 1234.5678;
FIELD3/HMDYYS ='2015/01/23 04:34:00.000000';
FIELD4/A35 = 'Test Alpha';
END
TABLE FILE CAR
PRINT FIELD1 FIELD2 FIELD3 FIELD4
BY COUNTRY NOPRINT
ON TABLE HOLD AS HFILE1 FORMAT DFIX DELIMITER |
END
 



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