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     user subroutine confusion

Read-Only Read-Only Topic
Go
Search
Notify
Tools
user subroutine confusion
 Login/Join
 
Silver Member
posted
Hi:

After reading and searching help files and tech docs I'm still really confused about writing and installing user subroutines. How I would expect this to work:

-Write a library and compile as a .dll or .so with my favorite compiler.

-Drop the .dll or .so into some directory so that it's accessible.

After looking at the docs, I don't know if you can have more than one function in a library, the purpose of gencpcm, or what languages can be used. The help docs say you can use any language supporting subroutines but the gencpcm batch file contains a note that visual C needs to be on the path for compiling. If I write a subroutine in language 'X' how is it supposed to get compiled and be put somewhere usable?

If anyone can shed some light on this I'd appreciate it!
 
Posts: 38 | Registered: October 10, 2006Report This Post
Expert
posted Hide Post
Jud, probably what you're looking for is DEFINE FUNCTION somename; Its an easy way of writing your own routine to standardize some business definition or rule ;
Defining functions and putting them in the edasprof to make them available to all your users.
Lemme give you an example from my edasprof:

-* 
DEFINE FUNCTION F_DATE(SQLDATE/HYYMDs)
tempd3/A20       = HCNVRT(SQLDATE, '(H17)', 17, 'A20');
tempd4/A8YYMD    = EDIT(tempd3, '99999999$$$$$$$$$$$$');
F_DATE/YYMD      = tempd4 ;
END

then to use it in a regular fex:
DEFINE FILE ...
DateCreate/YYMD=F_DATE(DATE_CREATED);
END

where DATE_CREATED is a date-time thing;
By making an easy-to-remember function, my users can do it w/o remembering complex syntax.
Note, Tony likes to start all functions with F_ .. so, i adopted that standard.
note, the function name and the name of the ending variable in the function must be the same.
Here's another one i liked, with 2 arguments:
-* rounds numbers to multiples of 
DEFINE FUNCTION F_MROUND(INPUT/D11.2,TUPLES/I2)
temp/P11       = INPUT/TUPLES ;
F_MROUND/D11.2 = temp*TUPLES; 
END

You don't have to put functions in your edasprof; you can just write them at the top of some monster fex and use them only in that fex.
But making them more global leads to a fine topical t-shirt slogan:
"whats in your edasprof?"

Giving you some ideas , now? come back and tell us. Oh, yeah...and update your profile's signature block with your system details ...

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




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
Silver Member
posted Hide Post
Susannah:

Thank you for the reply. Yes, user defined functions are slick - I discovered those a while ago on the forum.

I'm actually trying to figure out how to create a binary subroutine as described in the Using Functions help file in the appendix 'Creating a Subroutine'. The help doc says, re: compiling and storing a subroutine:

'Run the program gencpcm, which creates a .dll file...'

Gencpcm has that comment about a 'c' compiler being needed. But, the docs also say you can use any language you want. If you write a fortran subroutine, how is gencpcm going to compile it?

Thanks again for the help. Re: my profile, I'm using a variety of versions of WF on a variety of platforms.
 
Posts: 38 | Registered: October 10, 2006Report This Post
Expert
posted Hide Post
I think the doc is wrong. You have to use the compiler for the language you are writing in. Assuming you did all the other Fortran stuff correctly and all the other stuff in Appendix A of the Functions manual, I would assume that your routing should work.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Silver Member
posted Hide Post
Thanks Ginny:

A problem is that App. A isn't very explicit. If I create a library and compile to a .dll, then put it in the directory specified by IBICPG (as the doc specifies), how is webfocus going to know that MyFunction is in MyDLL? Maybe gencpcm does something to solve this problem but then you hit the compilation issue.
 
Posts: 38 | Registered: October 10, 2006Report This Post
Expert
posted Hide Post
Try opening a case and checking with IBI.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Master
posted Hide Post
I am guessing that you are taking advantage of an existing fortran subroutine.

Again a guess is that the external subroutines may only support C. In that case you will have to write a wrapper in C that calls the fortran.

From what I remember this means you have to know the calling conventions of fortran (pass by reference so use &variable to pass address from C) and link edit record which used to be first 6 letters of subroutine name capitalized.

eg Approximately

SUB UPCASCUSTOM ( INTEGER*4 LENGTH , CHARACTER*256 INSTR, CHARACTER*256 OUTSTR)

would be called in C
long length ;
char[256] instr ;
char[256] outstr ;
UPCASC(&length, instr, outstr) ;



You might be able to get a freeware C compiler to produce the wrapper.

Have fun!

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



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
 
Posts: 888 | Location: Airstrip One | Registered: October 06, 2006Report This Post
Virtuoso
posted Hide Post
If you look into this gencpgm.bat file (and it is called gen'c'pgm for a reason) you'll see that this is only usable for c or c++ programs.
And, if you invoke the file with 'gencpgm.bat -help' it tells you at the end of the help text:
Other languages and compiler vendors should work provided they follow
Microsoft standards for passing parameters by reference, but they are
specifically not supported by this script and are up to the user to
create a proper environment for compilation and linking.
So, if you do have a subroutine in another language than C or C++ you might be able to modify this gencpgm program to compile subs in this other language...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 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     user subroutine confusion

Copyright © 1996-2020 Information Builders