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     [CLOSED] Space Function

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Space Function
 Login/Join
 
Platinum Member
posted
Visual Basic for Applications has a function that I can use to define a string of blank spaces: Spc(232)

Does WebFOCUS?

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


Production - 7.6.4
Sandbox - 7.6.4
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
Virtuoso
posted Hide Post
yeah.
DEFINE FILE CAR
SPACES/A30=' ';
END


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Platinum Member
posted Hide Post
This is only giving me one space character.

Is there a "SET" command that needs to be included to preserve the space padding?

SET ASNAMES = ON

DEFINE FILE MCPD_TBLZREFFORMNAMES
HEADER1/A23 WITH FORMNAME = 'HDRMC01' | DATECVT(&YYMD, 'I8YYMD', 'A8YYMD') | EDIT(HHMMSS('A8'),'99$:99$:99');
SPACES/A232='';
END

TABLE FILE MCPD_TBLZREFFORMNAMES
PRINT
HEADER1 AS ''
SPACES AS ''

WHERE RECORDLIMIT EQ 1

ON TABLE PCHOLD FORMAT TAB
END


Production - 7.6.4
Sandbox - 7.6.4
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
Virtuoso
posted Hide Post
I've created spaces in the past this way.

 SP/A1 = HEXBYT(160, 'A1');
SP02/A2 = SP|SP;
SP05/A05 = SP|SP|SP|SP|SP;
SP10/A10 = SP05|SP05; 


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Platinum Member
posted Hide Post
My concern is that I need to space pad a row from 23 characters to 255 characters, so I'm trying to avoid concactinating so many times so that I get the needed 232 space characters.


Production - 7.6.4
Sandbox - 7.6.4
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
Master
posted Hide Post
I also come from some VB development (ASP/VBScript) and let me save you some trouble. stop trying to make Focus into VB. I've frustrated myself to no end trying to replicate some of the design patterns I used to use. I finally had to drink the Kool Aid and do it the WF way. :-)

That said, I recently had to do this same thing (for creating a fixed length record in a data feed), see below.

DEFINE FILE CAR
	PADDED_COUNTRY_TMP/A60  = '                                                  ' || COUNTRY;
	PADDED_COUNTRY_TMP/A60  = RJUST(60,PADDED_COUNTRY_TMP,PADDED_COUNTRY_TMP);
	PADDED_COUNTRY/A50      = SUBSTR(60, PADDED_COUNTRY_TMP, 11, 60, 50, 'A50');
END

TABLE FILE CAR
PRINT
	PADDED_COUNTRY
	ON TABLE PCHOLD FORMAT ALPHA
END


So the premise is to create a 50 character Country field (original is 30). to do this, I use 30 spaces and append the country field. from there, I right justify it and using a substring, get just the rightmost 50 characters. From a VB background, that's just cumbersome (the SUBSTR function alone is combersome)).

Saving it as an alpha should prompt you to save it on your PC and you can use TextPad or something to count the spaces (the web view will not preserve).

I'm not saying the above is the most efficient way to do it, it's just the mindset I've see in my shop and am trying to fit in...

HTH,
- ABT


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
 
Posts: 561 | Registered: February 03, 2010Report This Post
Virtuoso
posted Hide Post
The output format would make a difference. HTML won't preserve spaces, PDF will, TAB won't. I would try Prarie's or ABT's suggestion.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Expert
posted Hide Post
WebFOCUS Documentation:
 
Reference: FORMAT TAB
Description: 
     Creates an output file in tab-delimited format. The TAB format includes a built-in safety   
feature, which allows embedded quotes within character fields. 

