Quantcast
Channel: The Big IBM i Blog – Nick Litten [IBM i AS400 iSeries] Software Developer
Viewing all articles
Browse latest Browse all 503

Webservices and RPGLE - Converting Character to Numeric

$
0
0
Srdhar Maheswar likes to type

I'm in the final stages of a fun project writing web-services to interface INFOR System21 (on an IBM i aka AS400) with ACSIS Visitrack (on Windows Server), we are consuming (receiving) and serving (sending) all data in a standard alphameric layout But... as any RPG programmer will know... the conversion between alpha to numeric is easy to overlook and can quickly bite you in the arse.

This morning, I had a long discussion with one of the technical analysts talking about the differences in data layout between the "web" world and the "IBM i" world. Out there in website land data flows around in nice alphabetical chunks. I mean, my name is simply "Nick" and the number sixty seven is simply "67" and two and a half is simply "2.5". But in the database world character can be fixed length "Nick      " or varying length "Nick%" and numerics are commonly stored as packed decimal data so 67 could be stored in a field that is 15,5p so would look like "000000000000067000".  It sounds complicated but if we keep our code clean its a simple process to switch between these formats. Lord Sridhar Maheswar - I promised to write a blog about this to make it clear... here it is  :)


Viewing all articles
Browse latest Browse all 503

Trending Articles