Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Defining arguments in subroutines

Status
Not open for further replies.

Helmsley

Programmer
Dec 17, 2001
18
0
0
SG
I am doing a software change for an existing module and am facing problems with defining arguments for a subroutine. To make my problem clearer, this is a sample of the original code
--------------------------------------------
Subroutine Packing(element,message, length)
Integer*2 element(*)
Integer*2 message(*)
Integer*4 length

message(1)=IBITS(element(1),0, 14)
.
.
.
length=16
End
-----------------------------------------------

Now, i want to change this source code by adding in a few lines, like the one given below:

------------------------------------------------
message(4)=IBITS(DAY,0,5)
------------------------------------------------

The variable "DAY" is defined as of type INTEGER*4. I was just wondering is it possible to add in new variables like "DAY" without changing the dummy arguments. So far, the dummy arguments in the subroutine only consist of "element", "message" and "length". Are variables like "DAY" covered by the dummy arguments "element"? Or do I have to add in additional dummy arguments in the subroutine? If so, what type of dummy argument should I add in?

 
As long as message (and not DAY) is returned to
the main program, no more arguments are needed, but
DAY must be defined in the subroutine.
 
hi! thanks for the reply. Do you mean that now my subroutine will be defined as such
---------------------------------------------
SUBROUTINE PACKING(element,DAY,message,length)
----------------------------------------------

If DAY and element are of the same type (like INTEGER*2), do I still need to define DAY in the subroutine?
 
The point is : bits are extracted from DAY.
Therefore, the content of DAY must be defined.
So far, there is no connection between DAY and
element, and it is irrelevant that both are integer*2.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top