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.
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, 2007
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
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.
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...
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, 2007
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
hthThis message has been edited. Last edited by: Tom Flynn,
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, 2007
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, 2004
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, 2009