Precedence rules  Using other options

Chapter 6: Using Service Name Redirection

The snrfck validation utility

Sybase provides a validation utility called snrfck that lets you validate the format of the service name redirection file.


Using the basic command

The snrfck basic command requires only the -i option. When you use this option, snrfck reads the redirection file, validates each line, and flags the first incorrect line it encounters.

For example, suppose you enter:

snrfck -ic:\cfg\testfile

where:

NoteThe path cfg\testfile is shown as a PC-based system in this example and in the remainder of the examples in this chapter.

Next, assume the redirection file contains the entries shown in the following table:

Table 6-4: Example of a redirection file with a duplicate entry

requested_service

user_id

application_ name

assigned_service

AS400

Bob

isql

as1

AS400

*

isql

as2

AS400

Bob

isql

as2

AS400

*

Omni

omniA

AS400

*

Power Builder

powerB

DB2

*

Omni

db2omni

DB2

*

*

db2gen

<tab>

*

*

as2

In this example, snrfck returns:

c:\cfg\testfile: line3: duplicate/ambiguous row

If the file does not contain errors, the rows are sorted in the order used in the redirection operation and printed to the current window.

The following table shows an example of a correctly formatted access service name redirection file, as output by snrfck. The snrfck utility adds line numbers for clarity.

Table 6-5: Example of a correctly formatted redirection file

requested_service

user_id

application_name

assigned_service

1:

<tab>

root

ksh

svc_ksh

2:

db2

joe

isql

svc_db2a

3:

db2

jane

isql

svc_db2b

4:

db2

sonia

Omni

svc_db2c

5:

db2

ramon

Omni

svc_db2d

6:

db2

sven

*

svc_db2gen

7:

other

*

*

svc_other


Using specified values

You can test the redirection process by supplying values for requested_service, user_id, and application_name, subject to the following restrictions:

When you supply these values, snrfck displays the sorted entries and the assigned service to which the request would be directed.

For example, suppose you use the preceding sample file and enter the following:

snrfck -itestfile -Sdb2 -Ujane -Aisql

where:

You receive the match shown in the following table:

Table 6-6: Redirection file with an entry match

requested_service

user_id

application_name

assigned_service

1:

<tab>

root

ksh

svc_ksh

2:

db2

joe

isql

svc_db2a

3:

db2

jane

isql

svc_db2b

4:

db2

sonia

Omni

svc_db2c

5:

db2

ramon

Omni

svc_db2d

6:

db2

sven

*

svc_db2gen

7:

other

*

*

svc_other

The following is displayed:

assigned service for (db2,jane,isql): svc_db2b

If the service redirection comparison does not find a match, the value returned for assigned_service is simply the requested_service value.

For example, suppose you use the preceding sample file and enter:

snrfck -itestfile -Sdb2 -Uramon -Aisql

where:

You receive the failed entry match shown in the following table:

Table 6-7: Redirection file with failed entry match

requested_service

user_id

application_name

assigned_service

1:

<tab>

root

ksh

svc_ksh

2:

db2

joe

isql

svc_db2a

3:

db2

jane

isql

svc_db2b

4:

db2

sonia

Omni

svc_db2c

5:

db2

ramon

Omni

svc_db2d

6:

db2

sven

*

svc_db2gen

7:

other

*

*

svc_other

assigned service for (db2,ramon,isql): db2

The following is displayed:

assigned service for (db2,jane,isql): svc_db2b

Adding lines to a redirection file

You can add lines to the service name redirection file list by specifying the -t option.

When you use this option, snrfck displays the normal redirection file and prompts you to enter new lines consisting of “service,” “user,” “application,” and “assigned_service,” each separated by a tab character. The snrfck utility reads the lines, validates them, adds them to the output file, and displays the amended file.

For example, you use the preceding sample file and enter:

snrfck -itestfile -t -onewfile

where:

NoteIf you use -t without using -o, your additions are displayed but not saved.

You receive a file with instructions for adding lines, as shown in the following table:

Table 6-8: Redirection file with -t option

requested_service

user_id

application_name

assigned_service

1:

<tab>

root

ksh

svc_ksh

2:

db2

joe

isql

svc_db2a

3:

db2

jane

isql

svc_db2b

4:

db2

sonia

Omni

svc_db2c

5:

db2

ramon

Omni

svc_db2d

6:

db2

sven

*

svc_db2gen

7:

other

*

*

svc_other

The following is displayed:

Enter service name redirection file lines:
service<tab>user<tab>application<tab>assigned_service
end with '.' on line by itself
8:

Then, you add the following lines in response to the prompt (snrfck supplies the line numbers):

8: db2 rachel * svc_db2gen
9: .

The snrfck utility produces a new service name redirection file, as shown in the following table:

Table 6-9: Redirection file with new line added

requested_service

user_id

application_name

assigned_service

1:

<tab>

root

ksh

svc_ksh

2:

db2

joe

isql

svc_db2a

3:

db2

jane

isql

svc_db2b

4:

db2

sonia

Omni

svc_db2c

5:

db2

ramon

Omni

svc_db2d

6:

db2

sven

*

svc_db2gen

7:

db2

rachel

*

svc_db2gen

8:

other

*

*

svc_other

The snrfck utility adds the new entry and sorts the file.





Copyright © 2005. Sybase Inc. All rights reserved. Using other options

View this book as PDF