3.1.4.5 Determine length of string (STRLEN) ..................................................................................451
3.1.4.6 Search for character/string in the string (INDEX, RINDEX, MINDEX, MATCH) ..................452
3.1.4.7 Selection of a substring (SUBSTR)......................................................................................453
3.1.4.8 Reading and writing of individual characters........................................................................454
3.1.4.9 Formatting a string (SPRINT)...............................................................................................455
3.1.5 Program jumps and branches ..............................................................................................463
3.1.5.1 Return jump to the start of the program (GOTOS)...............................................................463
3.1.5.2 Program jumps to jump markers (GOTOB, GOTOF, GOTO, GOTOC) ...............................464
3.1.5.3 Program branch (CASE ... OF ... DEFAULT ...)...................................................................467
3.1.6 Repeat program section (REPEAT, REPEATB, ENDLABEL, P) .........................................468
3.1.7 Check structures ..................................................................................................................474
3.1.7.1 Conditional statement and branch (IF, ELSE, ENDIF).........................................................476
3.1.7.2 Continuous program loop (LOOP, ENDLOOP)....................................................................477
3.1.7.3 Count loop (FOR ... TO ..., ENDFOR)..................................................................................478
3.1.7.4 Program loop with condition at start of loop (WHILE, ENDWHILE) .....................................479
3.1.7.5 Program loop with condition at the end of the loop (REPEAT, UNTIL)................................480
3.1.7.6 Program example with nested check structures ..................................................................481
3.1.8 Cross-channel program coordination (INIT, START, WAITM, WAITMC, WAITE, SETM,
CLEARM) .............................................................................................................................481
3.1.9 Macro technique (DEFINE ... AS) ........................................................................................487
3.2 Subprogram technique.........................................................................................................490
3.2.1 General information..............................................................................................................490
3.2.1.1 Subprogram .........................................................................................................................490
3.2.1.2 Subprogram names..............................................................................................................491
3.2.1.3 Nesting of subprograms .......................................................................................................492
3.2.1.4 Search path..........................................................................................................................493
3.2.1.5 Formal and actual parameters .............................................................................................493
3.2.1.6 Parameter transfer ...............................................................................................................494
3.2.2 Definition of a subprogram ...................................................................................................496
3.2.2.1 Subprogram without parameter transfer ..............................................................................496
3.2.2.2 Subprogram with call-by-value parameter transfer (PROC) ................................................496
3.2.2.3 Subprogram with call-by-reference parameter transfer (PROC, VAR) ................................498
3.2.2.4 Save modal G functions (SAVE) ..........................................................................................500
3.2.2.5 Suppress single block execution (SBLOF, SBLON) ............................................................501
3.2.2.6 Suppress current block display (DISPLOF, DISPLON, ACTBLOCNO) ...............................506
3.2.2.7 Identifying subprograms with preparation (PREPRO)..........................................................509
3.2.2.8 Subprogram return M17 .......................................................................................................510
3.2.2.9 RET subprogram return .......................................................................................................511
3.2.2.10 Parameterizable subprogram return jump (RET ...) .............................................................512
3.2.2.11 Parameterizable subprogram return jump (RETB ...)...........................................................518
3.2.3 Subprogram call ...................................................................................................................522
3.2.3.1 Subprogram call without parameter transfer ........................................................................522
3.2.3.2 Subprogram call with parameter transfer (EXTERN) ...........................................................524
3.2.3.3 Number of program repetitions (P).......................................................................................526
3.2.3.4 Modal subprogram call (MCALL) .........................................................................................527
3.2.3.5 Indirect subprogram call (CALL) ..........................................................................................529
3.2.3.6 Indirect subprogram call with specification of the calling program part (CALL BLOCK ...
TO ...) ...................................................................................................................................530
3.2.3.7 Indirect call of a program programmed in ISO language (ISOCALL)...................................531
3.2.3.8 Call subprogram with path specification and parameters (PCALL)......................................532
3.2.3.9 Extend search path for subprogram calls (CALLPATH).......................................................533
3.2.3.10 Execute external subroutine (EXTCALL) .............................................................................534
Table of contents
NC programming
12 Programming Manual, 12/2019, 6FC5398-2EP40-0BA0