Oh boy....that is a lot of explanations. Sinha.....I think he needs your book!!!
First off welcome to the forum.
Second I have to say I do not know what the *** are for in your code and how this would even logicly function.
GE means “Greater than or Equal To”
GT means “Greater Than”
LT means “Less Than”
GOTO means “Go To”
What you are seeing in your program with #19 or any other #() are variables. These variables hold values that that the program specifies. As an example if you were to program #19=5 and then go look at your variable settings thru the settings screen you will find that #19 is equal to 5. Now if you were to program a G0X#19 it would be like programming G0X5 because #19 is set to 5
This is really just skimming the surface of macroB programming.
Now the GE, GT, LT, GOTO, WHILE…DO statements are all conditions of the program and are read really as explained above. What you posted is not a complete program as the conditions at the beginning have no address to go to if they prove true. Lets use the following code as an example of what this means.
In the first 2 lines macro variable #19 is being set =5 and #20 is being set =2. The IF statement is saying If #19 is equal to 5 got to address N100. In this program #19 is set equal to 5 so the IF statement is true and the program will skip everything else and go directly to address N100 and read M30 and end the program. If you were to change #19 to be say 4 then the IF statement will be false and will not go to N100 and instead read the next line of G0X#2 which is G0X2 and continue on to the N100M30 and end your program.
You basically have to substitute your #() numbers for what the value of them are. When the program runs and #20=5 and your line of code is G0X#20 once it reads this line it will take the #20 and make it 5 reading G0X5
WHILE statements are more tricky and if you do not grasp what is posted above you will have a tuff time understanding what this means until you do.
What the WHILE statement does is run between the WHILE and DO until the WHILE statement is true. So the above code sets #19=0 then jumps into the loop. #19=0 so it will move the X 1” at the G0G91X1. Line and then read #19=#19+1 which we know it was =0 and now it adds 1 to the value making #19=1 but the WHILE statement is not satisfied because it is still less than (LT) 5. So it will go back to the G0G91X1. Line moving the machine again and then reading #19=#19+1. #19 in the last run thru was =1 so now it is equal to itself +1 which makes it =2 and once again not satisfying the WHILE statement because #19 is still less than 5. This will keep adding until #19 is no longer less than 5 and once that happens it will leave the loop and go to the block directly after the END1 line which is M30 ending your program.
The G91G10L2P3 is setting a workcoordinate. G10 is the code to do theis, L2 is the registry of the workcoordinate and the P3 is the coordinate number which is G56 so if you program G91G10L2P3X2. It will add 2 to the X value in G56 now it is using #5 so if #5 is =2 it will do the same thing. To explain G10…if you were to useP2 instead it would set G55 and P1 would be G54. L2 means to change the coordinate but you can use a different L() to change tool offsets or parameters.
Hope this helps.