junkew Posted August 5, 2014 Posted August 5, 2014 Searched the forum for AU3 source for BCD format (did get some files from mainframe but numbers are in BCD format) http://en.wikipedia.org/wiki/Binary-coded_decimal could not find stuff and have some C / VBA examples for converting but before i write my own AU3 function would first like to know if someone already has a ready to use function FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
computergroove Posted August 5, 2014 Posted August 5, 2014 Are you trying to convert BCD to ASCII? Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html
junkew Posted August 5, 2014 Author Posted August 5, 2014 I have data like NULL NULL ÷ ì which should become a number human readable so when I do this consolewrite(hex(asc(chr(0))) & hex(asc(chr(0))) & hex(asc("÷"))& hex(asc("ì"))) I get this 00000000 00000000 000000F7 000000EC and then I thought it would be easy to read and extract the numbers (expected in higher bytes only 0-9 and not A-F except for sign nibble) I just thought when I have 12345 it would translate to 0x12 0x34 0x5F but apparently its more difficult or the data that I get from mainframe is getting messed up with EBCDIC-ASCII and Mainframe--Windows download. Steps they do for me to unload the file 1. Unload a DB2 table on IBM mainframe 2. Download this file from mainframe to Windows 3. People send it to me Offcourse I can ask them to run a SELECT * from TABLE which is directly human readable output but thats CPU intensive on the tables we are downloading to flat text files (no BLOB's etc) FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
computergroove Posted August 5, 2014 Posted August 5, 2014 I can help code a bit. I need to know the format you want to end up with. 12345 should equal 0x12 0x34 0x5F When you receive this - 00000000 00000000 000000F7 000000EC - what do you think it is supposed to translate to? Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html
jchd Posted August 5, 2014 Posted August 5, 2014 Which precise BCD variant are your data files using for the fields types you get: unsigned integers, signed integers, floating-point values? This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
junkew Posted August 6, 2014 Author Posted August 6, 2014 I have this (actually its in ASCII characters last 2 characters are Á¥ ) in hex 0x00 0x01 0xC1 0xA5 which human readable should be this 91570 ASCII NUL=0x00 SOH=0x01 Á=0xC1 ¥ = 0xA5 91 57 0s (s=sign either C or F) 0x91 0x57 0x0s EBCDIC j=0x91 ï=0x57 FF=0x0C The mainframe guys are now giving different directions for solutions 1. SELECT * from TABLE but complication seems to be number of attributes in output 2. FILEAID with conversion destination copybook 3. Find a solution under windows to convert Packed Decimal back to a number FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
jchd Posted August 6, 2014 Posted August 6, 2014 ??? I don't get it. You treat the input as text, passing it thru BCD --> EBCDIC --> ANSI --> EBCDIC --> BCD --> String. How did the binary data (BCD) get interpreted as text in the first place? You don't need this complication and it's awfully unreliable: if page codes in EBCDIC and ANSI and back don't match, then the whole data is lost. BCD is neither EBCDIC or ASCII or ANSI: it's just plain binary. Packed decimal is yet another beast. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
junkew Posted August 6, 2014 Author Posted August 6, 2014 (edited) some background but I will follow a new route with the people delivering this to me (ask them just a plain SELECT * FROM <TABLE>) Mainframe DB2 people originally said to get plain dump its easiest to do an unload and transfer that to windows filesystem. They didnt tell me (or they did not now) that as such I would get PackedDecimals which is not a usefull file under windows. And indeed in the process of getting it from the mainframe (apparently the people do not send me a binary downloaded file but use the FTP mechanisme to automatically translate EBCDIC to ASCII and as such its just plain impossible (without EBCDIC version xx <-->ASCII translation tables) to make an AutoIT script to revert this stuff in opposite order). As I am in a large company with to many processes taking days for a 5-10 minute DBA job (do not have access myself on mainframe) I thought "Ok, lets make a quick script to make the file human readable instead of going thru all the process to get a new file in a readable format" thx anyway for reading the topic LS. other people adviced me to use UltraEdit as it has blockselection and per block you can change ASCII<--->EBCDIC easily Edited August 6, 2014 by junkew FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
jchd Posted August 6, 2014 Posted August 6, 2014 Maybe you don't need all columns in the table(s) and you can restrict transfer to a few columns only. AutoIt doesn't offer an efficient built-in way to translate EBCDIC to Unicode (UTF8 would be fine) but I'm pretty sure you could get that format directly if your DBA are kind enough. Beware that there are code pages in EBCDIC and in ANSI, so blind transcoding could result in garbage. UTF8 (or 16 or 32) doesn't have the same issue. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now