Does anyone know assembly languge?

Posted on 1997-11-05
Last Modified: 2010-07-27

I am currently working on a problem in assembly....and I was wondering
if you could help me....Here is the question.....
Insurance sales: Find the insurance agent who sold the most premiums for
the year. The format for the input consists of the following:

columns            Field Names
01-15               Insurance agent
16-18               Policy premium
25-27               Number of policies sold

Input data:

Roy Marx             $750                       100
Cathy Reed            423                       231
Tex Lacey             214                       175
Phillip Nye           486                       109

There are more ...but I think you get the general goes onto say

Find the top agent of the year. Determins who sold the most premiums.
Premiums sold= premium per policy * policies sold.

        Produce a report listing each agent and the premium sold by that
agent.At the end of the report, print name of the top sales agent and
the premium sold.

It would also like to have the program modified to include the agent
with the lowest sales for the year.

So I guess what I am asking I am not real sure how to set this problem
up....could you please help me....? Thanks for any info....
Question by:Saphire38
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 1256157
1. What language - (target processor)  x86?
2. What memory model - small?
3. Do you need a C- assembly interface? (Will you be calling the assembly language routine from C)
4. Is inline assembly in C or C++ acceptable?
5. Is this a console app under Windows? (Whats the output device)

Author Comment

ID: 1256158
Question is assembly language for the IBM system 370 modular approach..
Question 2...Not sure what you mean....?
Question 3...No I will not be calling it from C...
Question 4...would it be the same as a PC 370?
Question 5...Not sure what you mean....?

This is the program that I am running this assembly problem on...
READ.ME PC/370 Release 4.2 Installation Guide

Copyright 1988 Donald S. Higgins

                                  Don Higgins
                                  6365 - 32 Avenue North
                                  St. Petersburg, Florida 33710
                                  January 5, 1988

PC/370 users:

