Progress
Database Administration
Guide and Reference


4GL Client Considerations

On the client side, you must consider a few things. First, the client no longer connects to a specific host using -H. Instead, the client connects to an NT Cluster TCP/IP Alias. Therefore, any code in which you specify the host to connect to, you must modify the code to use the cluster alias in use for the database server. You can still connect directly to a host; however, if that host is down or not serving the database, then your client will not reconnect unless you change the value of -H to the name of the other node.

Secondly, if you do not already have in your client P-Code error checking for the STOP signal, you must add code to handle the STOP signal. See the section on “How Progress Handles System and Software Failure” section in the Progress Programming Handbook for details on the STOP condition handling.

The following code examples exhibit the types of error handling that need to be done to support the cluster failover from the client side. When a node fails and the Cluster Manager migrates the database server from one node to another, the Progress client is given a STOP signal, which is trapped and handled in the code.

The client automatically receives a couple of Progress-generated error dialog boxes indicating the last write was not performed and potentially the last transaction was not completed. Alert your client users to these messages, so they know that they must re-enter their last transaction.

The following examples assume that you have a Database server running on your Windows NT cluster with a Service (-S) name of ‘cludemo1’ using the Host (-H) name ‘cluster’. The demonstration is strictly to exhibit what type of programming must be done to make this work. It is not a full-featured application. The CluDemo1 database is a copy of the Progress SPORTS demonstration database with no other changes.

Lastly, one other programming consideration that is exhibited by the demonstration program: Do you bring your client back to the point where the failure occurred, or do you start your client at the beginning? In other words, how much state do you keep within your code? This example tries to bring the client back to the last customer record being updated before the STOP was raised. Therefore, the state that is kept within this code is the last customer record chosen:

repeat.p
DEFINE NEW GLOBAL SHARED VARIABLE cur-cust AS INTEGER INITIAL O. 
REPEAT ON ERROR UNDO, LEAVE 
  ON STOP UNDO, RETRY: 
    IF RETRY 
    THEN DO: 
        MESSAGE "The STOP condition has occurred." SKIP 
          "Do you wish to continue?" VIEW-AS ALERT-BOX QUESTION 
          BUTTONS yes-no UPDATE continue-ok AS LOGICAL. 
        IF NOT continue-ok 
        THEN UNDO, LEAVE. 
    END. 
   IF NOT CONNECTED ("cludemo1") THEN 
       connect cludemo1 -S cludemo1 -H cluster -N tcp. 
   IF NOT CONNECTED ("cludemo1") 
    THEN DO: 
        RUN updcust.p. 
        MESSAGE "Exit from updcust.p" SKIP 
         "Do you wish to continue?" VIEW-AS ALERT-BOX QUESTION 
          BUTTONS yes-no UPDATE continue-ok. 
        IF NOT continue-ok 
        THEN LEAVE. 
        ELSE cur-cust = O. /* Reinitialize */ 
    END. 
    ELSE 
    DO: 
      MESSAGE "Database not available." SKIP 
       "Do you wish to continue?" VIEW-AS ALERT-BOX QUESTION 
        BUTTONS yes-no UPDATE continue-ok. 
   IF NOT continue-0k 
   THEN LEAVE. 
   END. 
end. 

updcust.p
/* If never run before cur-cust is 0 */ 
DEFINE SHARED VARIABLE cur-cust AS INTEGER. 
DEFINE VARIABLE first-time AS LOGICAL INITIAL TRUE. 
REPEAT WITH 1 COLUMN 1 DOWN: 
    IF first-time AND cur-cust NE 0 
    THEN DO: 
        FIND customer WHERE customer.cust-num = cur-cust NO-ERROR NO-WAIT. 
    END. 
    ELSE 
    DO: 
        PROMPT-FOR customer.cust-num. 
        FIND customer USING cust-num NO-ERROR NO-WAIT. 
    END. 
    first-time = FALSE. 
    IF NOT AVAILABLE customer 
    THEN DO: 
        MESSAGE "Customer record " INPUT customer.cust-num " not found."  
SKIP 
                "Do you wish to continue?" VIEW-AS ALERT-BOX QUESTION 
                BUTTONS yes-no UPDATE continue-ok AS LOGICAL. 
        IF NOT continue-ok 
       THEN LEAVE. 
       cur-cust = 0. 
    END. 
    ELSE  
    DO: 
        cur-cust = customer.cust-num. 
        DISPLAY customer.cust-num. 
        UPDATE name address city state postal-code credit-limit. 
    END. 
END. 


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095