Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cobol's comp3
Message
De
29/03/2007 17:02:33
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
29/03/2007 14:26:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01209986
Message ID:
01210073
Vues:
18
This message has been marked as the solution to the initial question of the thread.
>Hi..
>
>what is the best deal on the conversion from old comp3 cobol format data to ascii?

Take it as a string, then chop by nibbles. Reserve the rightmost nibble for the sign. That is, IIRC, comp-3 was a BCD number, right?

Assume you have a byte from anywhere in the middle. Its value is then
Func Bcd2Num
para bcd
priv x
x=''
#define tbl1 ':;<=>?'
#define tbl2 'abcdef'
for i=1 to len(bcd)
	_asc = asc(subs(bcd,i))
	x=x+chr(bitshift(_asc,4)+48)+chr(bitand(_asc,15)+48)
endf
x=chrtran(x,tbl1,tbl2)
retu val(left(x,len(x)-1)) * iif(inlist(right(x,1),'c','f'),1,-1)
Wrote that on 9. March 1999, when these bit-oriented functions were in fPath.plb. Also keep in mind that this routine has no idea how many decimals does the result have. You'll have to divide it with 100 or whatever.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform