*os_390.txt*    For Vim version 6.2e.  Last change: 2003 May 04


		  VIM REFERENCE MANUAL	  by Ralf Schandl

					*zOS* *z/OS* *OS390* *os390* *MVS*
This file contains the particulars for the z/OS UNIX version of Vim.

1. Open source on z/OS UNIX		|zOS-open-source|
2. Your feedback is needed		|zOS-feedback|
3. Building VIM for z/OS UNIX		|zOS-building|
4. ASCII/EBCDIC dependent scripts	|zOS-has-ebcdic|
5. XTerm Problems			|zOS-xterm|
6. Motif Problems			|zOS-Motif|
7  Bugs					|zOS-Bugs|
8. Known weaknesses			|zOS-weaknesses|
9. Changes				|zOS-changes|

DISCLAIMER:~
We are IBM employees, but IBM is not responsible for this port. This is
our private fun, and is provided in the hopes that it may be useful to
others.

If you have problems with this port, contact Anthony Giorgio
<agiorgio@us.ibm.com>.

Please note that this software has NOT been submitted to any formal IBM testing
and is published AS IS. Please do not contact IBM for support for this
software, as it is not an official component of any IBM product. IT IS
NOT SUPPORTED, GUARANTEED, OR RELATED WHATSOEVER TO IBM.

Contributors: ~
The port to z/OS UNIX was done by Ralf Schandl for the Redbook mentioned below.

Changes, bug-reports, or both by:

	David Moore
	Anthony Giorgio <agiorgio@us.ibm.com>
	and others

This document was written by Ralf Schandl and revised by Anthony Giorgio.

==============================================================================
1. Open source on z/OS UNIX		*OS390-open-source* *zOS-open-source*

If you are interested in other Open Source Software on z/OS UNIX, have a
look at the following Redbook:

    Mike MacIsaac et al
    "Open Source Software for z/OS and OS/390 UNIX"
    IBM Form Number: SG24-5944-01
    ISBN: 0738424633

You can find out more information, order a hard copy, or download a PDF
version of these Redbooks at:

	    http://www.redbooks.ibm.com

==============================================================================
2. Your feedback is needed		*OS390-feedback* *zOS-feedback*

Vim should compile, link, and run right out of the box on a standard IBM z/OS
UNIX mainframe.  I've personally run it on z/OS V1R2 and V1R3 machines without
problems.

Many changes had to be done to the code to port Vim to z/OS UNIX. As like
most UNIX programs, Vim contained heavy ASCII dependencies. I might have
missed an ASCII dependency, or it is possible that a new one has been added
with a feature or bug fix. Most programmers are simply not aware of possible
ASCII/EBCDIC conversion issues. If you hit a problem that seems related to
this, feel free to contact us at the email addresses above.

One indication of ASCII/EBCDIC conversion problems is screen corruption with
"unprintable" characters.  For example, at one point the errorbell was broken
in Vim. Any time Vim tried to ring the terminal bell an ASCII character 0x07
would be printed. This works fine on most terminals, but is broken on an
EBCDIC one. The correct solution was to define a different value for the bell
character on EBCDIC systems.

Remember, it's only possible to fix a bug if the community knows about it.
Don't rely on someone else to report it! See the section |bug-reports|.

==============================================================================
3. Building VIM for z/OS UNIX		*OS390-building* *zOS-building*

A word on debugging code first: ~

The normal run of configure adds the flag '-g' to the compiler options,
to include debugging information into the executable. This information
are normally removed from the executable with the strip command during
installation. On z/OS UNIX, it is not possible to remove this from
the executable. The strip command exists on z/OS UNIX and is called
during the installation, but it does nothing.  It is equivalent to the
'touch' command. This is due to the way debug symbols are stored in the
objects generated by the compiler.

If you want to build Vim without debugging code, export the environment
variable CFLAGS set to an empty string before you call the configure script.
>
	export CFLAGS=""


Building without X11: ~

Note: Use cc to build Vim. The c89 compiler has stricter syntax checking
and will not compile Vim cleanly.

