Highlighted
Absent Member.
Absent Member.
491 views

[archive] Send & Receive

[Migrated content. Thread originally posted on 06 August 2004]

Folks,

Anyone got any good working example of programs in threads using send and receive and not just screens?

Here what I've got

Our system starts using a menu program
Now I pick a program to run and this program is called in a thread

When the chosen program is called, it immediately runs another security program which checks stuff and decides if I'm allowed to run chosen program.

I want this security program to be able to tell the menu program if it was unable to run because of stuff?

I have tried to do some work on this, but with poor results (memory access violation basically)

How am I supposed to receive the fact the another program has a message to send?

I know about allowing messages etc, but where do I code the procedure?

Hope this makes a bit of sense.

Regards,

Shaun
0 Likes
3 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Send & Receive

Doesn't matter anymore.

All sorted out now thanks to Nigel Eaton(Acucorp UK) and a bit of trial and error from me.

Works well by the way.

Shaun
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Send & Receive

Just a bit curious, how did you solve this?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Send & Receive

OK,

From the menu program the user picks say customer account enquiry which is called in a thread.

The fist thing customer account enquiry does is call the security program to check stuff.

This program check things and decides if you are allowed to run the customer account enquiry program or not.
If not, it sets a flag in linkage, and sends a message back to the menu program. Control is now back in the customer account enquiry which then terminates.

The menu program displays an appropriate message.

Code examples

Menu program calls the users choice
CALL THREAD VDU-PROG-NAME HANDLE WS-THREAD
USING LINKAGE-SECTION-RECORD

This is the exception procedure from the menu program
*
Screen1-Ex-Other.
*
IF Message-Received
RECEIVE LINK-RUN-FLG FROM THREAD WS-THREAD
IF LINK-RUN-FLG = "Y"
OR LINK-RUN-FLG = "y"
OR LINK-RUN-FLG = "X"
OR LINK-RUN-FLG = " "
CONTINUE
ELSE
PERFORM GOT-MESSAGE
END-IF
END-IF

The main screen in this program has Allowing Message = Any Thread

The security program does this is something is wrong.
SEND LINK-RUN-FLG TO LAST THREAD

WS-THREAD is just defined as USAGE HANDLE


Hopefully I have'nt missed anything.


Regards,

Shaun
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.