[Info-vax] Encoding a file to base64 from COBOL?

Stephen Hoffman seaohveh at hoffmanlabs.invalid
Wed May 8 09:53:09 EDT 2019


On 2019-05-08 12:11:19 +0000, simonsspamfilter at gmail.com said:

> I am looking at a COBOL program that puts together a mime-file that is 
> sent in a later stage. I wish to add a new part to this program that 
> includes a .pdf-file, but run in to issues if the data isn't 
> BASE64-encoded. I know that mime tools can encode the data from the 
> same file to BASE64 which makes it work, but is there any way I can get 
> around to doing this myself from a COBOL-program?

Use lib$spawn and some DCL and the MIME utility (with a "recent" 
OpenVMS release or various the usual OpenVMS "fossil" releases (i.e. 
anything prior to V8.4) with the MIME patches loaded), or scrounge some 
COBOL BASE64 code and maybe from http://cbttape.org, and there's a 
64-to-ASCII tool here which can serve as an example for the reverse 
https://sourceforge.net/p/open-cobol/discussion/help/thread/8c4b2e47/ , 
or link with and invoke Lua or C or C++ or Macro32 or some other 
language from the COBOL and use that, or figure out how to call the 
OpenSSL Base64 encode and decode routines from COBOL though they're a 
little convoluted with the BIO stuff, or send the file to a system with 
better tools, among other options.   OpenVMS doesn't offer Base64 
encode and decode APIs in the RTLs; there's embedded support in MIME 
and there's the OpenSSL API, but not much else.   Another detail to be 
added onto the VSI schedule.

http://fm4dd.com/programming/base64/base64_algorithm.htm
https://opensource.apple.com/source/libresolv/libresolv-41/base64.c
https://stackoverflow.com/questions/5288076/base64-encoding-and-decoding-with-openssl/33331627#33331627 


Somebody around here can write this for you, if you can't find it.

-- 
Pure Personal Opinion | HoffmanLabs LLC 




More information about the Info-vax mailing list