If you build VIM without X11 support, compiling and building is
straightforward. Don't forget to export _CC_CCMODE=1 before calling
configure and make.
>
    $ export _CC_CCMODE=1
    $./configure --with-features=big --without-x --enable-gui=no
    $ make
    $ make test
<
	Test notes:
	Test 11 will fail if you do not have gzip installed.
	Test 42 will fail, as VIM on z/OS UNIX doesn't support the multibyte
	feature. (David Moore: "Doesn't work _yet_!  :-)  I'll see what I
	can do.")
>

    $ make install


Building with X11: ~

There are two ways for building Vim with X11 support. You can link it
statically with the X11 libraries or can bind it with the X11 DLLs. The
statically linked version results in a huge executable (~13MB), while the
dynamically linked executable is much smaller (~4.5MB).

Here is what you do, if you want Motif:

  a) Static link >
	$ configure --with-features=big --enable-gui=motif
	$ make
<
     VIM is now linked statically with the X11 libraries.

  b) Dynamic link:
     Make VIM as described for the static link. Then change the contents of
     the 'auto/link.sed' file by appending: >
	s%-lXm  *%/usr/lib/Xm.x %g
	s%-lX11  *%/usr/lib/X11.x %g
	s%-lSM  *%/usr/lib/SM.x %g
	s%-lICE  *%/usr/lib/ICE.x %g
<
     Then do: >
	$ rm vim
	$ make
<
     Now Vim is linked with the X11-DLLs.

See the Makefile and the file link.sh on how link.sed is used.

==============================================================================
4. ASCII/EBCDIC dependent scripts	*OS390-has-ebcdic* *zOS-has-ebcdic*

For the internal script language the feature "ebcdic" was added. With this
you can fix ASCII dependent scripts like this:
>
    if has("ebcdic")
	let space = 64
    else
	let space = 32
    endif
<
==============================================================================
5. XTerm problems			*OS390-xterm* *zOS-xterm*

Note: This problem was resolved in version 6.1b. ~

I saw one problem with XTerm on z/OS UNIX.  The terminal code for moving the
cursor to the left is wrong in the termlib database.  Perhaps not wrong, but
it didn't work with VIM syntax highlighting and command line cursor movement.

If the highlighting is messed up while you type, but is okay after you refreshed
the screen with <C-L> or if you can't move to the left with the cursor key on
the command line, try adding >
	:set t_le=^H
<
to your .vimrc. Note: '^H' is one character, hit <C-V><C-H> to get it.

==============================================================================
6. Motif Problems			*OS390-Motif* *zOS-Motif*

It seems that in porting the Motif library to z/OS, a translation from EBCDIC
to ASCII for the accelerator characters of the pull-down menus was forgotten.
Even after I tried to hand convert the menus, the accelerator keys continued
to only work for the opening of menus (like <Alt-F> to open the file menu).
They still do not work for the menu items themselves (like <Alt-F>O to open
the file browser).

There is no solution for this as of yet.

==============================================================================
7. Bugs					*OS390-bugs* *zOS-Bugs*

- Vim will consistently hang when a large amount of text is selected in
  visual block mode.  This may be due to a memory corruption issue.  Note that
  this occurs in both the terminal and gui versions.

==============================================================================
8. Known weaknesses			*OS390-weaknesses* *zOS-weaknesses*

- No binary search in tag files.
  The program /bin/sort sorts by ASCII value by default. This program is
  normally used by ctags to sort the tags. There might be a version of
  ctags out there, that does it right, but we can't be sure. So this seems to
  be a permanent restriction.

- Multibyte support (utf-8) doesn't work, it's disabled at compile time.
  (|multibyte|)

- The cscope interface (|cscope|) doesn't work for the version of cscope
  that we use on our mainframe.  We have a copy of version 15.0b12, and it
  causes Vim to hang when using the "cscope add" command.  I'm guessing that
  the binary format of the cscope database isn't quite what Vim is expecting.
  I've tried to port the current version of cscope (15.3) to z/OS, without
  much success.  If anyone is interested in trying, drop me a line if you
  make any progress.

- No glib/gtk support.  I have not been able to successfully compile glib on
  z/OS UNIX.  This means you'll have to live without the pretty gtk toolbar.

