/*******************************************************************************
 * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved.
 * This program and the accompanying materials are made available under the 
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
 * which accompanies this distribution. 
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 * and the Eclipse Distribution License is available at 
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * Contributors:
 *     Oracle - initial API and implementation from Oracle TopLink
 ******************************************************************************/  
package org.eclipse.persistence.platform.database;

import org.eclipse.persistence.expressions.ExpressionOperator;

/**
 * <b>Purpose</b>: Provides DB2 Mainframe specific behavior.<p>
 * This provides for some additional compatibility in certain DB2 versions on OS390.
 * <b>Responsibilities</b>:
 * <ul>
 *  <li>Specialized CONCAT syntax
 * </ul>
 *
 * @since TopLink 3.0.3
 */
public class DB2MainframePlatform extends DB2Platform {
    public DB2MainframePlatform() {
        super();
        this.pingSQL = "SELECT COUNT(*) from SYSIBM.SYSDUMMY1 WHERE 1 = 0";
    }

    /**
     * Initialize any platform-specific operators
     */
    @Override
    protected void initializePlatformOperators() {
        super.initializePlatformOperators();

        addOperator(ExpressionOperator.simpleLogicalNoParens(ExpressionOperator.Concat, "CONCAT"));
    }
    
    /**
     * INTERNAL:
     * Return if brackets can be used in the ON clause for outer joins.
     * Some DB2 versions on OS390 do not allow this.
     */
    @Override
    public boolean supportsOuterJoinsWithBrackets() {
        return false;
    }
}
@@ -652,16 +652,159 @@
 opLink%0D%0A
+ *     Nov 5, 2013-2.5 Chris Delahunt %0D%0A *       - 421109: DB2 AS400 doesn't support %22USE AND KEEP UPDATE LOCKS%22 used for pessimistic locking%0D%0A
  *******
@@ -1795,16 +1795,376 @@
 ERNAL:%0D%0A
+     * Used for pessimistic locking in DB2.%0D%0A     * Without the %22WITH RS%22 the lock is not held.%0D%0A     * AS/400 does not support UPDATE type lock, so EXCLUSIVE is used instead.%0D%0A     */%0D%0A    @Override%0D%0A    public String getSelectForUpdateString() %7B%0D%0A        return %22 FOR READ ONLY WITH RS USE AND KEEP EXCLUSIVE LOCKS%22;%0D%0A    %7D%0D%0A    %0D%0A    /**%0D%0A     * INTERNAL:%0D%0A
      * R

Fix for bug 421109 - DB2 AS400 doesn't support "USE AND KEEP UPDATE LOCKS" used for pessimistic locking - Change to DB2MainframePlatform to add a getSelectForUpdateString method to use exclusive locks for DB/2 Mainframe (FOR READ ONLY WITH RS USE AND KEEP EXCLUSIVE LOCKS) - Documentation at http://publib.boulder.ibm.com/html/as400/v4r4/ic2962/info/db2/rbafzmst29.htm indicates that DB2 AS/400 only supports SHARED and EXCLUSIVE lock types - Reviewed. Checking in for Chris Delahunt