Sahananda's Rexx bits and bobs

OOrexx & OODialog   KEDIT Macros   Classic Rexx   

Me and REXX

I learnt REXX when it became available on VM/CMS back in the eighties.  Later when I was taking a break from the world of computers a friend asked me to do a data recovery job & needing a cheap but effective language to use on my PC at home I acquired PC DOS 7 specifically for it's version of REXX.  I now work for the trading wing of a charity and started out writing an ordering system for the shops in Quercus Systems Personal REXX 3 for DOS.  Since 2001 I've been using Object REXX (ooRexx) on Windows.

Download ooRexx here for free

Currently an article that Howard Fosdick & I wrote can be found here

And here is a newer one we wrote about handling SQL queries using ooRexx

About the downloads

Often when I talk to REXX coders about pieces of their work they say 'Of course I wouldn't have written it like that now.'  I feel the same.  Part of the joy of coding in Rexx is the sense that there is always more to learn.  What I offer below are bits of my work that I wrote because I needed them, rather than polished textbook examples.  They all did what they were meant to do in the context that they were written for and chances are that they will work for you in the context you use them, but I can offer no warranty with them.  If you have trouble with them or can improve on them, then you are welcome to contact me.

ooRexx and OODialog

   CsvStream.class    

This class extends the stream class to allow you to read/write directly between CSV files and Array or Table objects. 

2007-01-12 v1.05 (Open & Close without parms behave like stream class + bugfixes)
2007-01-05 v1.04 (accepts stem objects & column 0 bugfix)
2006- 12-28 v1.02 (fixes bug & allows specification of qualifiers & delimiters)

 OODialog GUI Template

(NB: This is now part of the ooRexx distribution as of 3.1.1)

When OODialog came from IBM there was a GUI IDE included called Resource workshop.   I stopped using it once I got a bit of a feel for how the ooDialog Classes worked because I found it easier to have all my code in one place and hard to amend code written with the IDE.  Here is a template that you can use to craft OODialog GUIs without the IDE.  You will need the OODialog reference to hand.  (I recommend also using DlgAreas below)

NB: It is possible to use ooDialog with resource files produced by any resource editor.  There are a number of free or inexpensive ones available if you really want that functionality.

  DlgArea Class

(NB: This is part of the ooRexx Distribution as of 3.1.1)

Use DlgAreas to help you organise your DefineDialog method when coding OODialog UserDialog SubClasses.  Allows you to define areas as subareas of each other in Dialog Units or as percentages.  
DlgAreaU  Class facilitates the creation of resizable dialogs under OODialog.  
Zip includes classes, examples and pdf manual.

Improved DatePick

A calendar utility - functions fine, but I'd happily accept improvements to it's appearance.

parameters
date - a date in standard date('s') form
x y - where to place the dialog box on the screen
title - the dialogs title
[USA/ISO] - First day of week is Sunday or Monday


If no date is provided or date not in standard form, today's date is used

v1.01 First day of week will default to  Sunday if Windows International Settings indicate User is in USA or Monday if anywhere else.

v1.02 (19Jul07) Column header alignment improved.  Clicking on focused button also selects

(semi-retired)

BrowseForFolder

 

NB: Whilst I have not withdrawn BrowseForFolder Lee Peedin demonstrates a much simpler approach for WIndows XP which I would encourage coders to use instead at Lee's Page 

A utility class that provides a dialog to browse for a folder.

Parameters are: 
Window Title (default='Select a Folder') 
First Drive (default=c:) 
Window width (default=200) 
Window height (default=200) 
Start Location (default=root) 
Allow creation of new folders (pass 0 to suppress) 

Example of use
MyBrowser=.BrowseForFolder~new() 
MyBrowser~execute('Showtop') 
SelectedFolder=MyBrowser~folder 
MyBrowser~DeInstall 

Top of Page

Kedit Macros

KEDIT is a brilliant editor.  I use it for just about everything.  
These are supplied as is.  The REXX specific ones work with IBM Object REXX.  
There are lots of other downloadable bits at www.kedit.com    

Rexpand.kml

Rexpand.kml contains a suite of Kedit Macros which provide Syntax Expansion facilities for coders in REXX or KEXX. 

These macros imitate the Syntax Expansion facilities provided for REXX programming with the 'E' editor provided with PC DOS 7. 

When enabled, Rexpand watches for the Keywords IF, DO, SELECT, WHEN & '/*' and when it sees them it completes the REXX structure, So if it sees a 'DO' for instance it puts a matching 'END' in. If it sees an 'IF', it puts in a 'THEN' & an 'ELSE'. 
This makes the task of writing REXX code easier. 

Full instructions are in the KML file.

 RexIndex

Provides a handy popup menu of functions, procedures, methods etc.. to navigate to in current REXX program.
Now presents targets in alphabetic order.

Stamp

Allows you to put (my style) version control stamps on the current line of REXX/KEXX programs

Jump

I like this one.  Prefix your Kedit command with jump and then later you can get back to where you were.  Handy for poking into procedures.

for instance JUMP /MyRoutine: will carry out the locate for MyRoutine:.  when you're ready to go back just type JUMP.

CSVsort

Sort a CSV file by nth field.  Will only work if there are no tab chars in the file and no commas within literals.  Will tell the user if it cannot sort.

XalKlds.zip

Kedit Language definitions for Microsoft® Business Solutions–XAL (a.k.a. Navision (a.k.a. Concorde)) Accountancy package's XAL language.

NB: XAL is not a lexically consistent language.  Sometimes the same tokens are used in different ways depending on the context.

PP6Mak.KLD

Kedit Language definitions for working with Advanced PayPoint Solutions PayPoint 6 EPoS Till Macro Language.  

Top of page

Classic Rexx

CSV2STEM

Places fields from a line of a CSV (Comma Separated Values) file into a stem variable.  This routine which you can paste into your code respects commas within literals and replaces "" by " thus coping with all the vagaries I've ever seen in CSV files. (June 2006: Thanks to Konishi Keisuke who fixed a bug if you had multiple adjacent " characters)

Top of page

Feedback

Please let me know if you have found things handy or if you've improved them.  
E mail me at Sahananda at sahananda.fwbo.net

Sahananda Home
Rexx Language Association
Howard's really useful Rexx Site

Page edited 29 March 2008