On Fri, 8 Aug 2014 01:56:17 +0000, Ward, Mike S wrote:

>Hello all, I have found two assembler programs that are supposed to convert 
>data to base64. They do not seem to be working correctly. I have gone to two 
>sites on the internet that do online base64 conversions. I place a 32 byte 
>string of data into the input area and press the encode button. The data 
>returned does not match what the mainframe base64 assembler program returned. 
>I tried the data at 3 different internet sites. All three sited returned the 
>same results. I tried both assembler programs and used the same input string 
>that I used at the internet sites. The string generated on the mainframe does 
>not match what was returned at the internet sites. Ami missing something? Are 
>the programs broken? Any help appreciated. (Z/os V1.13)
>
Under OMVS on z/OS you can convert data to base64 with the "uuencode -m" 
command. This can be useful as a test to compare its results with the results 
of other programs that claim to convert data to base64. The "-m" switch makes 
it use base64 instead of its normal form of encoding. You just have to strip 
off or ignore the first and last line of the result if you only want the base64 
part.

This example converts EBCDIC "foo" to base64 "hpaW".
I use "printf" instead of "echo" because "echo" appends a newline which will 
also be converted to base64.

printf "foo" | uuencode -m newfile

which produces these 3 lines on the screen:

begin-base64 000 newfile
hpaW
====

The same command on x86 Linux servers that I use would produce "Zm9v" instead 
of "hpaW" because the input string is ASCII instead of EBCDIC.

Here is an example with "echo", to show the effect of the newline added by 
"echo".\

echo "foo" | uuencode -m newfile

begin-base64 000 newfile
hpaWFQ==
====

Internet sites for base64 encoding would typically convert ASCII "foo" to 
base64 "Zm9v".

One way to get this result under OMVS is to pass the string through "iconv", as 
in this example:

printf "foo" | iconv -f IBM-1047 -t ISO8859-1 | uuencode -m newfile

begin-base64 000 newfile
Zm9v
====

I can also get the EBCDIC result on an x86 Linux server, like this:

printf "foo" | iconv -t 1047 | uuencode -m newfile

begin-base64 600 newfile
hpaW
====

Bill

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to