Greetings,
I have built Ruby 1.8.6 on z/OS as an ASCII application. I have
installed rubygems and Rails. I can run irb and ruby scripts, and I can
generate a Rails application.
The problem I run into is that the pseudo threads implementation in
eval.c depends on a technique of stack swapping from heap that the z/OS
C runtime setjmp/longjmp and getcontext/setcontext functions do not
support. The C runtime insists on stack integrity. When stack_extend
needs to be called, a valid chainback no longer exists. Ruby abnormally
ends (abends) with a stack check exception.
So long as Ruby threading is not used, e.g. in a typical script, all is
well. However, running a server application, where threading is
essential to support multiple clients, does not work.
If the pseudo threads implementation could be replaced with pthreads,
even if the pthreads were all synchronized (due to the lack of thread
safety for global variable access), then I believe a z/OS implementation
of the Ruby interpreter would work. I have attempted this myself, but I
need some more pthread API expertise.
I have built JRuby on z/OS, and it works reasonably well, if slowly. I
can build and run a Rails application, and I have run it using
mongrel-jruby. I have fiddled with ActiveRecord-JDBC to get this to work
with DB2 on z/OS. ActiveRecord-JDBC had some problems with Rails using
quoted numerics, but copying the jdbc-derby code to use with DB2 helped
there. However, BLOB/CLOB support is a bit unconventional on z/OS DB2,
and ActiveRecord-JDBC did not work with that (so Camping session, which
uses a text type that maps to a CLOB, does not work). (Note that if you
are using ibm_db from a workstation Ruby session to z/OS DB2, that
Camping runs fine. BLOB/CLOB support in ibm_db is robust).
I would be interested in working with folks to facilitate their efforts
at Ruby on z/OS, and who could help me with the bowels of eval.c. Ruby’s
utility as a scripting language suggests it could offer a lot to
sysprogs, dba’s, and testers. It would also be helpful to write servers
to provide health check info and access into the system. Rails might
also be an interesting exercise there.