EURONAME

Detecting MONEY-variables in COBOL COPY-books and Programs.

A Product of the EURO*Transformer Toolset

Overview

COBOL as one of the most successful and widely used programming languages for commercial applications unfortunately does not provide specific data-types for Date and/or Money variables.

This is a historical fact stemming from times when object-oriented thinking was still beyond the horizon and has never been augmented for whatever reasons. This fact caused programmers and users a lot of [unnecessary] troubles during the past years.

If data types like DATE [with images like YYYY/WW or YYMMDD or YYYY-MM-DD, DDMMYY, MM/DD/YYYY  etc etc) and MONEY variables had been introduced by COMPILER manufacturers a reasonable period before the Y2K-hype and the EURO transition, an incredible amount of man-hours for program adaption etc could have been saved.

Fortunately, most  programmers do use structured names, where the single components of a name are delimited by hyphens (in COBOL), or underlines (in SQL) together with naming patterns which somehow show the semantics of the names.
This fact has been used both for recognition of DATE-items and MONEY-items in the various modules of DO*IT 1999, DB-123, and the Euro*Transformer toolset.

Generally speaking, each item in a program belongs to one and only one  CLASS in DB-123. 

A CLASS-Definition file is used to define the item-CLASSES you are interested in, and this item-Class augments the item-attributes already available in COBOL, like PICTURE, USAGE, VALUE, etc.

Example - a typical CLASSDEF-file (from an application in German language) will look as follows:

europa.classdef      2004-03-12 16:41:02

/**********************************************************************/
/* EUROPA CLASSDEF:                                                   */
/*          MONEY NAME RULES FOR EURO ANALYSIS                        */
/**********************************************************************/
/* Initial version for GERMAN variable names                          */
/* >>> USE CASE MIXED FOR UPDATE, PLEASE  <<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
/* updated 01.09.2000: introduce NCU and CURRENCY fields              */
/**********************************************************************/
CLASS-NAMES:

   Text: TEXT FEHLER ZEILE TXT
   Key:   NUMMER *NR NO KONTO KONTONUMMER *NUMMER*
   Key:   *KST KOSTENSTELLE
   Key:   *SCHLUESSEL *SCHL
   Key:   KOSTENTR KONTENTRAEGER *KSTR
   Code:  KENNZEICHEN *FLAG *KZ *CODE *KENNZ
   Prfz:  PRUEFZIFFER *PRFZ
   Plz:   *PLZ POSTLEITZAHL

   Count: INDEX I J K L M N
   Count: LINE LNO LINENO
   Count: LOWKEY HIGHKEY
   Count: PROZENT PRZ PRZT PROZ
   Count: MENGE
   Count: GEWICHT VOLUMEN
   Count: LNG LEN LENGTH LAENGE WIDTH BREITE HEIGHT HOEHE
   Count: FLAECHE VOLUMEN
   Count: ZAEHLER ANZAHL ANZ *ANZAHL COUNTER OK
   Count: POSITION POS ZEILE ZEILEN
   Count: BELEGT

  Money: *PREIS *SALDO *BETRAG *SOLL *HABEN *PKU *WERT *SPESEN
  Money: RABATT MONEY GELD ANZAHLUNG ZAHLUNG BETR
  Money: *RATE *RATEN RATENPREIS EINZELRATE RATENZUSCHLAG
  Money: BRUTTO NETTO
  Money: LOHN GEHALT
  Money: MAHNUNG MAHNBETRAG
  Money: PROVISION PROV PROVIS
  Money: UMSATZ UMSA *UMSATZ
  Money: GUTSCHRIFT BELASTUNG
  
* ... numeric fields measured in EURO (sub-class of Money)
  Euro: EUR EURO
  Euro-round-error: ERR
* ... numeric fields measured in NCU (sub-class of Money)
* ... NCU ::= National currency UNIT
  NCU: NCU

* ... Currency field by record
  Currency: CURRENCY CUR

CLASS-ARITHMETIC:
* ... List precedence
* ... comma is LIST operator
 Text , Money ==> NOP
 Text , Count ==> NOP
 Text , Key   ==> NOP
 Text , Code  ==> NOP
 Text , Plz ==> NOP
 Text , Char ==> NOP
 Text , Code ==> NOP
*
 Code , Count ==> NOP
 Key , Count ==> NOP
 Key , Code  ==> NOP
 Money , Count ==> Money
 Plz , Count ==> Plz
 Date , Count ==> NOP
*
 Code , Money ==> conflict
 Key , Money ==> conflict
 Date , Money ==> conflict
* ... Count is dimensionless quantity
 Count + Count ==> Count
 Code + Count ==> Code
 Key + Count ==> Key
 Date + Count ==> Date
 Money + Count ==> conflict
 Money + Money ==> Money

 Count * Count ==> Count
 Money * Count ==> Money
 Money * Money ==> Money**2
 Money * Money**2 ==> Money**3
 Money**-1 * Money ==> Count

CLASS-MARKER:

  §..  Date

********************************************************************
* ... all money fields have a $ as the first char in the marker
*     to be able to locate them quickly by ALL/$/ in the Editor
********************************************************************
  $>>  Money
  $+2  Money**2
  $+3  Money**3
  $-1  Money**-1
*******************************************************************  
* ... new marker for definite EURO-values and ROUNDING-ERROR
*     introduced with EUROFILE program generator vs. 3.00
*******************************************************************
  $NC  in-NCU
  $EU  Euro
  $ER  Euro-round-error
* ... measured in National Currency
  $NC NCU
* ... currency field by record
  $CU  Currency
*************************************************************
  COD  Code
  CNT  Count
  PFZ  Prfz
  KEY  Key
  PLZ  Plz
  TXT  Text

You may obtain details for this EUROPA.CLASSDEF File from the EURO*Transformer Programmer Guide, but basically the rules are as follows:

  • The Components of each COBOL Name (delimited by a hyphen) are inspected from RIGHT to LEFT and compared to the CLASS-NAMES Patterns as defined in EUROPA.CLASSDEF.
  • The first match wins, and assigns the specified item-class to this COBOl-item. 
  • The specified Class-Marker for this class is then used to MARK the COBOL item declaration in the COBOL Prefix area.

Advantages

When your source code uses structured names following the rules above, then you will not even have to mark your MONEY fields manually at all. This method may save a lot of manual typing and will let the EURONAME preprocessor do the work.

Ambiguities are reported so the preparation of the source code for a type-consistent migration is reduced to one or more analyzing runs with limited human intervention to decide ambiguous items.

EURONAME is invoked by an option automatically for each COBOL copy-book or COBOL Declaration when desired.

System Environments

  • IBM Platforms CMS, OS/390 as compressed/compiled REXX or
  • Java virtual machine (JVM) for Windows 95 or higher
  • Java virtual machine (JVM) for Unix/Linux platforms
  • COBOL 85-Compiler

Other available Products of the EURO*Transformer Tool-set

    Generalized DATA Dictionary Definition.

EUROFILE

    EURO conversion program generator

    EURONAME

    Automatic, table-controlled recognition of "amount"-fields by means of fieldname- and picture parsing.

    IBM CICS Screen-Switcher which recalculates on the fly the display-values of either local currency or EURO.

EUROPA

    EURO COBOL Program Analyser


    Licences/contacts

    For any questions or licencing information please contact: office@db-123.com

back to general remarks