IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

call external function and number of variables is not fixed


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
henry888

New User


Joined: 21 Sep 2009
Posts: 51
Location: china

PostPosted: Wed May 12, 2010 12:44 pm
Reply with quote

I have to implement a fucntion that the PLI main program will call the external function and pass parameters to the function.

The problem is that is number of parameters is not fixed,as required it can be 1 or 2 or 3 or 4.....and the sub program will do the different process according to number of the parameters,any good way to deal with such situation?Please guide me...
Back to top
View user's profile Send private message
donateeye
Warnings : 2

New User


Joined: 01 Jun 2007
Posts: 62
Location: chennai

PostPosted: Wed May 12, 2010 12:49 pm
Reply with quote

Declare the function procedure as GENERIC :

DCL function-procname GENERIC ( procname_1 WHEN ( parm_descriptor_1 ) , procname_2 WHEN ( parm_descriptor_2 ) );

this way, you can just use one function reference name but invoke different procedures depending on the parm that you pass on.

Any.... please correct me if I am wrong....
Back to top
View user's profile Send private message
henry888

New User


Joined: 21 Sep 2009
Posts: 51
Location: china

PostPosted: Wed May 12, 2010 1:01 pm
Reply with quote

Hi donateeye,
thanks for your so quick reply,actually logic processing in the function procedure is the same,the requirement is like:
in main program it will pass the table name,and different columns,the number of columns is different as I mentioned above,maybe 1 or 2 or 3......and then the subprogram will form a SQL select statement according to the parameters received from main program....
Back to top
View user's profile Send private message
henry888

New User


Joined: 21 Sep 2009
Posts: 51
Location: china

PostPosted: Wed May 12, 2010 7:59 pm
Reply with quote

anyone has the idea?and in additoin the parameter type(column type) is different,e.g:
the 1st call the subprogam it may have two parameters and the types are char and decimal,the 2nd time call the subprogram it may have five parameters and the types are char,decimal,decimal,char,char,decimal,and so on...

so how to manage it in both main and sub program?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu May 13, 2010 6:33 am
Reply with quote

Hello,

Go back and create a different approach. . .

It is most difficult to implement when the rules say "i don'tknow how much i have to handle and i don't know what it will look like". . .

Until some rules can be established, it will most difficult. . .

What business requirement exists that provides no specifics?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Calling an Open C library function in... CICS 1
Search our Forums:

Back to Top