We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


Does anyone know assembly languge?

Saphire38 asked
Medium Priority
Last Modified: 2020-04-13

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 idea..it 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....
Watch Question

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)


Question 1..it 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
The easiest way is:
Write it in C, and compile it to assembly, optimise the result.

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.

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..


Thank you for all your help....
Is this an assignment for class, perhaps?


yes it is ....i don't know how to get it started ....
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.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


thank you very much for explaining this to me it is easier to understand now....
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.