# Checking A Routine Exists

**URL:** <https://tech-community.robotics.abb.com/t/checking-a-routine-exists/4902>\
**Category:** Robot Controller\
**Created:** [May 31, 2012, 7:25pm UTC](https://tech-community.robotics.abb.com/t/checking-a-routine-exists/4902 "2012-05-31T19:25:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul33](https://avatars.discourse-cdn.com/v4/letter/p/5f8ce5/32.png) [@Paul33](https://tech-community.robotics.abb.com/u/Paul33)\
**Post date:** [May 31, 2012, 7:25pm UTC](https://tech-community.robotics.abb.com/t/checking-a-routine-exists/4902/1 "2012-05-31T19:25:15Z")

</div>

Hello,

I’m programming an IRC5.14.03 robot which asks the operator what part they wish to process within the cell. After the operator inputs the part name, eg 101-028, the RAPID coding changes the name and runs routine Prt\_101\_028. The problem is that the operator could type the name incorrectly and so the robot would fail trying to run a routine which doesn’t exists.

The routine name (Prt\_101\_028) is held in string %stRoutineName%. The robot is able to process above 500 parts.

I’m looking for a method which checks for the existance of the routine before trying to run it. If the routine doesn’t exists then the robot simply asks for the part name again.

Is there anyway to check within the RAPID coding if routine %stRoutineName% exists within the system?

BR  
Paul

---

<div class="post-metadata">

**Author:** ![Paul33](https://avatars.discourse-cdn.com/v4/letter/p/5f8ce5/32.png) [@Paul33](https://tech-community.robotics.abb.com/u/Paul33)\
**Post date:** [June 1, 2012, 7:58pm UTC](https://tech-community.robotics.abb.com/t/checking-a-routine-exists/4902/2 "2012-06-01T19:58:11Z")

</div>

Hello,

Never mind guys, all sorted…solution:

ERROR

IF ERRNO = ERR\_REFUNKPRC THEN  
…Ask Operator for new part name  
TRYNEXT;  
ENDIF

BR  
Paul T

---

<div class="post-metadata">

**Author:** ![janieblue1](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@janieblue1](https://tech-community.robotics.abb.com/u/janieblue1)\
**Post date:** [June 7, 2012, 9:36pm UTC](https://tech-community.robotics.abb.com/t/checking-a-routine-exists/4902/3 "2012-06-07T21:36:40Z")

</div>

thanks for this.. I have the same problem. I will try this.
