Correcting the Pascal Language Program
The one replacement page for program pasex10a in chapter 10 of the
"ALLBASE/SQL Pascal Application Programming Guide" appears on the next
page.
_____________________________________________________________________________
| |
| Abort : boolean; |
| $PAGE $ |
| (* Procedure BCDToString converts a decimal field in the "DataBuffer" |
| * buffer to its decimal presentation. Other input parameters are |
| * the Length, precision and Scale. The input decimal field is passed|
| * via "DataBuffer" and the output String is passed via "result". |
| *) |
| procedure BCDToString (DataBuffer : BCDType; Length : SmallInt; 2 |
| Precision : SmallInt; Scale : SmallInt; |
| var Result : String); |
| const |
| hexd = '0123456789ABCDEF'; (* Hexadecimal digits #001*) |
| ASCIIZero = ord('0'); |
| PlusSign = 12; |
| MinusSign = 13; |
| UnSigned = 14; |
| var |
| i, |
| DecimalPlace, |
| PutPos, |
| DataEnd, |
| DataStart : Integer; |
| done : boolean; |
| |
| begin |
| DataEnd := (Length*2) - 1; |
| DataStart := (DataEnd - Precision) + 1; |
| Result := StrRpt (' ',StrMax(Result)); |
| DecimalPlace := (Precision-Scale) -1; |
| |
| (* convert decimal to character String *) |
| if DecimalPlace = 0 then |
| begin |
| |
| Result[1] := '.'; |
| PutPos := 2; |
| |
| end |
| else |
| PutPos := 1; |
| for i := DataStart to DataEnd do |
| begin |
| |
| |
| |
| |
_____________________________________________________________________________
Figure 10-9. Program pasex10a: Dynamic Commands of Unknown Format (page 2 of 12)
[REV END]