9.11 CALL_SERVER_FUNCTION

Note: Built-In Function Rules     Usage Options

Calls (executes) a LANSA application on the nominated server and waits until it completes execution. The function must be a *DIRECT function.

Arguments

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

SSN of defined server.

1

10

 

 

 

2

A

Req

Name of function to be called.

1

7

 

 

 

3

A

Opt

Pass Exchange List

Y= Pass exchange list.

other = do not pass exchange list.

The default is N.

1

1

 

 

 

4

A

Opt

Return Exchange List

Y= Return exchange list.

other = do not return exchange  list.

The default is N.

1

1

 

 

 

5 - 14

L

Opt

Working Lists 1 through 10 to be passed to the function on the server.

 

 

 

 

 

 

Return Values

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

Return Code.

OK - Call Completed

ER - Error during call and error message(s) issued.

2

2

 

 

 

Technical Notes

Portability Considerations

Servers defined with DEFINE_OS_400_SERVER: 

The aggregate byte length of a working list passed to a server cannot exceed 32,000 bytes. The aggregate byte length is the entry byte length multiplied by the current number of entries. As 1 to 10 working lists can be passed to the function on the server, the total number of bytes that can be passed to the Server is 320,000, that is, 10 working lists of 32,000 bytes each.

This Built-In Function will cause a fatal error message if a client function passes a list that is too large. However, the server function is a different matter. The working list it receives as a parameter is in memory allocated by its caller (i.e. the IBM i based server controller). If it attempts to add too many entries to the working list it may "zap" the server controller and cause an application failure.
Please do not ignore this warning. Server (i.e. IBM i based) functions that receive working lists from Client (e.g. Windows) functions via this Built-In Function must take great care not to "overfill" the working list(s) that they are passed.

If an unexpected failure of CALL_SERVER_FUNCTION occurs, and working lists are involved, then look to this point as the first possible cause ..... the server function may be overfilling the working list(s).

 A Note on Error Handling

It is very strongly recommended that you avoid building complex error handling schemes into your applications. Use a very simple trap like this at all levels of your application.

if (#retcode *ne OK)

     abort msgtxt('Failed to .............................')

endif

Let the standard error handling Built-In Function to every generated application take care of the problem. Situations have arisen where user defined error handling logic has become so complex as to consume 40 - 50% of all RDML code (with no obvious benefit to the application). Do not fall into this trap.