Lesson 1. Exercises.

Tailor your PROFILE XEDIT.

If you don't have a PROFILE XEDIT of your own on your A-disk, you may use one existing on a system disk.

We propose you to tailor your own PROFILE XEDIT.  In order not to re-invent the wheel, look at the sample PROFILE XEDIT that you can find in the toolkit.  Use it for a few files and see if you like the screen layout.

Next, analyze the contents of this mini PROFILE XEDIT.  Go through the file and try to understand the different statements and subcommands.  Use the HELP to learn about the commands you don't understand.  Change to your taste where you want (e.g. the colors).

Finally, as a coding exercise, you should add an extra function to the PROFILE :

Exercise : Enhance PROFILE XEDIT

When you edit a new procedure, it is nice to have it initialized with some statements that you always need and with a starting comment box containing the name, date of creation and function of the procedure.

The start of an EXEC could contain something like this :

 /*********************************************************************/
 /* PROCNAME - Created by USERID on 18 Apr 2000 at 12:12:17           */
 /* Function :                                                        */
 /* Parameters :                                                      */
 /*********************************************************************/
 address command
 parse upper source . . myname mytype . syn .
 parse arg params '(' options

followed by a series of empty records so that you can immediately start your coding. 

If you want, you can also make that our general error exit routine is included at the end of your file.

Adapt the PROFILE so that this is executed for a new procedure.  You will be faced with some problems such as how to detect if it is a new file.  Try to find the solution.

Note: in order not to be caught by the problem that your PROFILE XEDIT abends, and thus no longer allows you to edit the file to correct it, make a copy of the mini PROFILE XEDIT, and name it MYPROF XEDIT for example.  Then, use the command

   xedit my test a (prof myprof

to edit a file.  The PROFile option of XEDIT overrides the standard name for the profile, so in this example you will use your version.  If that fails to work, then omit the prof option to use a working PROFILE XEDIT.

Once you have a working solution, you can copy it to the PROFILE XEDIT.  Then you can continue to enhance the procedure via your MYPROF XEDIT as suggested in this second part of the exercise:

Exercise : Further enhance PROFILE XEDIT

In the previous exercise, you used your User-id in the first comment line for a new procedure.  But this can be meaningless. USER0005 doesn't say much to others.  So, it would be nice to have somehow your full name (and optionally your address) in the prologue of the procedure.

This could give something like :

 /*********************************************************************/
 /* PROCNAME - Created by Guy De Ceulaer on 18 Apr 2000 at 12:12:17   */
 /*            IBM Belgium - VM Support                               */
 /*            Square Victoria Regina, 1 - B 1210 Brussels, Belgium   */
 /* Function :                                                        */
 /* Parameters :                                                      */
 /*********************************************************************/
 ...

Where can this information come from ?  The most standard way of storing this information in VM/ESA is to put it in a NAMES file.

Steps

  1. Issue the NAMES command and complete the panel with your identifications.  Use me as your nickname.

  2. Edit the file that is created by the NAMES command and study the contents of it (that is if you don't know yet what a NAMES file looks like).

  3. Issue the command NAMEFIND :nick myself  from the CMS command line and look at the output.  You see that you can extract data from the names file based on a keyword (:nick) in this case.  But you can use any keyword tag and you can also limit your output to those fields you want to see.  Study the NAMEFIND command (via HELP) to see how you can use it in procedures to extract data from a NAMES file.

  4. Adapt your PROFILE XEDIT to make the changes as suggested above.

You can now have a look at our commented solution.

These were the exercises for Lesson 1.  Lesson 2 covers the aspects of tracing and debugging, and starts with chapter 4.