For Programmers: Free Programming Magazines  


Home > Archive > Clarion > September 2006 > How to pass a QUEUE to a procedure, change the value, and return?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to pass a QUEUE to a procedure, change the value, and return?
tonylam@clsys.com.hk

2006-09-19, 3:55 am

Hi All,

Buffer QUEUE,PRE(BUF)
Name STRING(20)
END

MyFormatName(Buffer)


How can I change the values of a queue in MyFormatName( ) and access
the new value in the calling procedure?

Thanks

Tony

lgpalomares@gmail.com

2006-09-21, 7:55 am

Hi Tony,
Two ways to do this.
1) Generic

!I had added another field to your queue definition just to clarify the
idea
Buffer QUEUE,PRE(BUF)
Name STRING(20)
Id LONG
END

MyFormatName(*QUEUE pBuffer)
DATA
Loc:Any ANY
CODE
Loc:Any &= WHAT(pBuffer,1)
Loc:Any = 'Bla Bla Bla'
Loc:Any &= WHAT(pBuffer,2)
Loc:Any = 1
ADD(pBuffer)


2) Friendly

!Declaring a new datatype (somewhere in global data)
TQBuffer QUEUE,PRE(TQBuf),TYPE
Name STRING(20)
Id LONG
END

!Using it in the calling procedure
Buffer QUEUE(TQBuf),PRE(Buf)
END

MyFormatName(Buffer)

!Using it in the called procedure
MyFormatName PROCEDURE(*TQBuffer pBuffer)
CODE
pBuffer.Name = 'Bla Bla Bla'
pBuffer.Id = 1
ADD(pBuffer)

Regards

Leo

tonylam@clsys.com.hk wrote:
> Hi All,
>
> Buffer QUEUE,PRE(BUF)
> Name STRING(20)
> END
>
> MyFormatName(Buffer)
>
>
> How can I change the values of a queue in MyFormatName( ) and access
> the new value in the calling procedure?
>
> Thanks
>
> Tony


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com