1178476Sjb/*
2178476Sjb * CDDL HEADER START
3178476Sjb *
4178476Sjb * The contents of this file are subject to the terms of the
5178476Sjb * Common Development and Distribution License (the "License").
6178476Sjb * You may not use this file except in compliance with the License.
7178476Sjb *
8178476Sjb * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9178476Sjb * or http://www.opensolaris.org/os/licensing.
10178476Sjb * See the License for the specific language governing permissions
11178476Sjb * and limitations under the License.
12178476Sjb *
13178476Sjb * When distributing Covered Code, include this CDDL HEADER in each
14178476Sjb * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15178476Sjb * If applicable, add the following below this CDDL HEADER, with the
16178476Sjb * fields enclosed by brackets "[]" replaced with your own identifying
17178476Sjb * information: Portions Copyright [yyyy] [name of copyright owner]
18178476Sjb *
19178476Sjb * CDDL HEADER END
20178476Sjb */
21178476Sjb
22178476Sjb/*
23178476Sjb * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24178476Sjb * Use is subject to license terms.
25178476Sjb */
26178476Sjb
27178476Sjb#pragma ident	"%Z%%M%	%I%	%E% SMI"
28178476Sjb
29178476Sjb#pragma D option quiet
30178476Sjb
31178476SjbBEGIN
32178476Sjb{
33178476Sjb	i = 0;
34178476Sjb	j = 0;
35178476Sjb
36178476Sjb	@tour["Ghent", i++, j] = sum(5 - j);
37178476Sjb	j++;
38178476Sjb
39178476Sjb	@tour["Berlin", i++, j] = sum(5 - j);
40178476Sjb	j++;
41178476Sjb
42178476Sjb	@tour["London", i++, j] = sum(5 - j);
43178476Sjb	@tour["Dublin", i++, j] = sum(5 - j);
44178476Sjb	j++;
45178476Sjb
46178476Sjb	@tour["Shanghai", i++, j] = sum(5 - j);
47178476Sjb	j++;
48178476Sjb
49178476Sjb	@tour["Zurich", i++, j] = sum(5 - j);
50178476Sjb	j++;
51178476Sjb
52178476Sjb	@tour["Regina", i++, j] = sum(5 - j);
53178476Sjb	@tour["Winnipeg", i++, j] = sum(5 - j);
54178476Sjb	@tour["Edmonton", i++, j] = sum(5 - j);
55178476Sjb	@tour["Calgary", i++, j] = sum(5 - j);
56178476Sjb	@tour["Vancouver", i++, j] = sum(5 - j);
57178476Sjb	@tour["Victoria", i++, j] = sum(5 - j);
58178476Sjb	j++;
59178476Sjb
60178476Sjb	@tour["Prague", i++, j] = sum(5 - j);
61178476Sjb	@tour["London", i++, j] = sum(5 - j);
62178476Sjb	j++;
63178476Sjb
64178476Sjb	@tour["Brisbane", i++, j] = sum(5 - j);
65178476Sjb	@tour["Sydney", i++, j] = sum(5 - j);
66178476Sjb	@tour["Melbourne", i++, j] = sum(5 - j);
67178476Sjb	j++;
68178476Sjb
69178476Sjb	setopt("aggsortkey", "false");
70178476Sjb	setopt("aggsortkeypos", "0");
71178476Sjb	@tour["Amsterdam", i++, j] = sum(5 - j);
72178476Sjb
73178476Sjb	printf("By value:\n");
74178476Sjb	printa("%20s %8d %8d %8@d\n", @tour);
75178476Sjb
76178476Sjb	setopt("aggsortkey");
77178476Sjb	printf("\nBy key, position 0:\n");
78178476Sjb	printa("%20s %8d %8d %8@d\n", @tour);
79178476Sjb
80178476Sjb	setopt("aggsortkeypos", "1");
81178476Sjb	printf("\nBy key, position 1:\n");
82178476Sjb	printa("%20s %8d %8d %8@d\n", @tour);
83178476Sjb
84178476Sjb	setopt("aggsortkeypos", "2");
85178476Sjb	printf("\nBy key, position 2:\n");
86178476Sjb	printa("%20s %8d %8d %8@d\n", @tour);
87178476Sjb
88178476Sjb	setopt("aggsortkey", "false");
89178476Sjb	setopt("aggsortkeypos", "0");
90178476Sjb	setopt("aggsortrev");
91178476Sjb
92178476Sjb	printf("\nReversed by value:\n");
93178476Sjb	printa("%20s %8d %8d %8@d\n", @tour);
94178476Sjb
95178476Sjb	setopt("aggsortkey");
96178476Sjb	printf("\nReversed by key, position 0:\n");
97178476Sjb	printa("%20s %8d %8d %8@d\n", @tour);
98178476Sjb
99178476Sjb	setopt("aggsortkeypos", "1");
100178476Sjb	printf("\nReversed by key, position 1:\n");
101178476Sjb	printa("%20s %8d %8d %8@d\n", @tour);
102178476Sjb
103178476Sjb	setopt("aggsortkeypos", "2");
104178476Sjb	printf("\nReversed by key, position 2:\n");
105178476Sjb	printa("%20s %8d %8d %8@d\n", @tour);
106178476Sjb
107178476Sjb	exit(0);
108178476Sjb}
109