UNIX Tools that Simulate the Mainframe: SEDIT, S/REXX and S/REXX Debugger

From EDM2
Jump to: navigation, search

By Joseph Brady

Are you moving from the mainframe to UNIX, or implementing combined mainframe/UNIX environments? The changeover presents several challenges:

  • Retraining is required due to the different skills and tools utilized to accomplish the same tasks in each environment
  • Training efforts can introduce costs and project delays
  • Productivity decreases while users acclimate themselves to the new environment

To address problems like these, organizations need familiar tools that operate in the same manner on UNIX as they did on the mainframe. Such tools provide a means for users to become productive immediately, avoiding costly and lengthy training efforts. SEDIT, S/REXX, and S/REXX Debugger are valuable tools that can help make the transition easier and faster.


For text editing, most mainframe users are accustomed to the XEDIT and ISPF/PDF editors. They know the keystrokes necessary to insert, delete, or copy lines of text. They know how to scan a file for a particular word or phrase. They probably know these functions so well that they never use reference manuals.

Figure 1. Mainframe XEDIT screen

When these same productive users transfer to a UNIX environment, however, their productivity can drop sharply. UNIX editors such as vi and emacs bear little resemblance to XEDIT or ISPF/PDF. To mainframe users, they can seem simplistic or unwieldy. Productive mainframe users become UNIX novices, forced to look up each editor command in a reference book to learn its syntax and options. SEDIT can help to minimize these difficulties.

SEDIT supports the commands and keystrokes mainframe users already know. It combines this familiarity with additional editing features to provide a product that enables users to make a rapid and smooth transition from the mainframe to UNIX. As the user becomes more familiar with UNIX, the flexible design of SEDIT allows users to increasingly make use of native UNIX features and capabilities.

With SEDIT, former mainframe users will quickly feel at home on UNIX. There is a similarity in the screens depicting XEDIT on the mainframe and SEDIT operating in XEDIT mode on UNIX.

Figure 2. UNIX SEDIT screen

In addition to the screen similarities, SEDIT supports all popular XEDIT and ISPF/PDF commands, including the Insert, Copy, Delete, Split, Join, and Get commands. To further increase familiarity, SEDIT offers an FLIST-like utility for navigating through UNIX directories. As on the mainframe, users may select a file from the list to load into the editor. The SEDIT FLIST-like utility resembles the mainframe FLIST as closely as possible, while showing UNIX directory information such as file permissions and subdirectories.

Figure 3. Mainframe FLIST screen
Figure 4. SEDIT FLIST-like screen

SEDIT enables users to continue working with the mainframe commands they are accustomed to, while gaining familiarity with the UNIX environment. As they become more familiar with UNIX, users will want to take advantage of UNIX features and capabilities. When they are ready, SEDIT is there to help them.

During initial use of SEDIT, users may prefer the mainframe-like character interface. In time, they may want to invoke SEDIT in GUI mode to take advantage of UNIX Graphical User Interface (GUI) features.

SEDIT Features

SEDIT provides users with the ability to simultaneously edit several files. In Figure 5, the SEDIT screen displays two C programs being edited simultaneously. This feature allows users to easily copy and paste text between two files, switching easily from one file to another by simply clicking on the file name displayed on the screen. SEDIT also remembers (and can automatically recall) previously entered commands, so that the user does not need to re-type them.

Navigating through the UNIX directories and subdirectories can be tedious. Accessing files in multiple directories at the same time often requires the user to remember the full path name by which UNIX identifies the file. To eliminate the need for users to repeatedly type entire path names when they open files, SEDIT searches for files in the directories described in the PATH environment variable. This allows the user to specify a file by its unique file name (e.g., benefit.c) rather than identifying it by the full UNIX path name (e.g., usr/fred/payroll/benefit.c).

Other useful editing features that take SEDIT's capabilities far beyond those of XEDIT and ISPF/PDF include:

  • Displays files in WYSIWYG format, with no invisible control characters
  • Offers an unlimited UNDO function
  • Includes a complete online help system
  • Checks spelling
  • Saves files automatically, if desired

SEDIT Tree Utility

Understanding the UNIX directory tree structure takes time. It is helpful to see how the various directories and subdirectories relate to one another. To assist users in interpreting this information, SEDIT provides a Tree Utility which graphically depicts the UNIX directory tree structure. In the Tree Utility, users may navigate through UNIX directories by simply clicking on the name of the directory or subdirectory they wish to select.

Additional Features

The power and flexibility of SEDIT make it a very productive editing environment for the UNIX platform. In addition to providing a rich editing environment, SEDIT also provides features which take advantage of UNIX, such as:

  • Reprogramming of function keys, allowing keyboard shortcuts to be created
  • Creation of user-customized menus and buttons
  • Supports using the UNIX mouse
  • "Learns" the keyboard layout from any ASCII terminal
  • Supports SunView, OpenLook, and Motif GUIs
  • Provides "search and replace" for FORTRAN and C variables
  • Supports compilers, and can automatically position the cursor on lines of code which generated compiler errors
  • Provides a scrollable interface to the UNIX "man" command
  • Includes an external macro interface, allowing the use of any language as a macro language
  • Interacts with IBM's AIX SDE WorkBench and CenterLine Software's CodeCenter
  • "Listens" on a socket for commands sent by other UNIX applications

