Examples - HEIDENHAIN TNC 620 User Manual

Klartext programming
Hide thumbs Also See for TNC 620:
Table of Contents

Advertisement

Programming Q parameters | Accessing tables with SQL statements

Examples

In the following example, the defined material is read from the table
(WMAT.TAB) and is stored as a text in a QS parameter. The following
example shows a possible application and the necessary program
steps.
You can use the FN 16 function, for example, in order to
reuse QS parameters in your own log files.
Further information: "Fundamentals", Page 297
Example: Use a synonym
0 BEGIN PGM SQL_READ_WMAT MM
1 SQL Q1800 "CREATE SYNONYM my_table FOR 'TNC:-
\table\WMAT.TAB'"
2 SQL BIND QS1800 "my_table.WMAT"
3 SQL QL1 "SELECT WMAT FROM my_table WHERE
NO==3"
4 SQL FETCH Q1900 HANDLE QL1
5  SQL ROLLBACK Q1900 HANDLE QL1
6 SQL BIND QS1800
7 SQL Q1 "DROP SYNONYM my_table"
8 END PGM SQL_READ_WMAT MM
Step
Explanation
1 Create
Assign a synonym to a path (replace long paths with short names)
synonym
The path TNC:\table\WMAT.TAB is always placed in single quotes
The selected synonym is my_table
2 Bind QS
Bind a QS parameter to a table column
parameters
QS1800 is freely available in NC programs
The synonym replaces the entry of the complete path
The defined column from the table is called WMAT
3 Define search
A search definition contains the entry of the transfer value
The QL1 local parameter (freely selectable) serves to identify the transaction (multiple
transactions are possible simultaneously)
The synonym defines the table
The WMAT entry defines the table column of the read operation
The entries NR and ==3 define the table rows of the read operation
Selected table columns and rows define the cells of the read operation
4 Execute search
The control performs the read operation
SQL FETCH copies the values from the result set into the bound Q or QS parameter
The syntax HANDLE QL1 is the transaction designated by the parameter QL1
The parameter Q1900 is a return value for checking whether the data have been read
5 Complete trans-
The transaction is concluded and the used resources are released
action
HEIDENHAIN | TNC 620 | Klartext Programming User's Manual | 01/2022
0 successful read operation
1 faulty read operation
Create synonym
Bind QS parameters
Define search
Execute search
Complete transaction
Remove parameter binding
Delete synonym
9
349

Advertisement

Table of Contents
loading

This manual is also suitable for:

Tnc 620 eTnc 620 programming station

Table of Contents