# How to check if  i am in debug mode of Q session.

**URL:** <https://forum.kx.com/t/how-to-check-if-i-am-in-debug-mode-of-q-session/9407>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [January 21, 2015, 5:32pm UTC](https://forum.kx.com/t/how-to-check-if-i-am-in-debug-mode-of-q-session/9407 "2015-01-21T17:32:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhoonjhar](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@jhoonjhar](https://forum.kx.com/u/jhoonjhar)\
**Post date:** [January 21, 2015, 5:32pm UTC](https://forum.kx.com/t/how-to-check-if-i-am-in-debug-mode-of-q-session/9407/1 "2015-01-21T17:32:00Z")

</div>

I am new to kdb. and using sometimes q session thruws exceptions when i try to execute some queries. where the connection is already open from last day (more then 24 hours.). during my function writing i get an experience if some function threw error that create a } at console something like&nbsp;  
q}} which is like in debug mode. i am using C# interface to work with kdb+.&nbsp;

when error comes in console.&nbsp;

* * *

'type

@

-1

(“A”;“p”;“p”;“r”;“o”;“v”;“e”;“d”;“:”;" ";“10000”)

q)) // in debug mode.

The question is how whould i know if i am already in debug mode. of Q session. ?

Thanks

J S

---

<div class="post-metadata">

**Author:** ![sohagan](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@sohagan](https://forum.kx.com/u/sohagan)\
**Post date:** [January 21, 2015, 5:53pm UTC](https://forum.kx.com/t/how-to-check-if-i-am-in-debug-mode-of-q-session/9407/2 "2015-01-21T17:53:00Z")

</div>

Hi,

FYI - [http://code.kx.com/wiki/Startingkdbplus/qlanguage#2.4\_Console\_Modes&nbsp](http://code.kx.com/wiki/Startingkdbplus/qlanguage#2.4%5C_Console%5C_Modes&nbsp);

When a function breaks it goes into debug mode. One way you can check if you are in debug mode of a function, is by asking if .z.s is null.

e.g.

q)f:{2+`a}

q)f

{2+`a}

'type

- 

2

`a

q)).z.s

{2+`a}

q))if[not null .z.s;0N!"you are in debug mode of ",string .z.s]

“you are in debug mode of {2+`a}”

More advanced usage here - [http://www.kdbfaq.com/kdb-faq/tag/zs](http://www.kdbfaq.com/kdb-faq/tag/zs)

HTH,

Sean

---

<div class="post-metadata">

**Author:** ![jhoonjhar](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@jhoonjhar](https://forum.kx.com/u/jhoonjhar)\
**Post date:** [January 21, 2015, 9:04pm UTC](https://forum.kx.com/t/how-to-check-if-i-am-in-debug-mode-of-q-session/9407/3 "2015-01-21T21:04:00Z")

</div>

Thanks Sean.
