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     convert alpha A12 to D12C with negatives

Read-Only Read-Only Topic
Go
Search
Notify
Tools
convert alpha A12 to D12C with negatives
 Login/Join
 
Silver Member
posted
Hi,
I'm trying to convert an alpha extract into a focus table and I cant get past the negative values that have minus signs. All data is padded with zeroes.

data:
000000000000
000000005687
00000000-844

-IF (MKT CONTAINS '-' THEN GOTO SKMKT ELSE GOTO NOMINUS;

-NOMINUS
MKT2/A12 = STRIP(12,MKT,'-','A12');
MKT4/A12=RJUST(12, MKT2, MKT4);
MKT3/D12C=(ATODBL(MKT4,'12','D12C'));
-GOTO SKMK2
-SKMKT

MKT2/A12 = STRIP(12,MKT,'-','A12');
MKT4/A12=RJUST(12, MKT2, MKT4);
MKT3/D12C=(-1* ATODBL(MKT4,'12','D12C'));
-SKMK2

Maybe there is a better way to do it? For some reason the code does not recognize that there is a minus sign in the CONTAINS statement; I tried it by cutting the minus out of each character with an EDIT and it still did not work?

Thanks,


8105 Tomcat and AIX reporting server
input: Teradata, SQL, DB2, Essbase, Oracle, text
output:html, excel, PDF,
 
Posts: 35 | Location: DFW Texas | Registered: May 30, 2008Report This Post
Virtuoso
posted Hide Post
You're mixing dialog manager directives (-IF) and FOCUS code (DEFINE):

Your -IF is in fact testing whether the static string "MKT" contains "-" (which it does not) and therefore skipping the code to handle negatives. The generated code is then used to process each data record.

What you need is a series of definitions (all of them to be evaluated in turn for each incoming record) that lead to a final result that selects one of two computed values, depending on the presence or absence of "-" in each respective record:

MKT2/A12 = STRIP(12,MKT,'-','A12'); 
MKT4/A12 = RJUST(12, MKT2, MKT4); 
MKT3/D12 =
 IF (MKT CONTAINS '-') 
  THEN     -ATODBL(MKT4,'12','D12')
  ELSE      ATODBL(MKT ,'12','D12');


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Master
posted Hide Post
Try this code in a table

  
COMPUTE POS/D12 = POSIT(MKT, 12, '-', 1, POS);
COMPUTE TMP/A12 = IF POS GT 0 THEN OVRLAY(MKT, 12, '0', 1, POS, TMP) ELSE MKT;
COMPUTE NEWMKT/D12C = IF POS GT 0 THEN EDIT(TMP) * ( -1 ) ELSE EDIT(TMP);


Hope it helps




Scott

 
Posts: 865 | Registered: May 24, 2004Report This Post
Silver Member
posted Hide Post
Thank you both, its working now


8105 Tomcat and AIX reporting server
input: Teradata, SQL, DB2, Essbase, Oracle, text
output:html, excel, PDF,
 
Posts: 35 | Location: DFW Texas | Registered: May 30, 2008Report 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     convert alpha A12 to D12C with negatives

Copyright © 1996-2020 Information Builders