Never tested:
    - Perl interface		(|perl|)
    - Hangul input		(|hangul|)
    - Encryption support	(|encryption|)
    - Langmap			(|'langmap'|)
    - Python support		(|Python|)
    - Right-to-left mode	(|'rightleft'|)
    - SNiFF+ interface		(|sniff|)
    - TCL interface		(|tcl|)
    ...

If you try any of these features and they work, drop us a note!

==============================================================================
9. Changes				*OS390-changes*	*zOS-changes*

This is a small reference of the changes made to the z/OS port of Vim.  It is
not an exhaustive summary of all the modifications made to the code base.

6.1b (beta):
  Changed KS_LE in term.c to be "\b" instead of "\010"  This fixed the
  screen corruption problems in gVim reported by Anthony Giorgio.

  Anthony Giorgio updated this document:
	- Changed OS/390 to z/OS where appropriate. IBM decided to rename
		all of its servers and operating systems.  z/OS and OS/390
		are the same product, but the version numbering system was
		reset for the name change. (e.g. OS/390 V2R11 == z/OS V1R1)
	- Added information about second edition of the Open Source Redbook.
	- Moved Redbook information to a separate section.
	- Various tweaks and changes.
	- Updated testing section.

6.0au:
  Changed configure.in
  Changed documentation.
  Anthony Giorgio fixed the errorbell.

  David Moore found some problems, which were fixed by Bram and/or David for
  6.0au.

6.0q (alpha):
  Minor changes for nrformats=alpha (see |'nrformats'|).
  Problem with hard-coded keycode for the English pound sign. Added a define in
  ascii.h
  Disabled multibyte for EBCDIC in feature.h

6.0f (alpha):
  First compile of Vim 6 on z/OS UNIX. Some minor changes were needed.

  Finally found the reason why make from the top level didn't work (I must have
  been blind before!). The Makefile contained a list of targets in one target
  line. On all other UNIX's the macro $@ evaluates to the first target in this
  list, only on z/OS UNIX it evaluates to the last one :-(.

5.6-390d:
  Cleaned up some hacks.

5.6-390c:
  I grepped through the source and examined every spot with a character
  involved in a operation (+-). I hope I now found all EBCDIC/ASCII
  stuff, but ....

  Fixed:
    - fixed warning message in do_fixdel()
    - fixed translation from Ctrl-Char to symbolic name (like ^h to CTRL-H)
	    for :help
    - fixed yank/delete/... into register
    - fixed :register command
    - fixed viminfo register storing
    - fixed quick-access table in findoptions()
    - fixed 'g^H' select mode
    - fixed tgetstr() 'get terminal capability string', ESC and
	    Ctrl chars where wrong. (Not used on OS/390 UNIX)


  ctags:
    - added trigraphs support (used in prolog of system header files)
	    (get.c)
    - fixed sorting order with LC_COLLATE=S390 to force EBCDIC sorting.
	    (sort.c)

5.6-390b:
  Changed:
    - configure.in:
	- added test for OS/390 UNIX
	- added special compiler and linker options if building with X11
    - configure:
	- after created via autoconf hand-edited it to make the test for
	  ICEConnectionNumber work. This is a autoconf problem. OS/390 UNIX
	  needs -lX11 for this.
    - Makefile
	- Don't include the lib directories ('-L...') into the variable
	  ALL_LIBS. Use own variable ALL_LIB_DIRS instead. A fully POSIX
	  compliant compiler must not accept objects/libraries and options
	  mixed. Now we can call the linker like this:

	    $(CC) $(LDFLAGS) $(ALL_LIB_DIRS) $(OBJ) $(ALL_LIBS)

  Fixed:
    - Double quote couldn't be entered
      Missed ASCII dependencies while setting up terminal
      In ASCII 127 is the delete char, in EBCDIC codepage 1047 the value 127
      is the double quote.
    - fixed ':fixdel'

5.6-390a:
  first alpha release for OS/390 UNIX.

  Addition:
    - For the internal script language I added the feature "ebcdic".
      This can be queried with the has()-function of the internal
      script language.

------------------------------------------------------------------------------
 vim:tw=78:fo=tcq2:ts=8:ft=help:norl:
