Locking Threads

I would like to place a thread lock around the code below but I'm not sure what the syntax would be in Visual COBOL. Can you help me with the syntax?

           IF WS-COMM-FROM-PROGRAM > SPACES
             ??Lock
             PERFORM VARYING WS-PREV-PROG-ENTRY
               FROM 1 BY 1 UNTIL WS-PREV-PROG-ENTRY > NAV-MAX-ENTRIES
                  IF NAV-PROGRAM-ID (WS-PREV-PROG-ENTRY) =
                     WS-COMM-FROM-PROGRAM
                     MOVE SPACES TO WS-COMM-FROM-PROGRAM
                     EXIT PERFORM
                  END-IF
             END-PERFORM
             ??End Lock        
           END-IF.