# Parse error in pattern: exercise Possibly caused by a missing 'do'?

**URL:** <https://forum.canton.network/t/parse-error-in-pattern-exercise-possibly-caused-by-a-missing-do/1301>\
**Category:** App Development\
**Tags:** daml\
**Created:** [September 25, 2020, 12:34pm UTC](https://forum.canton.network/t/parse-error-in-pattern-exercise-possibly-caused-by-a-missing-do/1301 "2020-09-25T12:34:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Muhammad\_Moiz](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/muhammad_moiz/32/840_2.png) [@Muhammad\_Moiz](https://forum.canton.network/u/Muhammad_Moiz)\
**Post date:** [September 25, 2020, 12:34pm UTC](https://forum.canton.network/t/parse-error-in-pattern-exercise-possibly-caused-by-a-missing-do/1301/1 "2020-09-25T12:34:19Z")

</div>

Hi, EveryOne I want to save the current date and time. I do following but get this error I search on the network but can’t able to solve it

```
    template Attandance 
        with
            systemUser : Party
            associate : Optional Party
            punchInTime : Optional Time
            punchOutTime :Optional Time
        where 
            signatory systemUser
            nonconsuming choice PunchIn 
                : ContractId Attandance
                with
                    currentTime : Time
                controller associate 
                   do 
                    create this with punchInTime = Some currentTime 
            nonconsuming choice PunchOut 
                : ContractId Attandance
                with
                    currentTime : Time
                controller associate 
                   do 
                    create this with punchOutTime = Some currentTime

```

Here is my scenario of update punchIn but it show me error when i exercised PunchIn exercise  
**Parse error in pattern: exercise**  
**Possibly caused by a missing ‘do’?**

```
atid <- submit systemUser do
        create Attandance
            with
                systemUser
                associate = None   
                punchInTime = None
                punchOutTime = None   
 submit associate do
        exercise asid PunchIn with
            currentTime <- getTime
    return()
```

---

<div class="post-metadata">

**Author:** ![SamirTalwar](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/samirtalwar/32/374_2.png) [@SamirTalwar](https://forum.canton.network/u/SamirTalwar)\
**Post date:** [September 25, 2020, 12:55pm UTC](https://forum.canton.network/t/parse-error-in-pattern-exercise-possibly-caused-by-a-missing-do/1301/2 "2020-09-25T12:55:20Z")

</div>

You’ll need to run getTime on a separate line. Something like:

```haskell
submit associate do
  currentTime <- getTime
  exercise asid PunchIn with currentTime

```

I don’t think you can use \<- syntax in a with block like that. I do think we need a better error message, but unfortunately I expect this is part of GHC and therefore we have limited ability to change it.

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [September 25, 2020, 6:28pm UTC](https://forum.canton.network/t/parse-error-in-pattern-exercise-possibly-caused-by-a-missing-do/1301/4 "2020-09-25T18:28:58Z")

</div>

Split this topic on September 25, 2020, 6:28pm UTC

A post was merged into an existing topic: [Error: Attempt to fetch or exercise a contract not visible to the committer](https://forum.canton.network/t/error-attempt-to-fetch-or-exercise-a-contract-not-visible-to-the-committer/1304/6)
