Intermec PF4i Fingerprint Developer's Guide (old) - Page 79

Left or Right Justifying Data With LSET and RSET, Transferring Data to the File With PUT

Page 79 highlights

Chapter 4 - Managing Input and Output 30 QDATA1$="ABC" 40 QDATA2$="DEF" 50 QDATA3$="12345678" Note: Only string variables can be used. Possible numeric expressions must therefore be converted to strings using STR$ functions. Left or Right Justifying Data With LSET and RSET There are two instructions for placing data into a random file buffer: • LSET places the data left-justified. • RSET places the data right-justified. In other words, if the input data consists of fewer bytes than the field into which it is placed, it is placed either to the left (LSET) or to the right (RSET). If the length of the input data exceeds the size of the field, the data is truncated from the end (LSET), or from the start (RSET). 60 LSET F1$=QDATA1$ 70 RSET F2$=QDATA2$ 80 LSET F3$=QDATA3$ This set of instructions produce the following record: Record: 1 Field: 1 2 3 Byte: 1 2 3 4 1 2 3 4 1 2 3 4 5 6 The first field is left-justified, the second field is right-justified, and the third field is left-justified and truncated at the end. Digits 7 and 8 are omitted since the field is only six bytes long. If the field had been right-justified, then digits 1 and 2 would have been omitted instead. Transferring Data to the File With PUT The next step is to transfer the record to the file using the PUT statement. PUT is always followed by the number assigned to the file when it was OPENed, and the number of the record in which you want to place the data (1 or larger). In our example, the file ZFILE was OPENed as #1 and we want to place the data in the first record. You can place data in whatever record you like. The order is of no consequence. 90 PUT #1,1 You can place data into other records using additional sets of LSET, RSET and PUT statements. Below is an example of a three-record file: Byte: 1 2 3 4 1 2 3 4 1 2 3 4 5 6 1 2 3 4 1 2 3 4 1 2 3 4 5 6 1 2 3 4 1 2 3 4 1 2 3 Intermec Fingerprint Developer's Guide 63

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187

Chapter 4 — Managing Input and Output
Intermec Fingerprint Developer’s Guide
63
30 QDATA1$=“ABC”
40 QDATA2$=“DEF”
50 QDATA3$=“12345678”
Left or Right Justifying Data With LSET and RSET
There are two instructions for placing data into a random file buffer:
LSET places the data left-justified.
RSET places the data right-justified.
In other words, if the input data consists of fewer bytes than the field into which it is
placed, it is placed either to the left (LSET) or to the right (RSET).
If the length of the input data exceeds the size of the field, the data is truncated from
the end (LSET), or from the start (RSET).
60
LSET F1$=QDATA1$
70
RSET F2$=QDATA2$
80
LSET F3$=QDATA3$
This set of instructions produce the following record:
The first field is left-justified, the second field is right-justified, and the third field is
left-justified and truncated at the end. Digits 7 and 8 are omitted since the field is
only six bytes long. If the field had been right-justified, then digits 1 and 2 would
have been omitted instead.
Transferring Data to the File With PUT
The next step is to transfer the record to the file using the PUT statement. PUT is
always followed by the number assigned to the file when it was OPENed, and the
number of the record in which you want to place the data (1 or larger).
In our example, the file ZFILE was OPENed as #1 and we want to place the data in
the first record. You can place data in whatever record you like. The order is of no
consequence.
90
PUT #1,1
You can place data into other records using additional sets of LSET, RSET and PUT
statements. Below is an example of a three-record file:
Note:
Only string variables can be used. Possible numeric expressions must
therefore be converted to strings using STR$ functions.
1
1
2
3
Field:
Record:
Byte:
1
2
3
4
5
6
1
2
3
4
1
2
3
4
Byte:
1
2
3
4
5
6
1
2
3
4
1
2
3
4
1
2
3
4
5
6
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3