I was converting a few programs from D3 to UD and noticed the following: BILL 001 InValue = "Test" 002 CALL BILL.SUBR (InValue, InValue) 003 END
BILL.SUBR 001 SUBROUTINE BILL.SUBR (RtnValue, InValue) 002 CRT "InValue before-: " : InValue 003 RtnValue = '' 004 CRT "InValue after--: " : InValue 005 RETURN 006 END The value of "InValue", in the subroutine, is changed when the variable "RtnValue" is assigned a value. :RUN BP BILL InValue before-: Test InValue after--: This seems to indicate that there's a relationship between the variable InValue in the calling program and the subroutine; in the subroutine when RtnValue is initialized the variable InValue is also initialized. I'd have thought it's the positions that are important (since there must be the number of arguments must equal in both the calling and the called programs), not necessarily the variable names. Have I figured this out right, and is this correct? As I remember, the passed arguements in subroutines: 1) don't have to be the same name, and 2) are managed solely within the subroutine. Per the UniData documentation: SUBROUTINE Syntax SUBROUTINE sub.name[(argument1 [, argument2] ...)] Description If you pass arguments, the number of arguments in the CALL statement and the SUBROUTINE statement must match, although variable names do not need to be the same. Changes made to arguments in the subroutine retain their new values when UniData exits the subroutine and control reverts to the calling program. Naturally, I resolve the program by changing the code to pass different variables, as arguments, to the called subroutine. :-) Bill Haskett Advantos Systems, Inc. www.advantos.net (760)944-5570 (CA) (360)923-4838 (WA) ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/