Example

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.

 
Tip

You can use the FN 16 function, for example, in order to reuse QS parameters in your own log files.

NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.

Change the following contents as needed:

  • Tools
  • Cutting parameters
  • Feed rates
  • Clearance height or safe position
  • Machine-specific positions (e.g., with M91)
  • Paths of program calls

Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.

In addition, test the NC programs using the simulation before the actual program run.

 
Tip

With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.

Use synonym

0 BEGIN PGM SQL_READ_WMAT MM

1 SQL Q1800 "CREATE SYNONYM my_table FOR 'TNC:­\table­\WMAT.TAB'"

; Create synonym

2 SQL BIND QS1800 "my_table.WMAT"

; Bind QS parameters

3 SQL QL1 "SELECT WMAT FROM my_table WHERE NR==3"

; Define search

4 SQL FETCH Q1900 HANDLE QL1

; Execute search

5  SQL ROLLBACK Q1900 HANDLE QL1

; Complete transaction

6 SQL BIND QS1800

; Remove parameter binding

7 SQL Q1 "DROP SYNONYM my_table"

; Delete synonym

8 END PGM SQL_READ_WMAT MM

Step

Explanation

1

Create synonym

Assign a synonym to a path (replace long paths with short names)

  • The path TNC:­\table­\WMAT.TAB is always placed in single quotes
  • The selected synonym is my_table

2

Bind QS parameters

Bind a QS parameter to a table column

  • 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
    • 0 successful read operation
    • 1 faulty read operation
  • 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 transaction

The transaction is concluded and the used resources are released

6

Remove binding

The binding between table columns and QS parameters is removed (release of necessary resources)

7

Delete synonym

The synonym is deleted (release of necessary resources)

 
Tip

Synonyms are an alternative only to the required absolute paths. Relative path entries are not possible.

The following NC program shows the entry of an absolute path.

NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.

Change the following contents as needed:

  • Tools
  • Cutting parameters
  • Feed rates
  • Clearance height or safe position
  • Machine-specific positions (e.g., with M91)
  • Paths of program calls

Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.

In addition, test the NC programs using the simulation before the actual program run.

 
Tip

With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.

0  BEGIN PGM SQL_READ_WMAT_2 MM

1  SQL BIND QS 1800 "'TNC:­\table­\WMAT.TAB'.WMAT"

; Bind QS parameters

2  SQL QL1 "SELECT WMAT FROM 'TNC:­\table­\WMAT.TAB' WHERE NR ==3"

; Define search

3  SQL FETCH Q1900 HANDLE QL1

; Execute search

4  SQL ROLLBACK Q1900 HANDLE QL1

; Complete transaction

5  SQL BIND QS 1800

; Remove parameter binding

6  END PGM SQL_READ_WMAT_2 MM