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     How to check field contents to see whether numeric or not

Read-Only Read-Only Topic
Go
Search
Notify
Tools
How to check field contents to see whether numeric or not
 Login/Join
 
<sandyhart>
posted
Does anyone know if there is some way to check the contents of a field in MVS Focus to see whether the contents are numeric or not?
In COBOL, it would be IF FIELD IS NUMERIC, but I know of no way to accomplish this in Focus.
Can anyone help?
Thanks.
Sandy
 
Report This Post
Guru
posted Hide Post
I don't run MVS Focus but here is some code I use to check amper variables in DM.
-SET &TST1 = 'HI';
-SET &TST2 = 1;
-SET &VAL1 = IF &TST1.TYPE EQ 'A' THEN 'TEXT' ELSE 'NUM';
-SET &VAL2 = IF &TST2.TYPE EQ 'A' THEN 'TEXT' ELSE 'NUM';

The .TYPE is what knows if the value is text or numerical.

I hope this helps.
 
Posts: 406 | Location: Canada | Registered: May 31, 2004Report This Post
<sandyhart>
posted
Curtis, thank you so much for your tip.
Please forgive my dumb questions, but I am beginner Focus programmer.

Will your code example work for a field that is more than one digit? For example, if a field were supposed to have a valid numeric date in it, could your example check to see if it was numeric or not?
Thank you again.
 
Report This Post
Guru
posted Hide Post
The size of the number does not matter as long as its all numerical. In this example &TST1 is a number and &TST2 is text.

What is the format of the date you are comparing?

-SET &TST1 = 20040721;
-SET &TST2 = '2004-07-21';
-SET &VAL1 = IF &TST1.TYPE EQ 'A' THEN 'TEXT' ELSE 'NUM';
-SET &VAL2 = IF &TST2.TYPE EQ 'A' THEN 'TEXT' ELSE 'NUM';
-TYPE &TST1 &VAL1
-TYPE &TST2 &VAL2
 
Posts: 406 | Location: Canada | Registered: May 31, 2004Report This Post
Expert
posted Hide Post
For a 'beginner', as you describe yourself, you ask really good questions.
If your incoming field is a date as you suggest, or is supposed to be a date,
if you convert it to a SmartDate (a focus term here), focus will brilliantly NOT transform anything that isn't a date.
For example, in my legacy databases I have a date field in alpha '20040231';
When i translate that to a SmartDate, it will translate as 0, because of course there IS NO 31st of February. This is a very handy thing, i can produce an exception report, for example, from my legacy db, to tell the data entry folks what they have to fix;
So if your question really is about dates, read the chapters in the manual about SmartDates and you'll be a happy camper. Otherwise check out Chapter 11 in the manual "using functions" ;
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Gold member
posted Hide Post
Hi,
Could you please tell me how can find the Usage type of a field in the table.
Because in my reports all the parameters will be passed as string.
Like as follows
-set &parm1 = 'where country_id eq ''12''';
Actually in my table the country id is a numeric field.so it is throwing error if I include the above parameter in the WHERE section.
Following is the error i am getting
"COMPARISON BETWEEN COMPUTATIONAL AND ALPHA VALUES IS NOT ALLOWED"
My table request looks as follows.

TABLE FILE COUNTRY
PRINT *
&PARM1
END

And the &Parm will be dynamic and it can be of any data type sometime i may use country_name as parm1.
Can anyone of you help me how to figure out columns usage type before comparing it.
 
Posts: 71 | Registered: November 20, 2003Report This Post
Master
posted Hide Post
Check out the User-Written Subroutine Manual it has a subroutine called CHKFMT. I think that my be what you want.
 
Posts: 865 | Registered: May 24, 2004Report 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     How to check field contents to see whether numeric or not

Copyright © 1996-2020 Information Builders