Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [OPEN] How To Force End Of Line at Specific Position
Go
New
Search
Notify
Tools
Reply
  
[OPEN] How To Force End Of Line at Specific Position
 Login/Join
 
Member
posted
Hi Focal Point

We are trying to generate a flat text file with every record ending at a specific position. The problem is the end of line is being truncated because the last 3 fields are blank. We cannot alter the data. I tried inserting blank spaces but they are ignored. What can we do?


WF 8.1.03
Windows 7 64 bit
 
Posts: 5 | Location: New York,New York | Registered: May 08, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
How are you creating the text file ?

Whats the code ?


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!

 
Posts: 6278 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Reply With QuoteReport This Post
Master
posted Hide Post
Not much to go on, so I'll just throw something out there as a starting point.

I used the CAR file and tried to simulate missing car model information for the country of Japan using a DEFINE field. Then a second DEFINE field tests the first one to see if the model is missing. If it is, then it uses spaces for the model; otherwise, it just uses whatever model information is there.

Of course, the actual data source needs to flag empty fields as MISSING before something like this could work.

DEFINE FILE CAR ADD
THE_MODEL/A24 MISSING ON NEEDS SOME DATA=IF CAR.ORIGIN.COUNTRY EQ 'JAPAN' THEN MISSING ELSE CAR.CARREC.MODEL;
BLANK_MODEL/A24=IF THE_MODEL IS MISSING THEN '                        ' ELSE THE_MODEL;
END

TABLE FILE CAR
PRINT 
     CAR.ORIGIN.COUNTRY
     CAR.COMP.CAR
     CAR.CARREC.BLANK_MODEL
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT ALPHA
ON TABLE SET HTMLCSS ON
END


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Reply With QuoteReport This Post
Master
posted Hide Post
I just had to deal with this. I needed a blank character at the end and it refused to leave it there for me. Here's the solution I eventually came up with. Note -- I'm printing the entire line of data in fixed columns (with commas between for some reason) via a single field that concatenates everything.


DEFINE FILE NIC_DATA
  FULL_DATA_LINE/A100 = PARKING_STREET_A30 | ',' | PARKING_CITY_A20 | ',' | PARKING_COUNTY_A3 | ',' | PARKING_ZIP_A5 | ',' | PARKING_ZIP_4_A4 | ',' | MAKE_NAME_A4 | ',' | MODEL_YEAR_A4 | ',' | TX_VIN_A19 | ',' | FUEL_CATEGORY_A2;
  EMPTY_SPACE/A1 MISSING ON = MISSING;
END

TABLE FILE NIC_DATA
BY PARKING_ZIP NOPRINT
BY FULL_DATA_LINE
BY EMPTY_SPACE
(blah blah blah)
ON TABLE HOLD AS XYZ FORMAT DFIX DELIMITER ' ' HEADER NO
END



Be sure to note the delimiter value of ' ' in the hold line at the end -- that's my blank space -- that blank space is placed between the FULL_DATA_LINE field and the EMPTY_SPACE field. That's my single blank character that I didn't want to lose. The FULL_DATA_LINE field produces the entire line of actual data, the delimiter creates the single blank space that my spec called for at the end, the EMPTY_SPACE field makes sure the blank space isn't lost. Without the EMPTY SPACE field the report did me the (ahem) "courtesy" of removing the blank space I explicitly included in my data string. Just wouldn't leave it alone.

I would presume you'd want a delimiter three spaces long.



 
Posts: 979 | Location: At the Mast | Registered: May 17, 2007Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Seems to me I did this once and added a CR/LF in hex at the end of the line after the space. However, I have no proof or code to give you.


WebFOCUS 7.7.05 (Someday 8)
Windows 7, All Outputs
In Focus since 1983.
 
Posts: 103 | Registered: April 27, 2011Reply With QuoteReport This Post
Expert
posted Hide Post
Another way you can do this, if you are creating your own formatting, is to use PUTDDREC.

See http://forums.informationbuild...=830106344#830106344


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!

 
Posts: 6278 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Reply With QuoteReport This Post
Expert
posted Hide Post
also,we know that HEXBYT(32,'A1') is a blank space, but it seems to get ignored in many situations as you said, Pak.
However there is one that doesn't get ignored, in the extended ascii character set, HEXBYT(255,'A1');
for example,
in an xml dropdown list, we use these HEXBYT characters to indent some of the display entries.
works great.
whereas using nbsp or HEXBYT(32 doesn't work at all.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [OPEN] How To Force End Of Line at Specific Position

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.