What can I use to edit program source in Unix Services on z/OS?

I hit this question trying to edit some Python programs on z/OS in Unix Services.

ISPF services

The easy answer for programs which are in EBCDIC or untagged, is just use ISPF edit, and you can use the HILITE command to highlight the constants and variables in the file. You can use this command to highlite, C, REXX, JCL, XML, assembler etc.

Example output for a C program.

Unfortunately although python supports EBCDIC source files, if you want to compile and package these files, they need to be ASCII files. The Unix Services command OEDIT will detect that the file as an ASCII file, and you can edit it, but not use the HILITE command.

To display the type of the file, use the Unix command ls -Tr *.py . This gave me

t ISO8859-1   T=on  cf.py        
- untagged    T=off aa.py        

Where cf.py is tagged as an ASCII file, an aa.py is an untagged file which defaults to EBCDIC.

Download to your work station

You can download ( FTP) these files to your work station, in binary and edit them. I use gedit on Linux. This has support built in for highlighting source.

IBM developer for z/OS.

This is an eclipse based package which allows you to edit data sets, submit jobs, debug programs etc. It has build in support for C, COBOL etc. When you right click on a file, you can select which editor to use, for example LPEX, a simple editor,a remote C/C++ editor, or an editor on your work station (gedit in my case).

For a python file (*.py), Eclipse downloads the file, and the choice is the eclipse simple text editor, or your workstation standard editor (gedit).

Pydev

Pydev is an Integrate Development Environment for Python on Eclipse (IBM Developer for z/OS). I had a few problems getting it working in Eclipse. (I had to use Pydev 8.2 because of incompatible Java release problem). This provides a Python editor with highlighting, and support for “twisties” where you can hide functions etc. As an editor this worked fine for most of the things I did. There were a couple of surprises.

I could not get the debugger to work, as it tried to debug running the Python program on my laptop – not on z/OS.

Whoops who over wrote my file

With all of the non ISPF techniques there is an integrity problem. If there are two people A and B and they want to edit the file at the same time.
With ISPF and ISPF

  • A edits the file
  • B is prevented from editing the file
  • A saves the updates

If A uses ISPF and B uses IBM developer

  • A edits the file
  • B edits the file
  • A saves the file
  • When B tries to save the file, it detects the last changed time stamp is different, and asks if you wan to overwrite it

If A uses ISPF and B uses IBM developer

  • A edits the file
  • B edits the file
  • B saves the file, and as the last changed time stamp has not changed, the save is successful
  • A saves the file, and overwrites the changes B made.

If you use FTP or similar to download the files, there is no locking, and the last person to save will overwrite any previous updates from other people.

Using filters on IBM Developer to limit what is displayed

I was using IBM Developer for z/OS (known as ID/z) to use Eclipse to access files on z/OS, and so use the Eclipse editors and other facilities. The files were displayed in a window, but did not have the handy PF7 and PF8 to scroll through the list. I also had a mixture of python source files, and other files.

I knew there was a way of filtering the displays, but it was a challenge to get this to work.

The easy bit – creating a filter

Under the Remote Systems (Window -> Show view -> Remote systems) it had my connections to z/OS systems, and a tree of my USS files.

On an subdirectory in the tree, right click -> New -> Filter. This gives

  • You can specify (or browse for) a subdirectory
  • You can either filer on file name of file type.

To filter for file type

You cannot type in the file type field. Click on Select… . You can either select from the existing list, or create your own extension. I created .py. This appears in the File types filter box as py, .

If Show files only is unticked, then the filter will displayed the directories below the path you specified as well as any matching files. If this is selected, then only the filtered file names are displayed

When you press Next it prompts you for a name.

When you get back to the Remote systems, window, you should see your filter in the list. If you open the twistie you will see the files you specified.

Changing the filter

This was initially hard because I was not familiar with the Eclipse usage.

Right click on the filter, -> Properties -> Filter Strings and you can change the information in the filter. Click Apply and Close to finish.

Extending the filter

As well as changing a filter, you can add new filter strings. Click on “New filter string”, fill in the details and select “Apply and Close”.

I could not see how to delete a filter once created.

Go into

Although you have filtered the list of files, you have all of the connections, and other displayed information. If you right click a directory, or filter and “go into” you get just that directory or filter output displayed.

Select the folder with an up arrow in it to get back.

Filter pools

You can have a hierarchy of filters, so I could have a set

  • MQ filters – with all of the filter I use for developing MQ applications
  • Python filters – with the filters I use for creating python program, and python unit tests

You can display or hide this through the twistie (menu button) at the top right of the Remote Systems window.

To create a new filter pool, ignore what the documentation says. Where you have “Z/OS UNIX files”, right click on it -> new -> Filter pool.

More information

You can display more information using “Window-> Show view -> Remote Systems -> team”