# PC SDK - Setting Program Pointer

**URL:** <https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161>\
**Category:** Developer Tools\
**Created:** [May 5, 2011, 7:08am UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161 "2011-05-05T07:08:42Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![djperala](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@djperala](https://tech-community.robotics.abb.com/u/djperala)\
**Post date:** [May 5, 2011, 7:08am UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/1 "2011-05-05T07:08:42Z")

</div>

hello

my thesis presentation is due in the next few days so if anyone can help me it would be greatly greatly appreciated.

i need to set the program pointer.  
i am using [VB.net](http://VB.net) to program with PC SDK.

| |   
SetProgramPointer  
 |   
Sets program pointer to the first instruction of a routine (global or local).  
 |
| --- | --- | --- |

in the PC SDK help reference file it shows SetProgramPointer as a member of Task.However when i try to do this in Visual Studio it does not come up as an option.

is it possible to do using VB?  
and second question if it cant be set, my current program pointer is set at main, so if i edit the routine main it would kinda do what i want anyway.  
How do you edit an entire routine?

please if anyone can help i have spent weeks trying to get this working.

---

<div class="post-metadata">

**Author:** ![sozdemir](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@sozdemir](https://tech-community.robotics.abb.com/u/sozdemir)\
**Post date:** [May 17, 2011, 4:44pm UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/2 "2011-05-17T16:44:26Z")

</div>

Hi,  
I managed to change the program pointer by this way (in C#):

control.Logon(UserInfo.DefaultUser);  
Mastership master;  
master = Mastership.Request(control.Rapid);  
Task task;  
task = control.Rapid.GetTask(“T\_ROB1”);  
task.SetProgramPointer(“MainModule”, “urunvar”);  
control.Rapid.Start();  
control.Logoff();

this code changes the pointer to the proc named “urunVar”. Instead of editing entire routine i wrote a proc to do what i want.  
Hope this helps,  
Best

---

<div class="post-metadata">

**Author:** ![John\_Wiberg](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/john_wiberg/32/1485_2.png) [@John\_Wiberg](https://tech-community.robotics.abb.com/u/John_Wiberg)\
**Post date:** [May 30, 2011, 3:34pm UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/3 "2011-05-30T15:34:42Z")

</div>

In this reply I’m using the “Create a simple PC SDK application” from the PC SDK Application Manual as the base. Its in the “Using the PC SDK” chapter.  
So to paste this in you need to follow the basic instruction from there first. You need a Button1 and a Button2 as well.

You need a main and a Path\_20 proc in the controller, preferably with different actions so that you can see which is run.

Steps;  
Start controller  
Start app  
doubleclick controller  
click the buttons

> [@](#):
>
> Imports ABB.Robotics  
> Imports ABB.Robotics.Controllers  
> Imports ABB.Robotics.Controllers.Discovery  
> Imports ABB.Robotics.Controllers.RapidDomain
> 
> Public Class Form1  
> Private scanner As NetworkScanner = Nothing  
> Private controller As Controller = Nothing  
> Private tasks As Task() = Nothing  
> Private networkWatcher As NetworkWatcher = Nothing
> 
> Public Sub New()  
> ’ This call is required by the Windows Form Designer.  
> InitializeComponent()  
> ’ Add any initialization after the InitializeComponent() call.  
> Button1.Enabled = False  
> Button2.Enabled = False  
> Me.scanner = New NetworkScanner  
> Me.scanner.Scan()  
> Dim controllers As ControllerInfoCollection = Me.scanner.Controllers  
> Dim controllerInfo As ControllerInfo = Nothing  
> Dim item As ListViewItem  
> For Each controllerInfo In controllers  
> item = New ListViewItem(controllerInfo.IPAddress.ToString())  
> item.SubItems.Add(controllerInfo.Id)  
> item.SubItems.Add(controllerInfo.Availability.ToString())  
> item.SubItems.Add(controllerInfo.IsVirtual.ToString())  
> item.SubItems.Add(controllerInfo.SystemName)  
> item.SubItems.Add(controllerInfo.Version.ToString())  
> item.SubItems.Add(controllerInfo.ControllerName)  
> Me.ListView1.Items.Add(item)  
> item.Tag = controllerInfo  
> Next  
> Me.networkWatcher = New NetworkWatcher(Me.scanner.Controllers)  
> AddHandler Me.networkWatcher.Found, AddressOf Me.HandleFoundEvent  
> 'AddHandler Me.networkWatcher.Lost, AddressOf Me.HandleLostEvent  
> Me.networkWatcher.EnableRaisingEvents = True  
> End Sub  
> Private Sub HandleFoundEvent(ByVal sender As Object, ByVal e As NetworkWatcherEventArgs)  
> Me.Invoke(New EventHandler(Of NetworkWatcherEventArgs)(AddressOf AddControllerToListView), New Object {Me, e})  
> End Sub  
> Private Sub AddControllerToListView(ByVal sender As Object, ByVal e As NetworkWatcherEventArgs)  
> Dim controllerInfo As ControllerInfo = e.Controller  
> Dim item As New ListViewItem(controllerInfo.IPAddress.ToString())  
> item.SubItems.Add(controllerInfo.Id)  
> item.SubItems.Add(controllerInfo.Availability.ToString())  
> item.SubItems.Add(controllerInfo.IsVirtual.ToString())  
> item.SubItems.Add(controllerInfo.SystemName)  
> item.SubItems.Add(controllerInfo.Version.ToString())  
> item.SubItems.Add(controllerInfo.ControllerName)  
> Me.listView1.Items.Add(item)  
> item.Tag = controllerInfo  
> End Sub  
> Private Sub ListView1\_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseDoubleClick  
> Dim item As ListViewItem = Me.ListView1.SelectedItems(0)  
> If item.Tag IsNot Nothing Then  
> Dim controllerInfo As ControllerInfo = DirectCast(item.Tag, ControllerInfo)  
> Button1.Enabled = True  
> Button2.Enabled = True  
> If controllerInfo.Availability = ABB.Robotics.Controllers.Availability.Available Then  
> If Me.controller IsNot Nothing Then  
> Me.controller.Logoff()  
> Me.controller.Dispose()  
> Me.controller = Nothing  
> End If  
> Me.controller = ControllerFactory.CreateFrom(controllerInfo)  
> Me.controller.Logon(UserInfo.DefaultUser)  
> Else  
> MessageBox.Show(“Selected controller not available.”)  
> End If  
> End If  
> End Sub  
> Private Sub Button1\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click  
> Try  
> If controller.OperatingMode = ControllerOperatingMode.Auto Then  
> tasks = controller.Rapid.GetTasks()  
> Using m As Mastership = Mastership.Request(controller.Rapid)  
> 'Perform operation  
> tasks(0).SetProgramPointer(“Module1”, “main”)  
> tasks(0).Start()  
> End Using  
> Else  
> MessageBox.Show(“Automatic mode is required to start execution from a remote client.”)  
> End If  
> Catch ex As System.InvalidOperationException  
> MessageBox.Show(“Mastership is held by another clizaccent.” & ex.Message)  
> Catch ex As System.Exception  
> MessageBox.Show("Unexpected error occurred: " & ex.Message)  
> End Try  
> End Sub  
> Private Sub Button2\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click  
> Try  
> If controller.OperatingMode = ControllerOperatingMode.Auto Then  
> tasks = controller.Rapid.GetTasks()  
> Using m As Mastership = Mastership.Request(controller.Rapid)  
> 'Perform operation  
> tasks(0).SetProgramPointer(“Module1”, “Path\_20”)  
> tasks(0).Start()  
> End Using  
> Else  
> MessageBox.Show(“Automatic mode is required to start execution from a remote client.”)  
> End If  
> Catch ex As System.InvalidOperationException  
> MessageBox.Show(“Mastership is held by another clizaccent.” & ex.Message)  
> Catch ex As System.Exception  
> MessageBox.Show("Unexpected error occurred: " & ex.Message)  
> End Try  
> End Sub  
> End Class

---

<div class="post-metadata">

**Author:** ![John\_Wiberg](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/john_wiberg/32/1485_2.png) [@John\_Wiberg](https://tech-community.robotics.abb.com/u/John_Wiberg)\
**Post date:** [May 30, 2011, 3:35pm UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/4 "2011-05-30T15:35:44Z")

</div>

As you can see I’m using this to move the PP and start execution:  
tasks = controller.Rapid.GetTasks()  
Using m As Mastership = Mastership.Request(controller.Rapid)  
'Perform operation  
tasks(0).SetProgramPointer(“Module1”, “Path\_20”)  
tasks(0).Start()  
End Using

---

<div class="post-metadata">

**Author:** ![djperala](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@djperala](https://tech-community.robotics.abb.com/u/djperala)\
**Post date:** [June 9, 2011, 9:57am UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/5 "2011-06-09T09:57:39Z")

</div>

john thank you for the help.  
this has been a great help, it allowed me to see there was a problem with my system setup.

i worked out the problem i had the whole time, when my mentor was trying to fix another problem he reset all my rab libraries back to version 10. This has been behind alot of my other problems.

i have now learnt not to listen to my mentor 😉

thank you again for the help and speedy reply.

---

<div class="post-metadata">

**Author:** ![John\_Wiberg](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/john_wiberg/32/1485_2.png) [@John\_Wiberg](https://tech-community.robotics.abb.com/u/John_Wiberg)\
**Post date:** [June 9, 2011, 10:10am UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/6 "2011-06-09T10:10:11Z")

</div>

Glad to be of service.  
👍

---

<div class="post-metadata">

**Author:** ![doc-zee](https://avatars.discourse-cdn.com/v4/letter/d/f1d935/32.png) [@doc-zee](https://tech-community.robotics.abb.com/u/doc-zee)\
**Post date:** [September 20, 2011, 4:41am UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/7 "2011-09-20T04:41:35Z")

</div>

Hi,John!  
Maybe there is a problem here.On one controller maybe there are different modules,but it can only be one ‘MAIN’,and if i want to give a “main routine”,i should give it another name,like "main 1""main 2"“main 3”… so how can i know the routine name of a module(i want click a button to choose a ".mod"file,and then the vc perform it,so i want the pc get a name by some program)?

---

<div class="post-metadata">

**Author:** ![John\_Wiberg](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/john_wiberg/32/1485_2.png) [@John\_Wiberg](https://tech-community.robotics.abb.com/u/John_Wiberg)\
**Post date:** [September 20, 2011, 9:17am UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/8 "2011-09-20T09:17:15Z")

</div>

Hi doc-zoo,

I am sorry, I have problems understanding what exactly you want in most of your responses, including this one. Maybe it would be easier if you posted code and showed what your issue is?  
In my example above you can just change the line  
tasks(0).SetProgramPointer(“Module1”, “Path\_20”)  
to whichever module and routine you want. So what they are called does not matter.

How to load a module using the PC SDK is described in the Application manual  
“Using the PC SDK - Rapid domain  
Working with RAPID modules and programs”  
How to search for specific procedures is described in  
“Using the PC SDK - Rapid domain  
RAPID symbol search”

If you want to know which PROC a .mod file contains before loading it you can just open it like a text file and parse through it to find all PROCs.

:question:

---

<div class="post-metadata">

**Author:** ![doc-zee](https://avatars.discourse-cdn.com/v4/letter/d/f1d935/32.png) [@doc-zee](https://tech-community.robotics.abb.com/u/doc-zee)\
**Post date:** [September 20, 2011, 9:43am UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/9 "2011-09-20T09:43:43Z")

</div>

hi,John!  
Maybe there is a problem when i expressed myself.The code like this:  
OpenFileDialog openFileDialog1 = new OpenFileDialog();  
openFileDialog1.Filter = “Mod Files (.mod)|_.mod|All Files (_._)|_.\*”;  
openFileDialog1.FilterIndex = 1;  
string text1 = openFileDialog1.FileName;  
if (openFileDialog1.ShowDialog() == DialogResult.OK)  
{  
FileInfo filename = new FileInfo(openFileDialog1.FileName);  
string fn = filename.Name;  
this.master = Mastership.Request(controller.Rapid);  
…  
…  
tasks(0).SetProgramPointer(“Module1”, “???”)  
tasks(0).Start()

}  
what should i do here"???"

---

<div class="post-metadata">

**Author:** ![doc-zee](https://avatars.discourse-cdn.com/v4/letter/d/f1d935/32.png) [@doc-zee](https://tech-community.robotics.abb.com/u/doc-zee)\
**Post date:** [September 21, 2011, 3:51am UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/10 "2011-09-21T03:51:55Z")

</div>

tasks(0).SetProgramPointer(openFileDialog1.FileName??O"???")  
tasks(0).Start()

---

<div class="post-metadata">

**Author:** ![John\_Wiberg](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/john_wiberg/32/1485_2.png) [@John\_Wiberg](https://tech-community.robotics.abb.com/u/John_Wiberg)\
**Post date:** [September 21, 2011, 10:41am UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/11 "2011-09-21T10:41:30Z")

</div>

WARNING!  
The way you do that in your code is VERY dangerous. You allow the user to select ANY procedure, regardless of where the robot arm is. That means that you have no control on what the robot actually will do. The user could even mistakenly select the wrong procedure which could lead to damages and injuries.  
You have no way to control which module is loaded and which procedure is selected, I would rethink that design.  
WARNING!

But I already told you how to do it; Read The Fantastic Manual  
[QUOTE=John Wiberg]How to search for specific procedures is described in  
“Using the PC SDK - Rapid domain  
RAPID symbol search”[/QUOTE] If you need to know the names of procedures you use the SearchRapidSymbol function.

Continuing on the example above, you need to add two listboxes and two more buttons.  
Steps;  
Start controller  
Start app  
doubleclick controller  
click button3 to list modules in listbox1  
select a module name in listbox1  
click button4 to list procedures in listbox2

[code] Private Sub Button3\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click  
ListBox1.Items.Clear()  
Dim sProp As RapidSymbolSearchProperties = RapidSymbolSearchProperties.CreateDefault()  
sProp.Types = SymbolTypes.Module  
tasks = controller.Rapid.GetTasks()  
Dim rsCol As RapidSymbol()  
rsCol = tasks(0).SearchRapidSymbol(sProp, String.Empty)  
If rsCol.Count = 0 Then  
ListBox1.Items.Add(“Not found”)  
Return  
Else  
Dim rs As RapidSymbol  
For Each rs In rsCol  
ListBox1.Items.Add(rs.Name)  
Next  
End If  
End Sub

Private Sub Button4\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click  
ListBox2.Items.Clear()  
If ListBox1.SelectedItem = “” Then  
ListBox2.Items.Add(“No module selected in ls1”)  
Else  
Dim sProp As RapidSymbolSearchProperties = RapidSymbolSearchProperties.CreateDefault()  
sProp.Types = SymbolTypes.Procedure  
tasks = controller.Rapid.GetTasks()  
Dim selModule As ABB.Robotics.Controllers.RapidDomain.Module  
selModule = tasks(0).GetModule(ListBox1.SelectedItem.ToString)  
Dim rsCol As RapidSymbol()  
rsCol = selModule.SearchRapidSymbol(sProp, String.Empty)  
If rsCol.Count = 0 Then  
ListBox2.Items.Add(“Not found”)  
Return  
Else  
Dim rs As RapidSymbol  
For Each rs In rsCol  
ListBox2.Items.Add(rs.Name)  
Next  
End If  
End If  
End Sub[/code]

---

<div class="post-metadata">

**Author:** ![John\_Wiberg](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/john_wiberg/32/1485_2.png) [@John\_Wiberg](https://tech-community.robotics.abb.com/u/John_Wiberg)\
**Post date:** [September 21, 2011, 10:43am UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/12 "2011-09-21T10:43:41Z")

</div>

Please note that in my example above it lists both system modules and program modules. In your code you load a module so then you should take the module name and just list for that directly.

---

<div class="post-metadata">

**Author:** ![doc-zee](https://avatars.discourse-cdn.com/v4/letter/d/f1d935/32.png) [@doc-zee](https://tech-community.robotics.abb.com/u/doc-zee)\
**Post date:** [September 26, 2011, 11:07am UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/13 "2011-09-26T11:07:17Z")

</div>

Hi,John!  
First thanks a lot for your help ,it helps me a lot!But there is a new problem in my code.  
when i write the code like this:  
…  
tasks[0].SetProgramPointer(listBox1.SelectedItem.ToString(),listBox2.SelectedItem.ToString());  
tasks[0].Start();  
.. …  
there`s an erro like this:  
“SetProgramPointer” is not defined in the"ABB.Robotics.Controllers.RapidDomain.Task"  
In chinese like this:  
"?“T?\_\_ 4 ?_oABB.Robotics.Controllers.RapidDomain.Task?\_\_?1??,_?O.?\_??\_oSetProgramPointer?\_\_?s,?rs?1% F:ABB??-?”

---

<div class="post-metadata">

**Author:** ![John\_Wiberg](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/john_wiberg/32/1485_2.png) [@John\_Wiberg](https://tech-community.robotics.abb.com/u/John_Wiberg)\
**Post date:** [September 26, 2011, 11:19am UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/14 "2011-09-26T11:19:55Z")

</div>

Look at the top of the code, do you have  
using ABB.Robotics.Controllers.RapidDomain;  
Then look at the References, do they have a warning? Are they the correct version?

---

<div class="post-metadata">

**Author:** ![doc-zee](https://avatars.discourse-cdn.com/v4/letter/d/f1d935/32.png) [@doc-zee](https://tech-community.robotics.abb.com/u/doc-zee)\
**Post date:** [September 26, 2011, 11:47am UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/15 "2011-09-26T11:47:58Z")

</div>

I have using ABB.Robotics.Controllers.RapidDomain;  
and i have done the References, there are no warning, i don`t know whether they are the correct version.and can you give me the address to download it?My RS is 5.13.01

---

<div class="post-metadata">

**Author:** ![doc-zee](https://avatars.discourse-cdn.com/v4/letter/d/f1d935/32.png) [@doc-zee](https://tech-community.robotics.abb.com/u/doc-zee)\
**Post date:** [September 26, 2011, 12:02pm UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/16 "2011-09-26T12:02:18Z")

</div>

By the way,when i use "Reset Program Pointer ",there is no error .May be i use the wrong version

---

<div class="post-metadata">

**Author:** ![doc-zee](https://avatars.discourse-cdn.com/v4/letter/d/f1d935/32.png) [@doc-zee](https://tech-community.robotics.abb.com/u/doc-zee)\
**Post date:** [October 29, 2011, 10:00am UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/17 "2011-10-29T10:00:40Z")

</div>

Hi,John! Sorry to trouble you again.I have some problems trouble me a lot days.I copy a module and load it,then when i copy another module ,there`s error like:  
"  
Event Message  
Error in T\_ROB1-Line6  
Description  
Global routine name main ambiguous.  
Data for this message is not saved in any robot controller event log.  
If acknowledged the message will be removed.

Actions  
Global routine must have names that are unique among all the global types,data,global routines and modules in the entire program .Rename the routine or change the conflicting name.

"  
the c# code like this:

private void button7\_Click(object sender, EventArgs e)  
{  
string localDir = controller.FileSystem.LocalDirectory;  
string remoteDir = controller.FileSystem.RemoteDirectory;  
controller.FileSystem.RemoteDirectory = remoteDir ;  
controller.FileSystem.LocalDirectory = localDir + “/downmod/”;  
File.Copy(controller.FileSystem.LocalDirectory + “xadd.mod”, controller.FileSystem.RemoteDirectory + “xadd.mod”, true);

…}  
private void button4\_Click(object sender, EventArgs e)  
{  
runxadd();  
}  
public void runxadd()  
{  
string localDir = controller.FileSystem.LocalDirectory;  
string remoteDir = controller.FileSystem.RemoteDirectory;  
if (controller.OperatingMode == ControllerOperatingMode.Auto)  
{  
tasks = controller.Rapid.GetTasks();  
this.master = Mastership.Request(controller.Rapid);  
UserAuthorizationSystem uas = controller.AuthenticationSystem;  
if (uas.CheckDemandGrant(Grant.LoadRapidProgram))  
{  
tasks[0].LoadModuleFromFile(remoteDir + “xadd.mod”, RapidLoadMode.Replace);  
// RapidSymbolSearchProperties sProp1 = RapidSymbolSearchProperties.CreateDefault();  
// sProp1.Types = SymbolTypes.Procedure;  
// tasks = controller.Rapid.GetTasks();  
//Module selModule1 = tasks[0].GetModule(strmainname);  
//RapidSymbol rsCol1 = selModule1.SearchRapidSymbol(sProp1, string.Empty);  
tasks[0].ResetProgramPointer();  
tasks[0].Start();  
}  
//tasks[0].ResetProgramPointer();  
// this.master.Dispose();  
this.master.Dispose();  
}

---

<div class="post-metadata">

**Author:** ![doc-zee](https://avatars.discourse-cdn.com/v4/letter/d/f1d935/32.png) [@doc-zee](https://tech-community.robotics.abb.com/u/doc-zee)\
**Post date:** [October 29, 2011, 10:23am UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/18 "2011-10-29T10:23:09Z")

</div>

the module code like this:  
the"Module1.MOD"code like this:  
MODULE Module1  
CONST robtarget p10:=[[524.77,-968.58,952.68],[0.422439,-0.0807052,0.55852,-0.709286],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];  
CONST robtarget pHome:=[[113.55,-940.17,909.68],[0.394354,-0.0151111,0.0387188,-0.918018],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];  
CONST robtarget p30:=[[179.47,1049.78,948.14],[0.880088,-0.416906,0.074412,0.214701],[0,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];  
PROC main()  
rInitAll;  
rHome;  
rMoveRoutine;  
WaitTime 0.3;  
ENDPROC  
PROC rHome()  
MoveJ pHome, v7000, z50, tool0;  
ENDPROC  
PROC rInitAll()  
AccSet 100, 100;  
VelSet 100, 5000;  
ENDPROC  
PROC rMoveRoutine()  
MoveJ p10, v4000, z50, tool0;  
MoveJ p30, v4000, z50, tool0;  
ENDPROC  
ENDMODULE

the "xadd.mod"code like this:  
MODULE MainModule  
PROC main()  
VAR robtarget rob\_tar1;  
rob\_tar1:=CRobT();  
rob\_tar1:=Offs(rob\_tar1,30,0,0);  
MoveL rob\_tar1,v1000,z50,tool0;  
ENDPROC  
ENDMODULE

---

<div class="post-metadata">

**Author:** ![John\_Wiberg](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/john_wiberg/32/1485_2.png) [@John\_Wiberg](https://tech-community.robotics.abb.com/u/John_Wiberg)\
**Post date:** [October 31, 2011, 2:18pm UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/19 "2011-10-31T14:18:19Z")

</div>

`Event Message
Error in T_ROB1-Line6
Description
Global routine name main ambiguous.`  
This just means that in RAPID you are not allowed to have the PROC name “main” more than once. Its a reserved name.  
Just rename your “main” PROC to something else and you will be fine, since if you use it in two different modules at the same time, then its not really a “main” PROC anyway.

---

<div class="post-metadata">

**Author:** ![doc-zee](https://avatars.discourse-cdn.com/v4/letter/d/f1d935/32.png) [@doc-zee](https://tech-community.robotics.abb.com/u/doc-zee)\
**Post date:** [October 31, 2011, 2:25pm UTC](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161/20 "2011-10-31T14:25:07Z")

</div>

Because i can only use "ResetProgramPointer()"method that can only reset the pp to the “main”,i can`t use the "SetProgramPointer()"method. when i use "SetProgramPointer",there`s always problem i have ask you before.So can you tell me how can i solve it?

[Next page](https://tech-community.robotics.abb.com/t/pc-sdk-setting-program-pointer/4161.md?page=2)
