[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
[no subject]
Platform
OS: HP-UX 11.00 E 9000/800
DB: Oracle 8.0.4.2.1
SQR: 4.3.2
We are using SQR to extract data from a transaction table and write it to a
file. Each file has a header record, detailed transaction records, and a
trailer record that includes the line count and total dollar amounts.
The output file is read into a COBOL program that expects numerics to be
formatted with the sign leading separate. The relevant code follows:
begin-report
.
.
!select rows from database meeting extract criteria and accumulate total
amounts
.
!CR211 debug
display &a.foreign_amount noline
display ' ' noline
display &a.monetary_amount noline
display ' ' noline
display &a.statistic_amount noline
display ' ' noline
do
Decimal-Format-Sign-Sep(&a.foreign_amount,'0000000000000V99',$foreign_amt)
do
Decimal-Format-Sign-Sep(&a.monetary_amount,'000000000000V99',$resource_amt)
do
Decimal-Format-Sign-Sep(&a.statistic_amount,'0000000000000V99',$resource_qt
y)
!debug
display $foreign_amt noline
display ' ' noline
display $resource_amt noline
display ' ' noline
display $resource_qty
.
write 1 from $rec_type:2
.
.
$foreign_amt:16
$resource_amt:15
$resource_qty:16
.
.
status=#filestat
.
.
end-report
The code for the Decimal-Format-Sign-Sep function is located in a separate
file incorporated via a #include and is as follows:
begin-procedure Decimal-Format-Sign-Sep(#amt,$format,:$num)
if #amt < 0
let $sign = '-'
else
let $sign = '+'
end-if
let $num = $sign||edit(abs(#amt),$format)
!CR211 debug
if $_ReportID = 'ifgltoif'
display 'amount is ' noline
display #amt noline
display ' formatted amount is ' noline
display $num
end-if
end-procedure Decimal-Format-Sign-Sep
On one of the most recents runs, 4 of over 1900 detail line amounts written
to the output file were formatted incorrectly. The display of the numeric
values (done before the call to the format function) showed the numeric
values were correct at that point. The display of the values done within
the function showed both the numeric amounts and formatted values to be
incorrect. For example,
Numeric value in calling program Numeric value in function
11801861.59 11801856.g90000
-23879269.61 -23879264.h10000
-42218725.77 -42218720.i70000
The discrepancies appeared to occur randomly during processing. However,
there seems to be a pattern regarding the difference in the quantities. It
appears that in all runs, the character following the decimal point is not
a number. Re-running the extract typically results in a file with all
amounts formatted correctly. I have not been able to recreate this problem
in development - which is running Oracle 8.0.5 so I am wondering if it's a
bug specific to the current production environment.
Any thoughts or similar experiences would be appreciated.