Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Packed Decimals
Message
De
07/12/2004 03:00:08
 
 
À
06/12/2004 22:35:24
Joel Hokanson
Services Integration Group
Bellaire, Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00967378
Message ID:
00967388
Vues:
14
>Does anyone know how to convert data in a packed decimal field to a standard numeric field.
>
>THe data file is an FTP download off a IBM Mainframe and the data was in DB2
>
>All of the file converts to standard ASCII text except the packed decimal field.


Joel,

I've used this to read as400 data
*--------------------------------------------------------------------------
function	PackedDecimalToNumber(xx)

	local zz
	zz = ath(m.xx)
	assert inlist(right(m.zz,1), 'D', 'F')
	
	return iif(right(m.zz,1) == 'D', -val(left(m.zz,len(m.zz)-1)), val(left(m.zz,len(m.zz)-1)) )
endfunc
*--------------------------------------------------------------------------
function	ath(x)
	local out, i
	out = ''
	for i = 1 to len(m.x)
		out = m.out + right(transform(asc(substr(m.x,m.i,1)),'@0'),2)
	endfor
	return	out
endfunc
*---------------------------------------------------------------------
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform