Quote:
|
Originally Posted by dbamota
If the number is already in binary, grouping them 4 at a time is base 16, grouping them 6 at a time is base 64, grouping them n at a time is base 2 to the power n. In cobol, by redefining the same work area 4 bits at a time and 6 bits at a time should do the trick. If you can give an example, that would help.
|
I am sorry I got you confused with the word binary there. I don't exactly have the image in 0's and 1's. When I query DB2 using QMF, the image data I see is represented in Base16. What I am planning to do is:
1) Do a SELECT HEX(image)
2) Convert the X'' hex data to binary, 2 hex characters at a time
3) Group 3 binary bytes and split them into 4 groups of 6 each
4) Assign the base64 value for each 6-bit with needed 0's and paddings (=)
5) Get admitted for psychiatric treatment
If anyone of you have a solution to make the first 4 steps easy, so I can avoid step 5, let me know please. I will be extremely grateful... no kidding
Let me know if you see something wrong with the logic too.
Marcus_A: n_i is right, Base64 (A-Z, a-z, /, +) is not a character set representation like EBCDIC or ASCII, it's just a representation of data in a different notation like base 2, base10, base16...
If I send the data in Base16, a 400 byte image will go out as an 800 byte image X''. if I do it in Base64, converting 3 bytes to 4 bytes will only cause a 33% more increase in size