| Front Page | News Headlines | Technical Headlines | Planning Features | Advanced Search |
Design 3000 Sponsor Message

     

Inside COBOL: Native IA-64 plans, and table tips

By Shawn M. Gordon

I spent some time beginning to read “An Introduction to Object Cobol” by E. Reed Doke and Bill C. Hardgrave this last month, and so far I can highly recommend it. It’s more of a textbook, and at 272 pages, not as thick as you would think. I’ll write up more of a review after I finish reading it.

I just got an early report from the NewsWire about some interesting news regarding COBOL on IA-64. HP has confirmed that COBOL, C, C++ and Java will ship in Native Mode for the IA-64 HP 3000s when they first come out. There is some question as to which C++ compiler will be used, but I believe it will probably be GNU’s freeware, currently in use on the 3000s.

This is extremely good news for us COBOL enthusiasts (not so good for the FORTRAN and Pascal people, though). While HP has committed to COBOL, they haven’t committed to which COBOL. I’m assuming at this point that HP will continue to develop and maintain the COBOL compiler for the HP 3000, since there doesn’t seem to be a viable alternative. My concern is whether they are going to try to keep COBOL for the PA-RISC HP 3000s up to date or not.

In case you didn’t know, the HP implementation of COBOL is missing a fair number of features from the ANSI specification, such as the SCREEN section and REPORT section. I’m not even sure how the REPORT section works, but the SCREEN section could have been implemented to wrap VPlus, saving us from coding the VPlus intrinsics and making our code more portable.

The big question is whether HP will try to go for the COBOL 2000 standard and include the Object Oriented features that are described in it. If you’ve read the last couple of months worth of columns, you know what a big shift this will be — it will probably require enormous effort and commitment from HP.

There has been a survey discussion on the Internet about what features and things you would like to see in the next release of COBOL. Since HP is in the planning stages at this point, it’s important to let them know how you feel about what you would like to see in the next release. You can send e-mail to Interex Special Interest Group leader Jeanette Nutsford at cobol-leader@interex.org. For those at HP is reading this, count my vote for including OO COBOL in the next COBOL compiler.

Creating files, and the VALUE clause in tables

There was some recent discussion on the Internet about how to have COBOL create a file with something other than the default number of records. Doug Werth of Beechglen put up a nice succinct example, one that also shows the use of dynamic name assignment in the SELECT..ASSIGN (see Figure 1 below):

Figure 1


001100 IDENTIFICATION DIVISION.
001200 PROGRAM-ID. COBTEST.
001300 ENVIRONMENT DIVISION.
001400 CONFIGURATION SECTION.
001500 SPECIAL-NAMES.
001600     CONDITION-CODE IS C-C.
001700 INPUT-OUTPUT SECTION.
001800
001900 FILE-CONTROL.
002000     SELECT FILE1 ASSIGN TO "TEST,,,,55000" USING DYNAMIC-NAME.
002100 I-O-CONTROL.
002200 DATA DIVISION.
002300 FILE SECTION.
002400 FD FILE1.
002500 01 FILE1-RECORD PIC X(80).
002600
002700 WORKING-STORAGE SECTION.
002800 01 PROGRAM-NAME PIC X(26) VALUE SPACES.
002900
002902 01 DYNAMIC-NAME     PIC X(16) VALUE "FILENAME".
003000 PROCEDURE DIVISION.
003100 0000-CONTROL-PROCESS.
003300     MOVE "MYFILE" TO DYNAMIC-NAME.
003400     OPEN OUTPUT FILE1.
003500     CLOSE FILE1.
003600     STOP RUN.

:run cobtest
:listftemp,2

FILENAME  CODE  ------------LOGICAL RECORD-----------  ----SPACE----
                   SIZE  TYP        EOF      LIMIT R/B  SECTORS #X MX

MYFILE             80B  FA           0      55000   3        0  0  *
(TEMP)

On another topic, I ended up in an interesting trivia conversation with some programmers recently on whether you could use a VALUE clause on a table. I don’t know when this changed, but when I wanted to initialize all the members of a table I would usually declare a buffer, and then redefine it as a table, then I could move spaces to the buffer or set VALUE SPACES on it at declaration time.

Well guess what? You can put a VALUE clause on the table declaration itself, as in:

01 MY-TABLE.
03 MT1 PIC X(10) OCCURS 5 VALUE ZEROES.

Now if I do a display of the data as in:

DISPLAY ‘[‘ MT1(1) ‘]’.
DISPLAY ‘[‘ MT1(2) ‘]’.
DISPLAY ‘[‘ MT1(3) ‘]’.
DISPLAY ‘[‘ MT1(4) ‘]’.
DISPLAY ‘[‘ MT1(5) ‘]’.

I will get the following display

[0000000000]
[0000000000]
[0000000000]
[0000000000]
[0000000000]

I can then do MOVE SPACES TO MY-TABLE and all of the occurrences of MT1 will have spaces in them.

Well, that’s it for this month. Keep those tips coming. As always, I welcome your input to this column. Earn yourself a free 3000 Always Online hat for tips you submit, either to the NewsWire or to me at shawn@smga3000.com.

Shawn Gordon, whose S.M. Gordon & Associates firm supplies HP 3000 utilities, has worked with 3000s since 1983.

 


Copyright The 3000 NewsWire. All rights reserved.