Focal Point Banner


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.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Remove Trailing Spaces from data in HOLD/SAVE file

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Remove Trailing Spaces from data in HOLD/SAVE file
 Login/Join
 
Expert
posted
I'd like to create a HOLD or SAVE file where the data rows do not have any trailing spaces.

I've tried SQUEEZ and TRIMV but neither do the trick - the HOLD file is filled with trailing spaces.

Any ideas?

SET HOLDFORMAT = ALPHA
SET ASNAMES = ON
SET HOLDLIST = PRINTONLY

TABLE FILE EQ_DATA1
PRINT
COMPUTE EQ_DATAS/A400 = SQUEEZ(1000, SQL_COMMAND, 'A400'); NOPRINT
COMPUTE EQ_DATAT/A400V = TRIMV('T', EQ_DATAS, 400, ' ', 1, EQ_DATAT);
ON TABLE HOLD AS EQ_DATA
END
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
and you've tried fiddling with the RECFM in the output filedef? making it V for VARiable length records, not F? I'm not suggesting that this will work, tho, Francis, just adding it to the list of tinkerables. and then there's the output csv file.. it's compacted...no trailing spaces on any of the fields...If your output file has only 1 field, maybe try FORMAT COMMA
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Expert
posted Hide Post
FILEDEF EQ_DATA DISK data_20050926.sql RECFM V

I tried RECFM V and get an error - it seems that is not valid syntax.

FORMAT COMMA did not do it - in fact it put quotes around the data.

I have a feeling this is not possible - I don't think there's a variable format hold file.
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
Try casting it to AnV format, and trimming the length.
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Expert
posted Hide Post
as i recall, parms to a filedef are preceeded by a left paren
FILEDEF mastername DISK D:\IBI\...\filename.txt (RECFM V LRECL 80
totally inelegant, but works:
FILEDEF TRYTHAT DISK D:\IBI\APPS\AS400\TRYTHAT.FTM (RECFM V
TABLE FILE somesourcefile
PRINT field ON TABLE HOLD AS TRYTHIS FORMAT ALPHA
END
-RUN
-SET &KOUNTER = 0 ;
-TOPLOOP
-READ TRYTHIS &NAME1.A26
-SET &KOUNTER = &KOUNTER + 1 ;
-SET &NAME2 = TRIM('T', &NAME1, 26 , ' ' , 1 , A26 );
-WRITE TRYTHAT &NAME1
-IF &KOUNTER EQ 10 GOTO ENDLOOP ;
-GOTO TOPLOOP;
-ENDLOOP
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Silver Member
posted Hide Post
Francis,

I came across the following link on the techsupport site.

http://techsupport.informationbuilders.com/ibase/master...eports20.htm#1037814

I tried the
ON TABLE HOLD AS HOLDCAR FORMAT COMT and it looks like it works.

M
 
Posts: 33 | Location: New York, USA | Registered: August 11, 2003Report This Post
Platinum Member
posted Hide Post
FORMAT COM should remove leading zeros on numerics and trailing blanks on alphanumerics but does put alphanumeric fields in quotes.

What about holding it in COM format then tabling that and holding/saving as FORMAT ALPHA?

I have no idea if this will work but it might be worth a try. Good luck.
 
Posts: 118 | Location: DC | Registered: May 13, 2005Report This Post
Expert
posted Hide Post
COM and COMT don't truncate the field width.
They look like they do, but then when you open the file in textpad, you'll see that the field is still the same width.
i thought they did, too.
but , alas. t'was wishful coding.
Triming the field in dialog manager and -WRITEing it does works, when you open the file in textpad, each record is only as long as it needs to be. But what an inelegant solution! As much help as Francis gives all of us, i wish we could come up with something cooler for him.
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Expert
posted Hide Post
In my particular case, the trailing blanks are harmless, but there should be an elegant way to do this, withour resorting to Dialog Manager.

By the way, when I use an AnV formatted field, the resulting HOLD file has the length of the data as the first six characters of each row, but the data is still not trimmed.

Susannah, thanks for trying, I appreciate the suggestions.
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
Francis -

Did you try TRIMV()?


"If the [output] format is AnV, the length is set equal to the number of characters left after trimming."


(http://techsupport.ibi.com/ibase/masterindex/html/html_iway71/dmfunctions_71/var_chara6.htm)

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


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Expert
posted Hide Post
I assume TRIMV requires an AnV field as output. WHen I try that, the length of the data is prepended to the beginning of the data - this is worse than having the trailing blanks.

TABLE FILE EQ_DATA1
PRINT
COMPUTE EQ_DATAS/A400 = SQUEEZ(1000, SQL_COMMAND, 'A400'); NOPRINT
COMPUTE EQ_DATAT/A400V = TRIMV('T', EQ_DATAS, 400, ' ', 400, EQ_DATAT);
ON TABLE SAVE AS EQ_DATA
END
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Guru
posted Hide Post
Francis,

what about this?

FILEDEF EQ_DATA DISK C:\IBI\APPS\EQ_DATA.FTM
TABLE FILE CAR
PRINT COUNTRY
ON TABLE SAVE AS EQ_DATA FORMAT TAB
END

/H�kan
 
Posts: 319 | Location: Stockholm, Sweden | Registered: February 04, 2004Report This Post
Expert
posted Hide Post
That did it!

Thank you Stockholm!
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
applause!
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Remove Trailing Spaces from data in HOLD/SAVE file

Copyright © 1996-2020 Information Builders