slow performance with concurrent users

Hello,

I'm developing in an application installed in a Windows 2003 server. The users connect to the application with mapped drives from their Windows pc's. The trouble occurs when two or more users access simultaneously to the same vision file. The first one, can runs the whole file in about 2 seconds, but the second one runs the file in about 1 minute.

I'm using 8.1.3.1 version and executing cobol programs with wrun32.exe

The mapped drive seems to work fine, i can open the folder, copy files and open them with no retard.


How can I solve this?

  • Couple of suggestions for testing:

    1)  Install AcuServer and test.

    2)  You didn't mention your open method but I would suggest testing with the file open input.

  • It sounds like you may need to disable "opportunistic locking" and/or change the runtime's "SAFE" file mode access.  We have a program called "WINREG" that we call when our main program starts.  It checks the Windows registry to make sure these are set.  We added these starting with the 5.2.1 runtime to address file access speed issues in a Windows multi-user, mapped drive configuration starting with Windows 2000.  I'm not sure how to attach a file to a post, so I'll just post the source code for the program we use below.

    We ran into rare instances where customers had security settings that were so strict that the normal user could not change the registry.  As you can see in the code, we added an environment setting that can be set to tell the program not to run for that user.

    Also, this isn't an issue when access remote files using thin client or when not on a Windows computer, so the program checks for these conditions as well.

    In addition, I don't remember when we needed "safe" mode enabled, but there is an environment setting that will re-enable/keep "safe" file access enabled.  By default, the program configures the runtime for "fast" file access.

    Finally, "opportunistic locking" didn't exist on Windows ME, 98 or 95 (we've been using this program for quite a while), so it confirms the program is running on a Windows NT platform before disabling this feature.

    Hope this helps!

          IDENTIFICATION DIVISION.

    ************************************************************************

          PROGRAM-ID.  WINREG IS INITIAL PROGRAM.

    ************************************************************************

          AUTHOR. SHANE PRICE.  Bookstore Manager, Inc.

         *

         * Change the Windows registry to disable "opportunistic locking"

         * in Windows NT-based systems (Windows 2000, 2003, XP, etc.)

         *

         * Change the Windows registry for the 5.2.1 and later runtime's

         * "SAFE" file mode access

         *

    ************************************************************************

          DATA DIVISION.

    ************************************************************************

          WORKING-STORAGE SECTION.

    ************************************************************************

          COPY "\SOURCES\DEF\ACUCOBOL.DEF".

          COPY "\SOURCES\DEF\ACUGUI.DEF".

          COPY "\SOURCES\DEF\WINVERS.DEF".

       ********************************

         * Registry variables

          01  REGISTRY-SUBKEY-HANDLE     USAGE UNSIGNED-LONG.

          01  REGISTRY-SUBKEY-NAME       PIC X(100).

          01  REGISTRY-CLASS-NAME        PIC X(100).

          01  REGISTRY-SAM-DESIRED       USAGE UNSIGNED-LONG.

          01  REGISTRY-SAM-TEMP          USAGE UNSIGNED-LONG.

          01  REGISTRY-DATA-TYPE         USAGE UNSIGNED-LONG.

          01  REGISTRY-DATA-SIZE         USAGE UNSIGNED-LONG.

          01  REGISTRY-VALUE-NAME        PIC X(100).

          01  REGISTRY-VALUE-DATA.

             03 VALUE-DATA-ORIG                         PIC X(100).

             03 VALUE-BINARY  REDEFINES VALUE-DATA-ORIG PIC X(100).

             03 VALUE-DWORD   REDEFINES VALUE-DATA-ORIG USAGE SIGNED-LONG.

          01  REGISTRY-STATUS-CODE       PIC 9(5).

          01  REGISTRY-DISPOSITION       USAGE UNSIGNED-LONG.

          01  REG-COUNT                  PIC 99.

       ********************************

          01  USE-SAFE-READ-MODE         PIC X.

          01  IGNORE-REGISTRY-UPDATE     PIC X.

    ************************************************************************

          PROCEDURE DIVISION.  

    ************************************************************************

          MAIN-LOGIC.

    ************************************************************************

         * if this is being called automatically when the application starts,

         *   "IGNORE-REGISTRY-UPDATE" can be used as a fail-safe to allow

         *   the application to start, in case the registry updates fail

              ACCEPT IGNORE-REGISTRY-UPDATE

                 FROM ENVIRONMENT "IGNORE-REGISTRY-UPDATE".

              IF IGNORE-REGISTRY-UPDATE = "Y"

                 EXIT PROGRAM

                 STOP RUN

              END-IF.

              ACCEPT SYSTEM-INFORMATION FROM SYSTEM-INFO.

              ACCEPT TERMINAL-ABILITIES FROM TERMINAL-INFO.

         * meaningless outside of Windows

         * don't want to run from Thin Client

         *    either way - exit program

              IF IS-REMOTE OR NOT OS-IS-WIN-FAMILY

                 EXIT PROGRAM

                 STOP RUN

              END-IF.

              PERFORM SET-SAFE-READ-MODE.

              CALL "WIN$VERSION" USING WINVERSION-DATA.

              IF PLATFORM-WIN-NT

                 PERFORM DISABLE-OPPORTUNISTIC-LOCKING

              END-IF.

              EXIT PROGRAM.

              STOP RUN.

    *********************************************************************

          DISABLE-OPPORTUNISTIC-LOCKING.

    *********************************************************************

         * Note from Microsoft Knowledge Base Article - 296264

         * The OplocksDisable registry value configures Windows clients to

         * either request or not request opportunistic locks on a remote file.

              MOVE KEY_QUERY_VALUE    TO REGISTRY-SAM-DESIRED.

              MOVE KEY_CREATE_SUB_KEY TO REGISTRY-SAM-TEMP.

              CALL "CBL_OR"

                 USING REGISTRY-SAM-TEMP, REGISTRY-SAM-DESIRED

              END-CALL.

              MOVE KEY_SET_VALUE      TO REGISTRY-SAM-TEMP.

              CALL "CBL_OR"

                 USING REGISTRY-SAM-TEMP, REGISTRY-SAM-DESIRED

              END-CALL.

              MOVE

              "SYSTEM\CurrentControlSet\Services\MRXSmb\Parameters"

                 TO REGISTRY-SUBKEY-NAME.

              MOVE "OplocksDisabled"

                 TO REGISTRY-VALUE-NAME.

              CALL "REG_OPEN_KEY_EX" USING

                    HKEY_LOCAL_MACHINE,

                    REGISTRY-SUBKEY-NAME,

                    REGISTRY-SAM-DESIRED,

                    REGISTRY-SUBKEY-HANDLE,

                       GIVING REGISTRY-STATUS-CODE

              END-CALL

              IF REGISTRY-STATUS-CODE = 0

         * key found and opened successfully, now query value

                 MOVE 4 TO REGISTRY-DATA-SIZE

                 MOVE 0 TO VALUE-DWORD

                 MOVE REG_DWORD TO REGISTRY-DATA-TYPE

                 CALL "REG_QUERY_VALUE_EX" USING

                       REGISTRY-SUBKEY-HANDLE,

                       REGISTRY-VALUE-NAME,

                       REGISTRY-DATA-TYPE,

                       REGISTRY-VALUE-DATA,

                       REGISTRY-DATA-SIZE,

                          GIVING REGISTRY-STATUS-CODE

                 END-CALL

                 IF REGISTRY-STATUS-CODE = 0

                    IF VALUE-DWORD NOT = 1

         * registry is not set to disable opportunistic locking requests

         * so we are going to update the registry to disable them

                       MOVE 1 TO VALUE-DWORD

                       MOVE 4 TO REGISTRY-DATA-SIZE

                       MOVE REG_DWORD TO REGISTRY-DATA-TYPE

         * extract from NTSAcuSv.cbl in 5.2.1 samples:

         *    This update to the registry may take more than 1 try due to

         *    other system occurrences.  We'll give it up to 20 tries, but

         *    get out of the loop as soon as it's successful.

                       PERFORM VARYING REG-COUNT

                                FROM 1 BY 1 UNTIL REG-COUNT > 20

                          CALL "REG_SET_VALUE_EX" USING

                                REGISTRY-SUBKEY-HANDLE,

                                REGISTRY-DATA-TYPE,

                                REGISTRY-VALUE-DATA,

                                REGISTRY-DATA-SIZE,

                                REGISTRY-VALUE-NAME,

                                   GIVING REGISTRY-STATUS-CODE

                          END-CALL

                          IF REGISTRY-STATUS-CODE = 0

                             EXIT PERFORM

                          END-IF

                       END-PERFORM

         * The existing DWORD value has been changed to 1

         * To prevent unnecessary support calls, we chose not to

         * display a message about changing this registry entry

                    ELSE

         * Registry entry found; opportunistic locking already disabled

                       CONTINUE

                    END-IF

                 ELSE

         * Key exists, but query failed, so we need to create

         * a new DWORD value under the key

                    MOVE 1 TO VALUE-DWORD

                    MOVE 4 TO REGISTRY-DATA-SIZE

                    MOVE REG_DWORD TO REGISTRY-DATA-TYPE

         * extract from NTSAcuSv.cbl in 5.2.1 samples:

         *    This update to the registry may take more than 1 try, due to

         *    other system occurrences.  We'll give it up to 20 tries, but

         *    get out of the loop as soon as it's successful.

                    PERFORM VARYING REG-COUNT

                             FROM 1 BY 1 UNTIL REG-COUNT > 20

                       CALL "REG_SET_VALUE_EX" USING

                             REGISTRY-SUBKEY-HANDLE,

                             REGISTRY-DATA-TYPE,

                             REGISTRY-VALUE-DATA,

                             REGISTRY-DATA-SIZE,

                             REGISTRY-VALUE-NAME,

                                GIVING REGISTRY-STATUS-CODE

                       END-CALL

                       IF REGISTRY-STATUS-CODE = 0

                          EXIT PERFORM

                       END-IF

                    END-PERFORM

         * IF REGISTRY-STATUS-CODE = 0, then the OplocksDisabled DWORD

         * entry has been created and set to a value of 1

         * Otherwise, we could not create the new DWORD entry

                 END-IF

              ELSE

         * registry key not found, so opportunistic locking is not disabled

         * need to create the key to disable this feature

                 CALL "REG_CREATE_KEY_EX" USING

                       HKEY_LOCAL_MACHINE,

                       REGISTRY-SUBKEY-NAME,

                       REGISTRY-CLASS-NAME,

                       REG_OPTION_NON_VOLATILE,

                       REGISTRY-SAM-DESIRED,

                       REGISTRY-SUBKEY-HANDLE,

                       REGISTRY-DISPOSITION

                          GIVING REGISTRY-STATUS-CODE

                 END-CALL

                 IF REGISTRY-STATUS-CODE = 0

                    MOVE 1 TO VALUE-DWORD

                    MOVE 4 TO REGISTRY-DATA-SIZE

                    MOVE REG_DWORD TO REGISTRY-DATA-TYPE

         * extract from NTSAcuSv.cbl in 5.2.1 samples:

         *    This update to the registry may take more than 1 try, due to

         *    other system occurrences.  We'll give it up to 20 tries, but

         *    get out of the loop as soon as it's successful.

                    PERFORM VARYING REG-COUNT

                             FROM 1 BY 1 UNTIL REG-COUNT > 20

                       CALL "REG_SET_VALUE_EX" USING

                             REGISTRY-SUBKEY-HANDLE,

                             REGISTRY-DATA-TYPE,

                             REGISTRY-VALUE-DATA,

                             REGISTRY-DATA-SIZE,

                             REGISTRY-VALUE-NAME,

                                GIVING REGISTRY-STATUS-CODE

                       END-CALL

                       IF REGISTRY-STATUS-CODE = 0

                          EXIT PERFORM

                       END-IF

                    END-PERFORM

         * To prevent unnecessary support calls, we chose not to

         * display a message about changing this registry entry

         * IF REGISTRY-STATUS-CODE = 0, the OplocksDisabled DWORD entry

         * has been created and set to a value of 1

         * Otherwise, we failed to create the OplocksDisabled DWORD entry

                 ELSE

         * failed to create key, but not showing a message

                    CONTINUE

                 END-IF

              END-IF.

         * close key, in case we had a success read or write above

              CALL "REG_CLOSE_KEY" USING REGISTRY-SUBKEY-HANDLE.

         * Note from Microsoft Knowledge Base Article - 296264

         * The EnableOplocks value configures Windows-based servers

         * (including Workstations sharing files) to allow or deny

         * opportunistic locks on local files

              MOVE KEY_QUERY_VALUE    TO REGISTRY-SAM-DESIRED.

              MOVE KEY_CREATE_SUB_KEY TO REGISTRY-SAM-TEMP.

              CALL "CBL_OR"

                 USING REGISTRY-SAM-TEMP, REGISTRY-SAM-DESIRED

              END-CALL.

              MOVE KEY_SET_VALUE      TO REGISTRY-SAM-TEMP.

              CALL "CBL_OR"

                 USING REGISTRY-SAM-TEMP, REGISTRY-SAM-DESIRED

              END-CALL.

              MOVE

              "SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters"

                 TO REGISTRY-SUBKEY-NAME.

              MOVE "EnableOplocks"

                 TO REGISTRY-VALUE-NAME.

              CALL "REG_OPEN_KEY_EX" USING

                    HKEY_LOCAL_MACHINE,

                    REGISTRY-SUBKEY-NAME,

                    REGISTRY-SAM-DESIRED,

                    REGISTRY-SUBKEY-HANDLE,

                       GIVING REGISTRY-STATUS-CODE

              END-CALL

              IF REGISTRY-STATUS-CODE = 0

         * key found and opened successfully, now query value

                 MOVE 4 TO REGISTRY-DATA-SIZE

                 MOVE 0 TO VALUE-DWORD

                 MOVE REG_DWORD TO REGISTRY-DATA-TYPE

                 CALL "REG_QUERY_VALUE_EX" USING

                       REGISTRY-SUBKEY-HANDLE,

                       REGISTRY-VALUE-NAME,

                       REGISTRY-DATA-TYPE,

                       REGISTRY-VALUE-DATA,

                       REGISTRY-DATA-SIZE,

                          GIVING REGISTRY-STATUS-CODE

                 END-CALL

                 IF REGISTRY-STATUS-CODE = 0

                    IF VALUE-DWORD NOT = 0

         * registry is set to allow opportunistic locking requests

         * so we are going to update the registry to deny them

                       MOVE 0 TO VALUE-DWORD

                       MOVE 4 TO REGISTRY-DATA-SIZE

                       MOVE REG_DWORD TO REGISTRY-DATA-TYPE

         * extract from NTSAcuSv.cbl in 5.2.1 samples:

         *    This update to the registry may take more than 1 try due to

         *    other system occurrences.  We'll give it up to 20 tries, but

         *    get out of the loop as soon as it's successful.

                       PERFORM VARYING REG-COUNT

                                FROM 1 BY 1 UNTIL REG-COUNT > 20

                          CALL "REG_SET_VALUE_EX" USING

                                REGISTRY-SUBKEY-HANDLE,

                                REGISTRY-DATA-TYPE,

                                REGISTRY-VALUE-DATA,

                                REGISTRY-DATA-SIZE,

                                REGISTRY-VALUE-NAME,

                                   GIVING REGISTRY-STATUS-CODE

                          END-CALL

                          IF REGISTRY-STATUS-CODE = 0

                             EXIT PERFORM

                          END-IF

                       END-PERFORM

         * The existing DWORD value has been changed to 0

         * To prevent unnecessary support calls, we chose not to

         * display a message about changing this registry entry

                    ELSE

         * Registry entry found; opportunistic locking already disabled

                       CONTINUE

                    END-IF

                 ELSE

         * Key exists, but query failed so we need to create

         * a new DWORD value under the key

                    MOVE 0 TO VALUE-DWORD

                    MOVE 4 TO REGISTRY-DATA-SIZE

                    MOVE REG_DWORD TO REGISTRY-DATA-TYPE

         * extract from NTSAcuSv.cbl in 5.2.1 samples:

         *    This update to the registry may take more than 1 try, due to

         *    other system occurrences.  We'll give it up to 20 tries, but

         *    get out of the loop as soon as it's successful.

                    PERFORM VARYING REG-COUNT

                             FROM 1 BY 1 UNTIL REG-COUNT > 20

                       CALL "REG_SET_VALUE_EX" USING

                             REGISTRY-SUBKEY-HANDLE,

                             REGISTRY-DATA-TYPE,

                             REGISTRY-VALUE-DATA,

                             REGISTRY-DATA-SIZE,

                             REGISTRY-VALUE-NAME,

                                GIVING REGISTRY-STATUS-CODE

                       END-CALL

                       IF REGISTRY-STATUS-CODE = 0

                          EXIT PERFORM

                       END-IF

                    END-PERFORM

         * IF REGISTRY-STATUS-CODE = 0, then the EnableOplocks DWORD

         * entry has been created and set to a value of 0

         * Otherwise, we could not create the EnableOplocks DWORD entry

                 END-IF

              ELSE

         * registry key not found, so opportunistic locking is allowed

         * need to create the key to deny these requests

                 CALL "REG_CREATE_KEY_EX" USING

                       HKEY_LOCAL_MACHINE,

                       REGISTRY-SUBKEY-NAME,

                       REGISTRY-CLASS-NAME,

                       REG_OPTION_NON_VOLATILE,

                       REGISTRY-SAM-DESIRED,

                       REGISTRY-SUBKEY-HANDLE,

                       REGISTRY-DISPOSITION

                          GIVING REGISTRY-STATUS-CODE

                 END-CALL

                 IF REGISTRY-STATUS-CODE = 0

                    MOVE 0 TO VALUE-DWORD

                    MOVE 4 TO REGISTRY-DATA-SIZE

                    MOVE REG_DWORD TO REGISTRY-DATA-TYPE

         * extract from NTSAcuSv.cbl in 5.2.1 samples:

         *    This update to the registry may take more than 1 try, due to

         *    other system occurrences.  We'll give it up to 20 tries, but

         *    get out of the loop as soon as it's successful.

                    PERFORM VARYING REG-COUNT

                             FROM 1 BY 1 UNTIL REG-COUNT > 20

                       CALL "REG_SET_VALUE_EX" USING

                             REGISTRY-SUBKEY-HANDLE,

                             REGISTRY-DATA-TYPE,

                             REGISTRY-VALUE-DATA,

                             REGISTRY-DATA-SIZE,

                             REGISTRY-VALUE-NAME,

                                GIVING REGISTRY-STATUS-CODE

                       END-CALL

                       IF REGISTRY-STATUS-CODE = 0

                          EXIT PERFORM

                       END-IF

                    END-PERFORM

         * To prevent unnecessary support calls, we chose not to

         * display a message about changing this registry entry

         * IF REGISTRY-STATUS-CODE = 0, the EnableOplocks DWORD entry

         * has been created and set to a value of 0

         * Otherwise, we failed to create the EnableOplocks DWORD entry

                 ELSE

         * failed to create key, but not showing a message

                    CONTINUE

                 END-IF

              END-IF.

         * close key, in case we had a success read or write above

              CALL "REG_CLOSE_KEY" USING REGISTRY-SUBKEY-HANDLE.

         * Note from Microsoft Knowledge Base Article - 129202

         * The UseOpportunisticLocking value configures Windows NT-based

         * computers to use opportunistic-locking (oplock) performance

         * enhancement

              MOVE KEY_QUERY_VALUE    TO REGISTRY-SAM-DESIRED.

              MOVE KEY_CREATE_SUB_KEY TO REGISTRY-SAM-TEMP.

              CALL "CBL_OR"

                 USING REGISTRY-SAM-TEMP, REGISTRY-SAM-DESIRED

              END-CALL.

              MOVE KEY_SET_VALUE      TO REGISTRY-SAM-TEMP.

              CALL "CBL_OR"

                 USING REGISTRY-SAM-TEMP, REGISTRY-SAM-DESIRED

              END-CALL.

              MOVE SPACES TO REGISTRY-SUBKEY-NAME.

              STRING

                    "SYSTEM\CurrentControlSet\"    DELIMITED BY SIZE

                    "Services\LanmanWorkstation\"  DELIMITED BY SIZE

                    "Parameters"                   DELIMITED BY SIZE

                 INTO REGISTRY-SUBKEY-NAME

                 ON OVERFLOW

                    EXIT PARAGRAPH

              END-STRING

              MOVE "UseOpportunisticLocking"

                 TO REGISTRY-VALUE-NAME.

              CALL "REG_OPEN_KEY_EX" USING

                    HKEY_LOCAL_MACHINE,

                    REGISTRY-SUBKEY-NAME,

                    REGISTRY-SAM-DESIRED,

                    REGISTRY-SUBKEY-HANDLE,

                       GIVING REGISTRY-STATUS-CODE

              END-CALL

              IF REGISTRY-STATUS-CODE = 0

         * key found and opened successfully, now query value

                 MOVE 4 TO REGISTRY-DATA-SIZE

                 MOVE 0 TO VALUE-DWORD

                 MOVE REG_DWORD TO REGISTRY-DATA-TYPE

                 CALL "REG_QUERY_VALUE_EX" USING

                       REGISTRY-SUBKEY-HANDLE,

                       REGISTRY-VALUE-NAME,

                       REGISTRY-DATA-TYPE,

                       REGISTRY-VALUE-DATA,

                       REGISTRY-DATA-SIZE,

                          GIVING REGISTRY-STATUS-CODE

                 END-CALL

                 IF REGISTRY-STATUS-CODE = 0

                    IF VALUE-DWORD NOT = 0

         * registry is set to allow opportunistic locking requests

         * so we are going to update the registry to deny them

                       MOVE 0 TO VALUE-DWORD

                       MOVE 4 TO REGISTRY-DATA-SIZE

                       MOVE REG_DWORD TO REGISTRY-DATA-TYPE

         * extract from NTSAcuSv.cbl in 5.2.1 samples:

         *    This update to the registry may take more than 1 try due to

         *    other system occurrences.  We'll give it up to 20 tries, but

         *    get out of the loop as soon as it's successful.

                       PERFORM VARYING REG-COUNT

                                FROM 1 BY 1 UNTIL REG-COUNT > 20

                          CALL "REG_SET_VALUE_EX" USING

                                REGISTRY-SUBKEY-HANDLE,

                                REGISTRY-DATA-TYPE,

                                REGISTRY-VALUE-DATA,

                                REGISTRY-DATA-SIZE,

                                REGISTRY-VALUE-NAME,

                                   GIVING REGISTRY-STATUS-CODE

                          END-CALL

                          IF REGISTRY-STATUS-CODE = 0

                             EXIT PERFORM

                          END-IF

                       END-PERFORM

         * The existing DWORD value has been changed to 0

         * To prevent unnecessary support calls, we chose not to

         * display a message about changing this registry entry

                    ELSE

         * Registry entry found; opportunistic locking already disabled

                       CONTINUE

                    END-IF

                 ELSE

         * Key exists, but query failed so we need to create

         * a new DWORD value under the key

                    MOVE 0 TO VALUE-DWORD

                    MOVE 4 TO REGISTRY-DATA-SIZE

                    MOVE REG_DWORD TO REGISTRY-DATA-TYPE

         * extract from NTSAcuSv.cbl in 5.2.1 samples:

         *    This update to the registry may take more than 1 try, due to

         *    other system occurrences.  We'll give it up to 20 tries, but

         *    get out of the loop as soon as it's successful.

                    PERFORM VARYING REG-COUNT

                             FROM 1 BY 1 UNTIL REG-COUNT > 20

                       CALL "REG_SET_VALUE_EX" USING

                             REGISTRY-SUBKEY-HANDLE,

                             REGISTRY-DATA-TYPE,

                             REGISTRY-VALUE-DATA,

                             REGISTRY-DATA-SIZE,

                             REGISTRY-VALUE-NAME,

                                GIVING REGISTRY-STATUS-CODE

                       END-CALL

                       IF REGISTRY-STATUS-CODE = 0

                          EXIT PERFORM

                       END-IF

                    END-PERFORM

         * IF REGISTRY-STATUS-CODE = 0, then the EnableOplocks DWORD

         * entry has been created and set to a value of 0

         * Otherwise, we could not create the EnableOplocks DWORD entry

                 END-IF

              ELSE

         * registry key not found, so opportunistic locking is allowed

         * need to create the key to deny these requests

                 CALL "REG_CREATE_KEY_EX" USING

                       HKEY_LOCAL_MACHINE,

                       REGISTRY-SUBKEY-NAME,

                       REGISTRY-CLASS-NAME,

                       REG_OPTION_NON_VOLATILE,

                       REGISTRY-SAM-DESIRED,

                       REGISTRY-SUBKEY-HANDLE,

                       REGISTRY-DISPOSITION

                          GIVING REGISTRY-STATUS-CODE

                 END-CALL

                 IF REGISTRY-STATUS-CODE = 0

                    MOVE 0 TO VALUE-DWORD

                    MOVE 4 TO REGISTRY-DATA-SIZE

                    MOVE REG_DWORD TO REGISTRY-DATA-TYPE

         * extract from NTSAcuSv.cbl in 5.2.1 samples:

         *    This update to the registry may take more than 1 try, due to

         *    other system occurrences.  We'll give it up to 20 tries, but

         *    get out of the loop as soon as it's successful.

                    PERFORM VARYING REG-COUNT

                             FROM 1 BY 1 UNTIL REG-COUNT > 20

                       CALL "REG_SET_VALUE_EX" USING

                             REGISTRY-SUBKEY-HANDLE,

                             REGISTRY-DATA-TYPE,

                             REGISTRY-VALUE-DATA,

                             REGISTRY-DATA-SIZE,

                             REGISTRY-VALUE-NAME,

                                GIVING REGISTRY-STATUS-CODE

                       END-CALL

                       IF REGISTRY-STATUS-CODE = 0

                          EXIT PERFORM

                       END-IF

                    END-PERFORM

         * To prevent unnecessary support calls, we chose not to

         * display a message about changing this registry entry

         * IF REGISTRY-STATUS-CODE = 0, the EnableOplocks DWORD entry

         * has been created and set to a value of 0

         * Otherwise, we failed to create the EnableOplocks DWORD entry

                 ELSE

         * failed to create key, but not showing a message

                    CONTINUE

                 END-IF

              END-IF.

         * close key, in case we had a success read or write above

              CALL "REG_CLOSE_KEY" USING REGISTRY-SUBKEY-HANDLE.

    *********************************************************************

          SET-SAFE-READ-MODE.

    *********************************************************************

              ACCEPT USE-SAFE-READ-MODE

                 FROM ENVIRONMENT "USE-SAFE-READ-MODE".

              MOVE KEY_QUERY_VALUE    TO REGISTRY-SAM-DESIRED.

              MOVE KEY_CREATE_SUB_KEY TO REGISTRY-SAM-TEMP.

              CALL "CBL_OR"

                 USING REGISTRY-SAM-TEMP, REGISTRY-SAM-DESIRED

              END-CALL.

              MOVE KEY_SET_VALUE      TO REGISTRY-SAM-TEMP.

              CALL "CBL_OR"

                 USING REGISTRY-SAM-TEMP, REGISTRY-SAM-DESIRED

              END-CALL.

              MOVE "Software\Acucorp, Inc.\ACUCOBOL-GT"

                 TO REGISTRY-SUBKEY-NAME.

              MOVE "GetUniqueId Uses CreateFile"

                 TO REGISTRY-VALUE-NAME.

              IF USE-SAFE-READ-MODE = "Y"

                 CALL "REG_OPEN_KEY_EX" USING

                    HKEY_LOCAL_MACHINE,

                    REGISTRY-SUBKEY-NAME,

                    REGISTRY-SAM-DESIRED,

                    REGISTRY-SUBKEY-HANDLE,

                       GIVING REGISTRY-STATUS-CODE

                 END-CALL

                 IF REGISTRY-STATUS-CODE = 0

         * key found - check value

                    MOVE 4 TO REGISTRY-DATA-SIZE

                    MOVE 0 TO VALUE-DWORD

                    MOVE REG_DWORD TO REGISTRY-DATA-TYPE

                    CALL "REG_QUERY_VALUE_EX" USING

                       REGISTRY-SUBKEY-HANDLE,

                       REGISTRY-VALUE-NAME,

                       REGISTRY-DATA-TYPE,

                       REGISTRY-VALUE-DATA,

                       REGISTRY-DATA-SIZE,

                          GIVING REGISTRY-STATUS-CODE

                    END-CALL

                    IF REGISTRY-STATUS-CODE = 0

                       IF VALUE-DWORD NOT = 1

         * registry is set for "fast" access, set to "safe" access

                          MOVE 1 TO VALUE-DWORD

                          MOVE 4 TO REGISTRY-DATA-SIZE

                          MOVE REG_DWORD TO REGISTRY-DATA-TYPE

         * extract from NTSAcuSv.cbl in 5.2.1 samples:

         *    This update to the registry may take more than 1 try, due to

         *    other system occurrences.  We'll give it up to 20 tries, but

         *    get out of the loop as soon as it's successful.

                          PERFORM VARYING REG-COUNT

                                   FROM 1 BY 1 UNTIL REG-COUNT > 20

                             CALL "REG_SET_VALUE_EX" USING

                                REGISTRY-SUBKEY-HANDLE,

                                REGISTRY-DATA-TYPE,

                                REGISTRY-VALUE-DATA,

                                REGISTRY-DATA-SIZE,

                                REGISTRY-VALUE-NAME,

                                   GIVING REGISTRY-STATUS-CODE

                             END-CALL

                             IF REGISTRY-STATUS-CODE = 0

                                EXIT PERFORM

                             END-IF

                          END-PERFORM

                          IF REGISTRY-STATUS-CODE = 0

                            DISPLAY MESSAGE

                              "Setting computer for SAFE file access mode."

                              X"0D0A"

                              "Windows Registry Successfully Updated!"

                              X"0D0A"

                              "Program Restart Required."

                              TITLE IS "Windows Registry Update"

                              ICON IS MB-WARNING-ICON

                            STOP RUN

                          END-IF

                       ELSE

         * The registry value is already set for "Safe" file access

                          CONTINUE

                       END-IF

                    ELSE

         * "GetUniqueId Uses CreateFile" DWORD entry doesn't exist

         * which means that safe mode is active (default) so leave alone

                       CONTINUE

                    END-IF

                 ELSE

         * registry key not found - safe mode is active so leave alone

                    CONTINUE

                 END-IF

              ELSE

         * disable "SAFE" read mode - check for key

                 CALL "REG_OPEN_KEY_EX" USING

                    HKEY_LOCAL_MACHINE,

                    REGISTRY-SUBKEY-NAME,

                    REGISTRY-SAM-DESIRED,

                    REGISTRY-SUBKEY-HANDLE,

                       GIVING REGISTRY-STATUS-CODE

                 END-CALL

                 IF REGISTRY-STATUS-CODE = 0

         * key found - check value

                    MOVE 4 TO REGISTRY-DATA-SIZE

                    MOVE 0 TO VALUE-DWORD

                    MOVE REG_DWORD TO REGISTRY-DATA-TYPE

                    CALL "REG_QUERY_VALUE_EX" USING

                       REGISTRY-SUBKEY-HANDLE,

                       REGISTRY-VALUE-NAME,

                       REGISTRY-DATA-TYPE,

                       REGISTRY-VALUE-DATA,

                       REGISTRY-DATA-SIZE,

                          GIVING REGISTRY-STATUS-CODE

                    END-CALL

                    IF REGISTRY-STATUS-CODE NOT = 0

                       OR

                       VALUE-DWORD = 1

         * the value doesn't exist in the key,

         *  or the key is set to "safe" file access

         *  change to "fast" access

                          MOVE 0 TO VALUE-DWORD

                          MOVE 4 TO REGISTRY-DATA-SIZE

                          MOVE REG_DWORD TO REGISTRY-DATA-TYPE

         * extract from NTSAcuSv.cbl in 5.2.1 samples:

         *    This update to the registry may take more than 1 try, due to

         *    other system occurrences.  We'll give it up to 20 tries, but

         *    get out of the loop as soon as it's successful.

                          PERFORM VARYING REG-COUNT

                                   FROM 1 BY 1 UNTIL REG-COUNT > 20

                             CALL "REG_SET_VALUE_EX" USING

                                REGISTRY-SUBKEY-HANDLE,

                                REGISTRY-DATA-TYPE,

                                REGISTRY-VALUE-DATA,

                                REGISTRY-DATA-SIZE,

                                REGISTRY-VALUE-NAME,

                                   GIVING REGISTRY-STATUS-CODE

                             END-CALL

                             IF REGISTRY-STATUS-CODE = 0

                                EXIT PERFORM

                             END-IF

                          END-PERFORM

                          IF REGISTRY-STATUS-CODE = 0

                            DISPLAY MESSAGE

                              "Setting computer for FAST file access mode."

                              X"0D0A"

                              "Windows Registry Successfully Updated!"

                              X"0D0A"

                              "Program Restart Required."

                              TITLE IS "Windows Registry Update"

                              ICON IS MB-WARNING-ICON

                            STOP RUN

                          END-IF

                    END-IF

                 ELSE

         * key not found, so in default "safe" file access mode

         *    create the key for "fast" access

                    CALL "REG_CREATE_KEY_EX" USING

                       HKEY_LOCAL_MACHINE,

                       REGISTRY-SUBKEY-NAME,

                       REGISTRY-CLASS-NAME,

                       REG_OPTION_NON_VOLATILE,

                       REGISTRY-SAM-DESIRED,

                       REGISTRY-SUBKEY-HANDLE,

                       REGISTRY-DISPOSITION

                          GIVING REGISTRY-STATUS-CODE

                    END-CALL

                    IF REGISTRY-STATUS-CODE = 0

                       MOVE 0 TO VALUE-DWORD

                       MOVE 4 TO REGISTRY-DATA-SIZE

                       MOVE REG_DWORD TO REGISTRY-DATA-TYPE

         * extract from NTSAcuSv.cbl in 5.2.1 samples:

         *    This update to the registry may take more than 1 try, due to

         *    other system occurrences.  We'll give it up to 20 tries, but

         *    get out of the loop as soon as it's successful.

                       PERFORM VARYING REG-COUNT

                                FROM 1 BY 1 UNTIL REG-COUNT > 20

                          CALL "REG_SET_VALUE_EX" USING

                             REGISTRY-SUBKEY-HANDLE,

                             REGISTRY-DATA-TYPE,

                             REGISTRY-VALUE-DATA,

                             REGISTRY-DATA-SIZE,

                             REGISTRY-VALUE-NAME,

                                GIVING REGISTRY-STATUS-CODE

                          END-CALL

                          IF REGISTRY-STATUS-CODE = 0

                             EXIT PERFORM

                          END-IF

                       END-PERFORM

                       IF REGISTRY-STATUS-CODE = 0

                          DISPLAY MESSAGE

                              "Setting computer for FAST file access mode."

                              X"0D0A"

                              "Windows Registry Successfully Updated!"

                              X"0D0A"

                              "Program Restart Required."

                             TITLE IS "Windows Registry Update"

                             ICON IS MB-WARNING-ICON

                         STOP RUN

                       END-IF

                    ELSE

         * failed to create key

                       DISPLAY MESSAGE

                          "Failed to create new registry key."

                          X"0D0A"

                          "Please log in using an account with Administr

         -                "ative privileges and try again."

                          TITLE IS "Windows Registry Update"

                          ICON IS MB-ERROR-ICON

                    END-IF

                 END-IF

              END-IF.

         * close key, in case we had a success read or write above

              CALL "REG_CLOSE_KEY" USING REGISTRY-SUBKEY-HANDLE.

  • Hi,

    First lot of thanks for the answers.

    - We open files with I-O, due to that users have to make modifications on the file

    - Opportunistic lock is desactivated in our installations on the server machine.

    - Talking about acuserver, I'm asking if my company will have to buy a special license or just with the wrun32 license we have right to use acuserver.

    Thanks again!

  • If you are not already using these two Runtime configuration settings then you should test them out:

    NT_OPP_LOCK_STATUS FAST

    V_LOCK_METHOD 1

  • You have to purchase a separate license for AcuServer. I have used AcuServer for years and its a great product and certainly addresses performance issues. I suggest you try out a demo license. Its easy to setup and test.

  • I've tested these configuration settings but they do not work. The slow speed is kept when a second user access to an open file (no matter if it is open for INPUT, I-O, or with any kind of locking)

    We would like to test acuserver, but to my company it would be too expensive, due to we have lot of small customers that can't afford to buy that license, so we would have to buy these licenses for every one of them.

  • Now I tested with 'I$IO' routine, but the results are the same.

  • Just to be clear, the settings described previously for opportunistic locking, etc. need to be applied on the client machines that are running the programs and accessing the data - not on the server itself.

    Your testing results with I$IO are not surprising, as it is just another programming method to access the runtime's Vision file handler. The actual file handler is exactly the same as the one used with standard COBOL I-O syntax.

    The Windows networking protocol (SMB) was designed and optimized for things like browsing files, and opening/saving documents (Word, Excel, etc.). It was not designed for multi-user concurrent file access.  That is exactly what AcuServer was designed for.

    Other options you might explore would be running the programs directly on the server, and have the client PCs connect to the server using either the Acu Thin Client, Windows Terminal Services, or Citrix.

  • what version are you working with and on which O/S ... the def files we provide are in the standard install AcuGT\sample\def directory.