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. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at email@example.com and provide your corporate email address, company, and name.
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, 2015
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;
TABLE FILE CAR
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT ALPHA
ON TABLE SET HTMLCSS ON
App Studio WebFOCUS 8.1.05M Windows, All Outputs
Posts: 594 | Location: Michigan | Registered: September 04, 2015
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;
TABLE FILE NIC_DATA
BY PARKING_ZIP NOPRINT
(blah blah blah)
ON TABLE HOLD AS XYZ FORMAT DFIX DELIMITER ' ' HEADER NO
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: 1012 | Location: At the Mast | Registered: May 17, 2007
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, 2003