Allow YAZ 2 series only
[ir-tcl-moved-to-github.git] / display.tcl
1 # $Id: display.tcl,v 1.4 1998-05-20 12:27:42 adam Exp $
2 #
3 # Record display
4 proc display {zset no} {
5     set type [$zset type $no]
6     if {$type == "SD"} {
7         set err [lindex [$zset diag $no] 1]
8         set add [lindex [$zset diag $no] 2]
9         if {$add != {}} {
10             set add " :${add}"
11         }
12         puts "Error ${err}${add}"
13         return
14     }
15     if {$type != "DB"} {
16         return
17     }
18     set rtype [$zset recordType $no]
19     if {$rtype == "SUTRS"} {
20         puts [join [$zset getSutrs $no]]
21         return
22     }
23     if {$rtype == "GRS-1"} {
24         set r [$zset getGrs $no]
25         puts $r
26         return
27     }
28     if {$rtype == "Explain"} {
29         set r [$zset getExplain $no]
30         puts $r
31         return
32     }
33     if {[catch {set r [$zset getMarc $no line * * *]}]} {
34         puts "Unknown record type: $rtype"
35         return
36     }
37     foreach line $r {
38         set tag [lindex $line 0]
39         set indicator [lindex $line 1]
40         set fields [lindex $line 2]
41         puts -nonewline "$tag "
42         if {$indicator != ""} {
43             puts -nonewline $indicator
44         }
45         foreach field $fields {
46             set id [lindex $field 0]
47             set data [lindex $field 1]
48             if {$id != ""} {
49                 puts -nonewline " \$$id "
50             }
51             puts -nonewline $data
52         }
53         puts ""
54     }
55 }
56