Welcome to release 4.2 of the PC/370 cross assembler and emulator
package!  You are encouraged to copy and share this package with other
users on the condition that the package is not distributed in modified
form, and that no fee is charged.  If you find the PC/370 product
useful, send 45 dollars to the address above to register as a user and
to support continued shareware maintenance and enhancements.
Registered users will receive notices of future releases.  The product
is distributed on an as is basis with no implied warranties.  However,
requests for fixes and enhancements from registered users are given
priority for inclusion in future releases.  Currently planned future
enhancements are as follows:

  1.  Assembler H support with integrated macros.

  2.  Expanded memory support using protected mode on 80286/80386
      running under native OS/2.

  3.  Improved 370 emulation performance using additional math co-
      processor assists for packed decimal and native 80386 32 bit
      instructions.  (Note the current speed of the PC/370 emulator on
      a 16 MHZ 80386 is in the range of 25,000 IBM 370 instructions
      per second or 0.025 MIP's.)

The major features included since PC/370 release 3.2 are as follows:

  1.  Micro Focus COBOL/2 Extended Memory (XM) protected mode calls to
      PC/370 assembler subroutines are supported on 80286 and 80386
      systems.  XM supports up to 16MB of real memory usable by COBOL
      and PC/370 assembler subroutines.  See USER.DOC for more
      information.  This facility requires use of new resident option
      of emulator, and option B of linker to create BIN type module.

  2.  The following PC/370 supervisor calls have been added:

      a.  Svc 36 reloads program into specified area of memory.
      b.  Svc 37 defines user exits for supervisor calls.

  3.  The SPIE svc 14 has been enhanced to create program
      interruption element control block and to pass sufficient
      information to support transparent program check recovery.

  4.  At entry to main programs, register 1 now points to standard
      MVS parameter list address, which in turn points to half
      word parm length followed by EBCDIC parameters passed from
      MS-DOS command line.

  5.  An optional hardware assist for the CVB and CVD instructions
      is included which requires the 80x87 math co-processor and
      can speed up the instructions by up to a factor of 4 for
      large numbers.  The floating point option P controls whether
      the assist is activated when 80x87 is installed.

  6.  The L370 linkage editor now supports option U to allow
      unresolved references.

  7.  The emulator debug facility now has option to restore all
      trace points at any point during execution by repeated use
      of K command.  An optional version of emulator is also included
      with the name E370P42.EXE which does not include interactive
      debug or ASSIST facilities.  This version saves space, but
      should only be used with fully tested production programs.
      To use this version, make it resident by executing it.

  8.  The PC/370 emulator E370R42.EXE can now be made resident by
      simply executing it directly.  This eliminates the time required
      to load the emulator for each execution of a PC/370 assembler
      program.  In addition, a common system queue area (SQA) memory
      can be allocated in the resident emulator address space to be
      shared by assembler subroutines called from COBOL.  The size of
      the SQA is specified in hex paragraphs as the only parm.  The
      default is 10 hex or 256 byte SQA.  Assembler subroutines called
      from COBOL can now perform file I/O and dynamic memory
      management using the common SQA memory.

  9.  The 370 cross assembler A370.EXE now supports the COPY statement
      to include commonly used DSECT's, EQU's, or code.  Common copy
      files such as IHADCB.CPY for a DSECT of a DCB, EQUREGS.CPY for
      R0-R15, and EQUSVCS.CPY for equates for all of the PC/370
      supervisor calls are included.

 10.  The following fixes have been included:

      a.  CVB error when input field contained negative 0.
      b.  SRP error when second field contained more than 6 bit #.
      c.  Program check on executed instruction did not store
          correct address of next instruction following execute.
      d.  EBCDIC to ASCII translate table did not correctly handle > {
          and [ characters.
      e.  Text file with LRECL=1 caused incorrect record move.
      f.  Operand of ORG statement can now be CSECT or DSECT as
          well as relative symbol within CSECT or DSECT.
      g.  File open svc 1 now takes error exit for file not found and
          reg 0 and 1 now contain error code at entry to error exit
          (See LIB\SYNERROR.ALC for subroutine to decode errors).

For brief description of changes in previous releases since 1981,
see DOC\HISTORY.DOC.  Thanks to Jacques Roy, a macro preprocessor
M370.COM (written in 370 assembler) has been included since PC/370
release 3.2 along with a set of MVS compatible macros including DCB,
etc.  If you use the macro preprocessor, register as a macro user and
support future enhancements, by sending a registration fee of $20. to:

        Jacques Roy
        XL Software Inc.
        1000 St-Jean Baptiste #120
        Quebec, Canada G2E-5G5

To install the PC/370 system on a hard disk and run the demo programs,
copy the file BAT\INSTALL.BAT to separate hard disk directory and
execute it.  INSTALL requires two parameters, the first is the drive
containing the distributed floppy disk and the second is the hard disk
drive.  Command C>INSTALL B C will install the system on hard disk C
reading files from drive B with prompts for each volume if more than
one.  The install file defines a root directory \R42 which contains
all of the executable programs and system files required by the PC/370
facilities.  The following sub-directories are also created:

  1.  \BAT  - contains batch files which can be executed without
              any parameters after setting current directory to

  2.  \LIB  - contains ALC source code for PC/370 system

  3.  \CPY  - contains CPY source code for ALC source COPY

  4.  \MAC  - contains MAC and MLC source code for macro pre-

  5.  \CBL  - contains CBL Micro Focus VS COBOL demo program source
              code along with demo PC/370 assembler subroutine
              source code.

  6.  \DOC  - contains machine readable PC/370 documentation.  Read
              DOC\INTRO.DOC for PC/370 overview and more
              information on the other component of the package.

  7.  \DEMO - contains demo program ALC source code.

  8.  \UTIL - contains utility program ALC source code.

Hope you enjoy PC/370!  Feedback on your usage and/or
evaluation of the product is highly encouraged.


Don Higgins, CCP, CDP


IBM          - trademark of International Business Machines
COBOL/2, XM  - trademarks of Micro Focus Inc.
MS-DOS       - trademark of Microsoft

Expert Comment

ID: 1256159
The easiest way is:
Write it in C, and compile it to assembly, optimise the result.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 1256160
Why use Assembly?

C is (almost) as fast.
The difference is so small you probably won't notice it.

I once wrote a Assembly function and a C function just to compare. I thought I was pretty god at assembler but GCC beat me.
(Probably because I wrote 486-optimized code and gcc Pentium code.)

But my point is -- use C.


Expert Comment

ID: 1256161
It doesn't appear the that your PC/370 emulator came with a C cross compilier based on what I see above.  You do have a cross assembler to do this project.  I would suggest 1) that you look at the ALC source code example. 2) Get some documentation on IBM 370 assembly language because you need to know the instruction set 3) re-post your question in the general programming section as an IBM 370 assembler question.   I could offers assistance to you on Intel or Motorola assembly but not IBM 370.  Good luck..

Author Comment

ID: 1256162
Thank you for all your help....

Expert Comment

ID: 1256163
Is this an assignment for class, perhaps?

Author Comment

ID: 1256164
yes it is ....i don't know how to get it started ....

Accepted Solution

meessen earned 100 total points
ID: 1256165
Start by writing in clear text what are the steps you need to do the requested processing.

Then write it in a programming language you know the best: Pascal, Basic, C.

Later step is to translate each instruction into assembly code by hand.

The first step is the hardest. it may be split in multiple tasks;
1. understand the question: What is the requested output ?
2. identify and understand the given data: What is the given input ?
3. find how you can answer the request: What operation is needed on the input data to yield the output data ?
(This is just giving the major processing steps, a sort of method description: no details).
4. refine your method description by identifying needed data like counters for instance, etc.


In your problem the input is clearly specified and obvious.
The output is also specified but less precisely.
You also have a serious hint on the processing steps to do if you search for the top agent.

The method is the following:

print out the list of agents+premium sold
Search the top agent

Here one needs a litle programming experience to know how to print a list or search for a maximum value in a list.
You have to go at each line in the input and print out the name and the premium sold.
For searching you also have to examine each line(entry) of the list. You could check if it's the biggest met so far, but what if there are many agents that qualify as top agents ?
So you should, in a first pass, compute the biggest premium in the list and in a second pass output all agents that match this premium. (a pass is a list scanning).
How to we find a biggest value in a list ?
use a variable holding the biggest value met so far. Initialize it with 0. When you scan the list, if a value is bigger than the variable content replace the variable content with the bigger value. At the end of the list, the variable content will be the biggest value.

let maxPremium be the maximum premium value met so far
let premiumSold be the premium sold of a given agent
intialize maxPremium to zero.
for each list entry
    set premiumSold to policyPrice*numberSold
    print agent and premiumSold
    if premiumSold is bigger than maxPremium then
         set maxPremium to premiumSold.

print top agent title
for each list entry
    set premiumSold to policyPrice*numberSold
    if premiumSold is equals maxPremium then
         print agentName

As you can see we combined the first printing loop and the maxPremium search. This is just to make it shorter. We could have  used two loops. The second pass is need though because we only know the biggest premiumSold at the end of the first pass.

To find the minimum premium sold and the lowest agent you need another variable holding the lowest value. You initialize it to the maximum value. But this is not always easy to know. You can initialize it to the premiumSold by the first agent. The same initialization value can be used for the maxPremium.

I guess you understood how to modify the high level code to find the minimum premium.
To print out the lowest agents you need a third pass that print out agents which premium is equal to the minPremium.

Ok. Now you have the first step done.
Now you go for step two and translate this psoeudo code into real code. Choose a language you are used to.
You will then need to solve some details like how to print names and numbers, how to get values from the entry fields etc.
But this is the core of your assignement.

I hope this brings you on track.

Author Comment

ID: 1256166
thank you very much for explaining this to me it is easier to understand now....

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question