MFATC Mainframe Assembler Technique Comarison Demos in HLASM, HLA, C++, COBOL, and Java

MFATC Mainframe Assembler Technique Comparisons between
z390, HLA, C++, COBOL, and Java

See What's New

z390 Portable Mainframe Assembler and Emulator
MFATC Demo Source Programs:
  1. Hello World
  2. Powers of 2
  3. MIP Ratings
  4. Square Root of 2

There are 5 versions of each demo written n HLASM, HLA, C++, COBOL, and Java which you can download, compile, and execute.

Free Download Links:
  1. MFATC demo source code
  2. z390 Assembler Coding Contest
  3. z390 mainframe assembler
  4. HLA Intel Pentium assembler
  5. Microsoft Visual C++ Express
  6. Microsoft MASM Assembler
  7. Fujitsu Student COBOL
  8. Sun Microsystems J2SE Java
  9. PEDASM Disassembler
Language Reference Links:
  1. z390 Mainframe Assembler
  2. HLA Intel Pentium Assembler
  3. Microsoft Visual C++ Express
  4. Fujitsu Student COBOL
  5. Sun Microsystems J2SE Java

 

This www.mfatc.org page contains source demo programs showing coding techniques in IBM mainframe assembler, Intel assembler, C++ , COBOL, and Java programming languages using the following free tools available for Windows 2000/XP using InstallShield standard install software.

In the end all higher level languages either generate machine specific assembler code or portable pseudo code which results in calling machine specific assembler code at execution time.  All of the examples have been compiled and executed using the above free tools.  If you find this page useful, join the MFATC discussion group and submit your comments, questions, and suggestions.   Don Higgins
 
# Coding Technique z390 HLA Visual C++ FSC COBOL J2SE Java
1 "Hello World" Demos

See links for source programs, generated output, and help with installation and execution of demos.  See notes on demo below.
  1. MLC
  2. BAL
  3. PRN
  4. LOG
  5. HELP

5 lines

  1. HLA
  2. ASM
  3. LST
  4. MAP
  5. HELP

5 lines

  1. CPP
  2. ASM
  3. HELP

 

5 lines

  1. COB
  2. HELP


 

4 lines

  1. JAVA
  2. VM
  3. HELP

 

5 lines

  "Hello World" Demo Notes:
  1. Each HELLO demo source program is only 4-5 lines,
  2. Each HELLO demo uses system library macros and/or function which in turn calls operating system service to display the "Hello World" message.  
  3. The z390 mainframe assembler version uses WTO write to operator macro and svc 35 service.
  4. The HLA Intel assembler version uses HLA printf service which expands to MASM library call.
  5. The C++ version uses printf which also expands to MASM library call.
  6. The COBOL version uses DISPLAY verb.
  7. The J2SE Java version uses println service.
2 Powers of 2 from 0 to 31 Demos

 
  1. MLC
  2. PRN
  3. LOG

23 lines

  1. HLA
  2. ASM


14 lines

  1. CPP
  2. ASM


9 lines

  1. COB



12 lines

  1. JAVA
  2. VM


11 lines

  Powers of 2 demo notes:
  1. Each demo uses structured programming to perform iteration without any go to branches.
  2. The mainframe assembler version uses packed decimal edit instructions to format output.
  3. All the other demos use system display services to convert and display integer values.
3 Calculate MIP rate demos
 
  1. MLC
  2. PRN
  3. LOG

44 lines
1.2 MIPS

  1. HLA
  2. ASM
     

43 lines
5840 MIPS

  1. CPP
  2. ASM
     

28 lines
776 MIPS

  1. COB
  2. ASM
     

70 lines
68 MIPS

  1. JAVA
  2. VM
     

34 lines
1430 MIPS

  MIPS calculation demo notes:
 
  1. Each of the 5 MIPS demo programs measures speed of instruction loop decrementing a 32 bit integer counter until 0.  The results shown are for 3.05 GHZ Dell Pentium 4. 
  2. The 1.2 MIP z390 mainframe assembler version is the slowest due to overhead of mainframe emulation.  However a free 1.2 MIPS mainframe on your Windows desktop is more than enough speed for most applications which are usually I/O bound anyway.  Note this performance level uses z390 v1.1.01.
  3. The 5840 MIP native Intel assembler version is by far the fastest due to Pentium 4 pipelining achieving close to 2 instructions per machine cycle.
  4. The C++ generated native code is slower that the HLA version due to extra memory and instruction fetches associated with using memory variable field instead of cached register storage.
  5. The COBOL generated native code is noticeable slower than the C++ generated code since it does several conversions from Big Indian integer storage to native Little Indian integer storage in order to perform native decrements and compares.
  6. The J2SE Java code outperforms the C++ code due to J2RE runtime hotspot optimization feature.  The ability of a virtual machine runtime to outperform a native code generating compiler is very impressive.
2 Square root of 2 Demos

 
  1. MLC
  2. PRN
  3. LOG

58 lines for 32, 64, and 128 bit

  1. HLA
  2. ASM


41 lines for 32, 64, and 80 bit

  1. CPP
  2. ASM


26 lines for 32 and 64 bit

  1. COB



16 lines for 32 and 64 bit

  1. JAVA
  2. VM


83 lines for 32, 64, 128 plus 80 digits

  Square root of 2 demo notes:
 
  1. Each of the 5 demos calculates and displays the square root of 2 using IEEE 32 bit precision (EB short binary, real32, float, comp-1, and float types respectively) and the IEEE 64 bit precision (DB long binary, real64, double, comp-2, and double types respectively).  The 32 bit format has about 8 decimal digit precision and the 64 bit format has about 15 decimal digit precision.
  2. For verification of the results see this NASA web page with target value of the square root of 2.
  3. HLASM and Java demos also calculate the IEEE 128 bit precision (LB extended binary and BigDecimal MathContext DECIMAL128 respectively) square root of 2 which has about 34 decimal digits.  The z390 version also uses new CTD Convert to Display macro and svc 170 to convert any 128 bit integer or floating point value to EBCDIC display format.  This new service is in z390 v1.1.01a.  CTD supports both hex and binary mainframe formats. 
  4. The  HLA demo also calculates the native Intel floating point coprocessor 80 bit precision result which has about 18 decimal digit precision.  This format is used on Intel for both 32 bit and 64 bit format native calculations and then rounded to requested storage format as required.
  5. The J2SE Java demo uses the arbitrary precision BigDecimal class to calculate both the IEEE 128 bit precision and also 80 decimal digit precision square root of 2.  Note since there is no built in square root method for BigDecimal class, the demo calculates an initial guess using double precision build in function and then uses Newton Raphson method to iterate to achieve requested precision.  The demo uses 2 iterations for 128 bit precision and 3 iterations for the 80 digit precision result.
     

.This page last updated Wednesday January 16, 2008.   Webmaster 
Copyright 2007 Automated Software Tools Corporation