Such features ensure that as the users' knowledge of UNIX grows, SEDIT grows with them.

In addition, SEDIT supports macros written in most popular programming languages, including C. SEDIT also interfaces with the S/REXX macro language, a REXX compatible language for UNIX, available from Treehouse Software.

S/REXX Macro Language

S/REXX emulates the IBM mainframe REXX language. S/REXX is compatible with the instructions and built-in functions of Cowlishaw REXX level 4.0. This instant familiarity helps programmers make a smooth transition from the mainframe to UNIX.

Other capabilities make S/REXX more flexible, more powerful, and easier to use than mainframe REXX. For example, S/REXX has no limits on implementation size or shape. S/REXX also places no limitations on:

  • Procedure size
  • Expression complexity
  • Number of nested parentheses
  • Number and content of variables
  • Recursive function depth
  • Argument number and size

S/REXX also extends the REXX language to take advantage of UNIX operating system resources and facilities. S/REXX enables programmers to perform the same tasks on UNIX as they did on the mainframe with IBM's REXX. S/REXX provides a familiar language that can be used to create macros, perform system administration functions, and even develop applications.

Included with S/REXX is an implementation of the EXECIO instruction to facilitate the porting of REXX procedures from VM/CMS. The EXECIO instruction reads and writes to files, and prints on native UNIX printers. All options of the CMS EXECIO instruction are supported.

Figure 5. Excerpt from an S/REXX program.

Additionally, the following capabilities allow S/REXX to take full advantage of the UNIX environment not provided by REXX on the mainframe:

  • Execution of S/REXX programs by C programs
  • Execution of UNIX commands and use of the command output within S/REXX programs
  • Support for "Choices," a menu replacement appropriate for use in dialog boxes
  • Capability to access the S/REXX external data queue from within C programs
  • Support for SEDIT

Another feature allows users to build a collection of general utility routines to incorporate into different programs. The loaded procedure can become internal by dynamically loading external procedures. This is done by appending them to the main file, so they can share global variables. With mainframe REXX, external procedures included in separated files cannot share global variables with the main procedure.

Any external application offering a C program interface can be interfaced with S/REXX. The S/REXX programming interface allows users to create new ADDRESS environments. Sending data to these new environments activates usersupplied C subroutines which can retrieve and set S/REXX variables. It also is possible to add, in a similar way, user-supplied, built-in functions written in C. These capabilities make S/REXX an incredibly powerful development tool for UNIX.

In addition to extending the power and flexibility of the REXX language, S/REXX offers many built-in functions that provide access to UNIX facilities, including the following:

  • FD: Returns the directory part of a complete UNIX path name
    Example:  a = fd ("/usr/john/foo.c")
    returns:  "/usr/john"
  • FN: Returns the filename part of a complete UNIX path name
    Example:  a = fn("/usr/john/foo.c")
    returns:  "foo"
  • FT: Returns the filetype part of a complete UNIX path name
    Example:  a = ft("/usr/john/foo.c")
    returns:  ".c"
  • RM: Removes a file and returns its complete UNIX path name
    Example:  say rm("/foo")
    returns:  /usr/john/foo

S/REXX also enables users to retrieve the result of UNIX commands directly into a REXX expression with the use of backquotes. For example:


retrieves the station hostname and stores it in the variable 'a'.

As programmers become more familiar with the features of the UNIX environment, they will want to take advantage of the various UNIX Graphical User Interface (GUI) features. S/REXX is ready to grow with them. With its many UNIX-oriented extensions, S/REXX is a language that programmers may continue using for years to come, rather than an interim solution that they eventually discard.

S/REXX Debugger

S/REXX Debugger provides an interactive graphical debugging environment for S/REXX. It allows users to step through the execution of S/REXX programs, finding and fixing bugs quickly. This Debugger allows users to view the source program, stepping through its execution, setting or removing breakpoints, or changing source statements etc.

The Source area displays the source code for the program being debugged. The Breakpoint column allows the user to set breakpoints at specific lines in the code. The Command area is used to enter debugging commands. The I/O area is used by the S/REXX process to display its output, and permits the user to enter test strings to be sent to the S/REXX process.


SEDIT, S/REXX and the S/REXX Debugger support these popular UNIX operating systems:

  • Hewlett Packard HP-UX
  • Sun Microsystems, SunOS, and Solaris
  • Silicon Graphics IRIX
  • Linux
  • Santa Cruz Operation SCO UNIX
  • DEC Digital UNIX
  • PC Unixware
  • Siemens SINIX

Treehouse Software provides support for its products from its headquarters at 409 Broad Street, Suite 140, Sewickley, PA 15143-1511. Technical support is available 24 hours a day, 7 days a week through the technical support network at (412) 741-1677. Visit their homepage at: http://www.treehouse.com.

Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation