Master CNC
Blog · 5 min read · 26 Oct 2026

Okuma OSP User Task 2: variables and IF

Okuma's answer to Fanuc Macro B is User Task. User Task 1 gives you variables, maths and jumps; User Task 2 adds more, such as system variables for offsets and positions and maths functions. The ideas are the same as on Fanuc; the spelling is different.

Variables

  • Common variables: VC1, VC2 … shared by all programs. The number available depends on the control.
  • Local variables: your own short names (letters) used inside one program.
  • System variables (User Task 2): names for machine data, for example zero offsets and tool offsets.
Okuma User Task: VC common variables, IF jump to a sequence name, GOTO, system variables
Variables, maths and jumps, Okuma style.

Maths and jumps

VC1 = VC1 + 1
VC2 = [VC1 * 2] + 5
IF [VC1 GE 50] N900
GOTO N100

Square brackets group the maths. IF [condition] N900 jumps to the block with that sequence name when the condition is true. Comparisons use EQ, NE, GT, GE, LT and LE, like Fanuc.

Example: a part counter

VC10 = VC10 + 1
IF [VC10 LT 50] N100
VC10 = 0
M00 (CHANGE INSERT - 50 PARTS)
N100 M02

The program stops every 50 parts for an insert change. Choose a VC number that no other program or the machine builder uses.

System variables

With User Task 2 a program can read and write data like zero offsets and tool offsets, for example to apply an automatic wear correction. Okuma uses names such as VZOF… for zero offsets and VTOF… for tool offsets, with the axis and number in the name or index. The exact names, and which ones are available, depend on the OSP model, lathe or machining centre, and options: use the User Task manual for your machine before writing to any of them.

Compared with Fanuc Macro B

IdeaFanuc Macro BOkuma User Task
Common variable#100, #500VC1, VC2 …
Jump ifIF [ … ] GOTO 100IF [ … ] N100
LoopWHILE … DO1 / END1Built with IF and GOTO
SubprogramM98 / G65CALL O… / RTS

See Fanuc Macro B basics for the Fanuc side.

Common mistakes

  1. Copying Fanuc # variables into an Okuma program.
  2. Writing to a system variable without knowing exactly what it changes.
  3. Using a VC number already used by a probe or builder program.

User Task availability and syntax vary between OSP versions. Test new logic with the machine locked or in graphics first.

Try it in Master CNC

Calculators, process sheet to program, simulation, codes and lessons. Free to start, no sign-in, on phone and laptop.

Open the app