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     EDIT on packed decimal

Read-Only Read-Only Topic
Go
Search
Notify
Tools
EDIT on packed decimal
 Login/Join
 
Guru
posted
Hi guys,

I'm tryning to modify a field but I'm stuck. The field is a P15 and is a combined field. The first 12 positions is a field and the last 3 position. The problem is that the last field is not always 3 positions. For example 111111111111222 can be a value, but also 11111111112 can be a value.

I would like to separate the field with EDIT(FIELD, '99999999999$$$') but this gives incorrect data. It probably has something to do with the field properties (Alfa). Does anybody has suggestions to use EDIT on a P field?


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
 
Posts: 454 | Location: Europe | Registered: February 05, 2007Report This Post
Virtuoso
posted Hide Post
Fran,

Do a search on the Forum. There many threads on this topic.


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Virtuoso
posted Hide Post
You might look into the UFMT routine. We used it in the mainframe FOCUS days, unfortuneately it does not work when pulling data down to an ASCII based machine and then trying to do so. Of course you might be able to do defines in the MFD. We finally had to have a DB2 view set up to solve our problem in getting packed dates extracted from a DB2 column. Part of the Y2K conversion that occurred on our student system.


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Virtuoso
posted Hide Post
Frans, try to convert the P field to Alpha first using the PTOA function.

A_FIELD/A15 = EDIT(PTOA(PFIELD,'(P15)','A15'),'999999999999');


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Platinum Member
posted Hide Post
This example might help:

-* Convert P format to A format if necessary
-* -SET &BIGNUM = PTOA(&PBIGNUM, '(P15)', 'A15');

-* Number to parse
-SET &BIGNUM = '1234567890123';

-* Get the length of the number
-SET &LBIGNUM = &BIGNUM.LENGTH;

-* Store the first 12 characters in &MYFIELD
-SET &MYFIELD = SUBSTR(&LBIGNUM, &BIGNUM, 1, 12, 12, 'A12');

-* Get the length of the position
-SET &LMYPOS = &LBIGNUM - 12;

-* Get the starting index of position in the entire number
-SET &MYPOSIDX = &LBIGNUM - &LMYPOS + 1;

-* Get the position value
-SET &MYPOS = SUBSTR(&LBIGNUM, &BIGNUM, &MYPOSIDX, &LBIGNUM, &LMYPOS, 'A&LMYPOS.EVAL');

-TYPE field    (&MYFIELD)
-TYPE position (&MYPOS)



Regards,
Sean


------------------------------------------------------------------------
PROD: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
TEST: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
 
Posts: 210 | Location: Ottawa | Registered: November 03, 2005Report This Post
Expert
posted Hide Post
This will get you some of the way there. There is a problem with the data, though - how do you determine what part of the 'combined field' is the 'field' and what part is the 'position'. In 111111111111222, the 'field' is 111111111111 and the 'position' is 222. In 11111111112 (which, since it's numeric can be considered as 000011111111112), the 'field' is 000011111111 or 11111111 and the 'position' is 112 - which I don't think you want.

DEFINE FILE CAR
TEST1/P15 WITH COUNTRY = IF COUNTRY EQ 'ENGLAND' THEN 111111111111222 ELSE 11111111112 ;
TEST1D/D15Lc = TEST1;
TEST1A/A15 = RJUST(15, FTOA(TEST1D, '(D15Lc)', 'A15'), 'A15');
FIELD1/A12 = SUBSTR(15, TEST1A, 1, 12, 12, 'A12');
FIELD2/A03 = SUBSTR(15, TEST1A, 13, 15, 3, 'A03');
END

TABLE FILE CAR
PRINT
TEST1
TEST1A
FIELD1
FIELD2
END


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Guru
posted Hide Post
Hi guys,

Excuse me for my late reply, but I have found a solution. This is the code I used:

quote:
DEFINE FILE SORITACT
TEST1/P15 WITH SLEUTEL=IF SLEUTEL GT 999999999999 THEN 111111111111222 ELSE 11111111112;
TEST1D/D15Lc=SLEUTEL;
TEST1A/A15=RJUST(15, FTOA(TEST1D, '(D15Lc)', 'A15'), 'A15');
FIELD1/A12=SUBSTR(15, TEST1A, 1, 12, 12, 'A12');
FIELD2/A03=SUBSTR(15, TEST1A, 13, 15, 3, 'A03');
FIELD3/D12c=EDIT(FIELD1);
VOLGNR_N/D12=EDIT(FIELD2);
RITNR_N/D12c=IF FIELD3 GT 9999999999 THEN FIELD3 / 10 ELSE IF FIELD3 GT 99999999999 THEN FIELD3 / 100 ELSE FIELD3;
END


So I used most of the code of Francis, but the last 4 digits of the field are always 0000. So the FIELD3 could be 9001362700 with FIELD2 009, and 90013627000 with FIELD2 010. With RITNR_N I resolved this and now all the data is correct! All thanks for the input!


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
 
Posts: 454 | Location: Europe | Registered: February 05, 2007Report 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     EDIT on packed decimal

Copyright © 1996-2020 Information Builders