Home > CICSPlex SM, programming, rant > CICSPlex SM API COBOL copybooks

CICSPlex SM API COBOL copybooks

<rant>

I hate the CICSPlex SM COBOL copybooks that IBM supplies for Resource Tables. Well maybe hate is a bit extreme, so how about strong dislike?

Now Chris will probably mutter something obscene into his Irn-Bru when he reads this, but I write CICSPlex SM API programs using COBOL…. I find it quick and easy to throw something together.

So what don’t I like about the copybooks?

Well lets look at a snippet of the TASK copybook (some comments removed):

       * Active tasks
       01 TASK.
      * CICS System Name
         02 EYU-CICSNAME             PIC X(8).
      * CICS System Release
         02 EYU-CICSREL              PIC X(4).
      * Reserved
         02 EYU-RESERVED             PIC X(4).
      * Task ID — Reserved Word —
         02 TASK-A                     PIC S9(7) USAGE PACKED-DECIMAL.
      * Principal facility
         02 FACILITY                 PIC X(4).
<snip>
      * Task start time — Reserved Word —
         02 START-R                    PIC S9(16) USAGE BINARY.
      * Task stop time — Reserved Word —
         02 STOP-R                     PIC S9(16) USAGE BINARY.
      * VTAM LU name *
        02 LUNAME                    PIC X(8).

So why are some of the data names suffixed with -R, and others with -A?

The -R suffixed data names occur when the data item conflicts with a COBOL reserved word, so for example, we have START-R and STOP-R because COBOL uses STOP and START for something else.

The -A suffixed data names occur when the data item conflicts with a CICSPlex SM resource table name. e.g. this is the TASK resource table, but the attribute in the TASK resource table that contains the task number is also called TASK. The -A suffix is added to the 02 level TASK attribute because otherwise we would have a duplicate reference. While COBOL allows you to qualify subordinate data names e.g. MOVE PEAS IN POD TO SOMETHING, you cannot qualify a level 01 data name.

During development of CICSPlex SM 2.3 we seriously considered changing the way the COBOL copybooks are generated, for example something like:

      * Active tasks
       01 TASK.
      * CICS System Name
         02 TASK-EYU-CICSNAME        PIC X(8).
      * CICS System Release
         02 TASK-EYU-CICSREL         PIC X(4).
      * Reserved
         02 TASK-EYU-RESERVED        PIC X(4).
      * Task ID — Reserved Word —
         02 TASK-TASK                PIC S9(7) USAGE PACKED-DECIMAL.
      * Principal facility
         02 TASK-FACILITY            PIC X(4).
<snip>
      * Task start time — Reserved Word —
         02 TASK-START               PIC S9(16) USAGE BINARY.
      * Task stop time — Reserved Word —
         02 TASK-STOP                PIC S9(16) USAGE BINARY.
      * VTAM LU name *
        02 TASK-LUNAME               PIC X(8).

However if we did this, we would still run into problems:

  1. Compatibility – At a stroke we would break customers that had existing programs and recompiled with the new copybooks because of the changed data names.
  2. Limits – The COBOL compiler only supports data names of 30 characters or less. CICSPlex SM resource tables can be 8 bytes long, attribute names can be up to 12 bytes long, but as some attributes have values defined, which can also be up to 12 bytes long, that would mean a maximum data name length of 8+1+12+1+12 , which is 4 bytes over the limit. Doh!

So because of these two problems, we kept with the existing format and have to put up with the confusing and annoying suffixes.

</rant>

Grant

Update: Added a link for Irn-Bru

Advertisements
Categories: CICSPlex SM, programming, rant
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: