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     [SOLVED] Packed decimal to Numeric or Alphanumeric..

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Packed decimal to Numeric or Alphanumeric..
 Login/Join
 
Member
posted
Hi,

I get errors using Focus 7.6.9.
I have a file which has fields X and Y
X-- usage P13.2 actual P06
Y-- Usage P13.2 actual P06

In a FOCUS module i read these fields as Read value &X.p13.2 and &Y.p13.2

A/p13.2=&X
B/p13.2=&Y

Now the error says this
"Unrecognised format of amper variable in -read"

Could anyone provide me a solution on this..
Thanks in advance..
Smiler

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


7.6.9 for generating reports
Windows
All Outputs
 
Posts: 4 | Registered: November 25, 2009Report This Post
Virtuoso
posted Hide Post
Perhaps this sample will help:

DEFINE FILE CAR
 P_RETAIL_COST/P13.2 = RETAIL_COST ;
END
 
TABLEF FILE CAR
 PRINT COUNTRY CAR MODEL P_RETAIL_COST
 WHERE RECORDLIMIT EQ 1
 ON TABLE SAVE AS CARSAVE
END
-RUN

 ALPHANUMERIC RECORD NAMED  CARSAVE
 0 FIELDNAME                         ALIAS         FORMAT        LENGTH
 COUNTRY                           COUNTRY       A10            10
 CAR                               CARS          A16            16
 MODEL                             MODEL         A24            24
 P_RETAIL_COST                                   P13.2          13
 TOTAL                                                          63
 1
 0 NUMBER OF RECORDS IN TABLE=        1  LINES=      1
 0

-READ CARSAVE &COUNTRY.10 &CAR.16 &MODEL.24 &PRCOST.13
-TYPE COUNTRY=&COUNTRY CAR=&CAR MODEL=&MODEL COST=&PRCOST

COUNTRY=ENGLAND    CAR=JAGUAR           MODEL=V12XKE AUTO              COST=      8878.00


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Member
posted Hide Post
quote:
13

Can we read Packed decimal and convert it to numeric..
As the packed decimal is amount which shud be numeric..
but the declaration done is in packed decimal i.e p13.2 which is not readable.
Hence is there a way where we can read PD and convert it in to numeric or alphanumeric..
I tried an option by changing file format from P13.2 to A14 and read as Read value &X.A14
but it did not work..


7.6.9 for generating reports
Windows
All Outputs
 
Posts: 4 | Registered: November 25, 2009Report This Post
Virtuoso
posted Hide Post
&variables are either numeric or alpha. The format of P13.2 is not a valid format for reading into a variable. Dan's example above should give you what you need. If nothing else, you can read it as an alpha string and use EDIT to convert to a (decimal) number.


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
Guru
posted Hide Post
It took me awhile to figure out what went wrong with the packed decimal conversions.

In DB2, when a field defined as P13.2; the equivalent field in wf .mas is P14.2.

PTOA(myfield,'(P14.2)','A14') or EDIT(myfield,'$9999999999999') should work.

It was my mistake to assume wf field length P13.2


Developer Studio 7.6.11
AS400 - V5R4
HTML,PDF,XLS
 
Posts: 305 | Location: Winnipeg,MB | Registered: May 12, 2008Report This Post
Expert
posted Hide Post
At the risk of overstating the basics:
&vars are either alpha or numeric, period end of story.
but a numeric can contain decimals. that nifty little improvement came along several releases ago. you can't apply a format to an &var...
So, eg, you can read an exchange rate from some source somewhere and have it exist as an &var with decimal postions
-SET &EXRATE = 1.6904 ;
so that in your fex
DEFINE
DOLLARS/D12.2= STERLING * &EXRATE ;




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Member
posted Hide Post
Thanks all for valuable replies.
I can use PTOA or edit the fields read.
but the problem occurs when i try reading it.
i.e Read value &X.p13.2
It says not a proper read.
Then i changed it to Read value &X.A14
After changing when i move the fields it throws an error.
A/A14 = edit(X,'$9999999999999').

Any inputs pls???


7.6.9 for generating reports
Windows
All Outputs
 
Posts: 4 | Registered: November 25, 2009Report This Post
Expert
posted Hide Post
I'd refer you back to Dan's post above.

Look carefully at how he has coded his -READ statement.

Also check out the documnetation on -READ to see where you are going wrong.

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
Hi All,

Thanks for your replies and suggestions.
I got the solution for the above.
It wasnt possible without your inputs.
I read the fields by Alphanumeric and used the same fields for further condition check, rather copying it to local variables.
Thanks again.


7.6.9 for generating reports
Windows
All Outputs
 
Posts: 4 | Registered: November 25, 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     [SOLVED] Packed decimal to Numeric or Alphanumeric..

Copyright © 1996-2020 Information Builders