10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

How You Can Use Exec 4GL Statements in 3GL ProceduresAssume, for example, that a ghost frame defines a user event calledMonitor_conditions and that it sends this event to itself every sixty seconds. Inaddition to sending the event to itself, this user event calls a 3GL procedurethat communicates with external devices. In calling the 3GL procedure, theghost frame passes its FrameExec object, allowing the 3GL procedure to senda user event to the ghost frame in the event of a triggering condition.The following code in the ghost frame performs these operations:on userevent 'Monitor_conditions' =begincallproc monitor_proc(CurFrame);CurFrame.SendUserEvent(eventname = 'Monitor_conditions',delay = 60);end;The monitor_proc procedure that the ghost frame calls must declare aparameter to store the handle to the FrameExec object passed to it. Thefollowing code contains an example 3GL procedure:int monitor_proc (frame_handle)exec sql begin declare section;long frame_handle;exec sql end declare section;{exec sql begin declare section;char msg[100];exec sql end declare section;...strcpy (msg, "Appropriate conditiontext here.");exec 4gl send userevent :frame_(eventname ='Monitor_conditions',messagevarchar = :msg);...return;}Note: The use of single quotes within an exec 4GL statement follows thesyntactic rules of OpenROAD rather than those of the 3GL language.This procedure uses the frame_handle variable, which received the ghostframe's FrameExec object, to serve as the address when sending the userevent to the ghost frame.For a discussion of communicating between frames with user events, seeInter-Frame Communication Techniques (see page 333). For more informationabout ghost frames, see <strong>Programming</strong> Frames (see page 95).304 <strong>Programming</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!