A a second double quote (") is inserted adjacent to the existing one. 

For example, if you input Joe "Smitty" Smith, the output is Joe ""Smitty"" Smith. 
The TAB format also includes the following features: 

    All trailing blanks are stripped from alpha [An] fields. 
    All leading blanks are stripped from numeric [/Dx.y, /Fx.y, /Px.y, and /In] fields. 
    There is a 32K record length limit in the output file. 

A Master File is created when the HOLD command is used to create the output file. 
The Master File behaves exactly as in FORMAT ALPHA, except for the inclusion of double quotes. 

Note: To create a variable-length comma- or tab-delimited HOLD file that differentiates 
between a missing value and a blank string or zero value, 
use the SET NULL=ON command. 

For more information, see the Developing Reporting Applications manual.

Use: For importing data to Windows-based applications such as MS Access and Excel.

Supported with the command: HOLD; SAVE; PCHOLD

Available in: WebFOCUS; Developer Studio; FOCUS. 



SET ASNAMES = ON

DEFINE FILE CAR
SP/A1    = HEXBYT(160, 'A1');
SP02/A2  = SP|SP;
SP05/A05 = SP|SP|SP|SP|SP;
SP10/A10 = SP05|SP05; 
SP20/A20 = SP10|SP10;
XSP1/A230= SP20|SP20|SP20|SP20|SP20|SP20|SP20|SP20|SP20|SP20|SP20|SP05|SP|SP|SP;
HEADER1/A255 WITH COUNTRY = 
'"'| 'HDRMC01' | DATECVT(&YYMD, 'I8YYMD', 'A8YYMD') | EDIT(HHMMSS('A8'),'99$:99$:99') | XSP1 | '"';
END

TABLE FILE CAR
PRINT
HEADER1 AS ''
BY COUNTRY NOPRINT
WHERE RECORDLIMIT EQ 1

ON TABLE PCHOLD FORMAT ALPHA
END
-EXIT


hth

This message has been edited. Last edited by: Tom Flynn,


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Platinum Member
posted Hide Post
Thank you. This is working

  


Production - 7.6.4
Sandbox - 7.6.4
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
Expert
posted Hide Post
... or use WF to do the heavy lifting -
-DEFAULT &SPCLEN = 200
-DEFAULT &SPCS   = ''
-REPEAT SPCLOOP &SPCLEN TIMES;
-SET &SPCS = &SPCS | HEXBYT(160, 'A1');
-SPCLOOP
-RUN
DEFINE FILE CAR
  PAD_COUNTRY/A255 = '&SPCS' | COUNTRY;
END
TABLE FILE CAR
PRINT PAD_COUNTRY
   BY COUNTRY
END
Also note that it is better to use chr$(160) (as per Prarie) rather than chr$(32) for the space character, so don't use a conflicting character set.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Platinum Member
posted Hide Post
Could the same process be used to add blank spaces to the right side of a field to pad the field?


Production - 7.6.4
Sandbox - 7.6.4
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
Virtuoso
posted Hide Post
Best bet for that is the LJUST function. From the manual:

The LJUST function left-justifies a character string within a field. All leading spaces become trailing spaces.

Syntax: How to Left-Justify a Character String
LJUST(length, string, outfield)


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Platinum Member
posted Hide Post
FIELD_ID0/A4= CMB_FIELD_ID;
FIELD_ID1/A34= FIELD_ID0 | '                              '; (THIS IS 30 SPACES)


Both defines give me just the 4 character value from CMB_FIELD_ID with no trailing spaces.


Production - 7.6.4
Sandbox - 7.6.4
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
Expert
posted Hide Post
CWM,

Yes, just change the define around. But you should also be able to just code without space filling -
DEFINE FILE CAR
  PAD_COUNTRY/A255 = COUNTRY | '&SPCS';
  SPC_COUNTRY/A255 = COUNTRY;
END
TABLE FILE CAR
PRINT SPC_COUNTRY
   BY COUNTRY
ON TABLE SAVE AS TEST FORMAT ALPHA
END

SPC_COUNTRY gives me a 255 character wide string, left justified with trailing spaces.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Member
posted Hide Post
How about using

DEFINE FILE CAR
SPACES/A220 = SUBSTR(10,COUNTRY,-1,1,220,'A220');
NEW_COUNTRY/A230 = COUNTRY | SPACES;
END

TABLE FILE CAR
PRINT
NEW_COUNTRY
SPACES
ON TABLE PCHOLD FORMAT ALPHA
END
 
Posts: 29 | Location: Seattle Washington | Registered: July 08, 2009Report 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     [CLOSED] Space Function

Copyright © 1996-2020 Information Builders