Focal Point
[SOLVED] Creating Delimited file removes leading blanks

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

December 28, 2010, 02:38 PM
RSA
[SOLVED] Creating Delimited file removes leading blanks
I need to create a delimited flat file. The POL_NUM column has a character format that contains right justified numeric values. I would like to retain the leading blanks. When I run the following the values in POL_NUM become left justified. Any suggestions other than coding the bar delimiters manually?
Thanks

TABLE FILE POLTEST
SUM
INSD
BY POL_NUM
BY TERM_EFF
ON TABLE HOLD AS Pol_Extract FORMAT DFIX DELIMITER '|'
END

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


WebFOCUS 7.6
Windows, All Outputs
December 28, 2010, 04:03 PM
Waz
Do you also want to keep the trailing blanks ?

Either way, you may have to create the file manually.

DEFINE FILE POLTEST
Pipe/A1 = '|' ;
END
TABLE FILE POLTEST
SUM 
Pipe
INSD
BY POL_NUM
BY Pipe
BY TERM_EFF
ON TABLE SAVE AS Pol_Extract
END


Or create a string by concatenating the values together and write the output to a 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!

December 28, 2010, 05:03 PM
RSA
Thanks, Waz... I figured that would be the answer Smiler


WebFOCUS 7.6
Windows, All Outputs
December 28, 2010, 06:40 PM
Dan Satchell
Have you tried specifying right-justication in the output, either with function RJUST or with dynamic formatting?

TABLE FILE POLTEST
 SUM
  INSD
  COMPUTE POL_NUM_R/A?? = RJUST(??,POL_NUM,'A??');
 BY POL_NUM/R
 BY TERM_EFF
 ON TABLE HOLD AS Pol_Extract FORMAT DFIX DELIMITER '|'
END



WebFOCUS 7.7.05
December 30, 2010, 10:40 AM
<JG>
Are you sure that your source file actually contains a right justified alpha column?

Format DFIX, COM, TAB etc. do not strip leading spaces from alpha columns.

They do strip trailing spaces from alpha columns and leading spaces from numeric’s.

If it is stripping leading spaces from alpha columns then either the column is not right justified or
It’s a bug in the version of WF you are running.


 
FILEDEF HOLDA DISK c:\TEMP\HOLDA.ftm
-RUN
DEFINE  FILE CAR
COUNTRYA/A25= '     '| COUNTRY;
CARA/A30=RJUST(16,CAR,'A30');
NUMBER/A9= '    12345';
END
TABLE FILE CAR
PRINT  COUNTRYA CARA NUMBER 
ON TABLE HOLD AS DATA
END
-RUN
TABLE FILE DATA
PRINT *
ON TABLE HOLD AS HOLDA FORMAT DFIX DELIMITER '|'
END
-RUN 

generates

     ENGLAND|          JAGUAR|    12345
     ENGLAND|          JENSEN|    12345
     ENGLAND|         TRIUMPH|    12345
     JAPAN|          DATSUN|    12345
     JAPAN|          TOYOTA|    12345
     ITALY|      ALFA ROMEO|    12345
     ITALY|        MASERATI|    12345
     W GERMANY|            AUDI|    12345
     W GERMANY|             BMW|    12345
     FRANCE|         PEUGEOT|    12345