I need help in a program in Mainframe Assembler, for IBM Computers. I need help in

Write an assembly program (Mainframe Assembly http://www.billqualls.com/assembler/index.html) that reads a file and reports how many lines, words, number of commas, number of periods and characters that appear in it. For purposes of the program, a word consists of a consecutive sequence of any characters except white space characters. The file to use is called Indepen.txt
Your program should generate the following run from the command line:

File: Indepen.txt
Number of Lines: XX

Words: XXXX
Commas: XXX
Periods: XX
Total Characters (excluding spaces): XXXX

Attachments
We hold these truths to be self-evident that all men are created equal,
that they are endowed by their Creator with certain unalienable rights,
that among these are life, liberty and the pursuit of happiness,
that to secure these rights, governments are instituted among men
deriving their just powers from the consent of the governed.
That whenever any form of government becomes destructive to these ends,
it is the right of the people to alter or to abolish it, and to institute new government.
Laying its foundation on such principles and organizing its powers in such form,
as to them shall seem most likely to effect their safety and happiness.
Prudence, indeed, will dictate, that governments long established,
should not be changed for light and transient causes,
and accordingly all experience hath shown, that mankind
are more disposed to suffer, while evils are sufferable,
than to right themselves by abolishing the forms to which they are accustomed.
But when a long train of abuses and usurpations,
pursuing invariably the same object,evinces a design to reduce them under absolute despotism,
it is their right,it is their duty, to throw off such government,
and to provide new guards for their future security.

I have some starting code, but can you help fix this?

PRINT NOGEN

START 0

*Information is needed to restore control to OS when
*Program ends!

STM 14,12,12(13)
BALR 12,0
USING *,12
ST 13,SAVEAREA+4
LA 13,SAVEAREA

*CONVERT INPUT FROM ASCII TO EBCDIC
OI INFILE+10,X'08'

ZAP COUNTER,='0'

OPEN INFILE
LOOP GET INFILE,RECIN

//This is a processing loop, so when it hits B LOOP , control flows back to LOOP
GET ... to get

// the next record

// So what do you do here? Read and process each record

//Position yourself at the beginning of the COMMAS record with R4

// ... in other words, put the address of COMMAS in reg 4 with LA R4,COMMAS

//Put the address of the first byte after the COMMAS rec in reg 5 (we have to know when we are at the

// end of the record LA R5,L'COMMAS(R0,R4)

//

COMPARE EQU *

/Compare R4 and R5, if equal, we are at the end of the COMMAS field, so

// go back and read another record at LOOP

// If not,

//Compare to see if the current character is a comma

//If so add 1 to your counter

// add 1 to R4 to keep moving

// branch back to COMPARE to look for more commas

//If not add 1 to R4

// branch back to COMPARE to keep looking for commas in the current field


LOOP2 CP FIRSTCHAR,' '
BNE WORDCOUNT


COMMAS1 GET INFILE,RECIN


LA R4,COMMAS
CLI 0(R4),C',' // Every compare should to be followed immediately by a branch instruction
A R4,=F'1'

BNE COMMAS1

CLC PERIODS,=C'.'
BME COMMAS1

CLC


WORDCOUNT AP COUNTER,='1'
B COMMAS


R0 EQU 0 //These equates should be near the top
R1 EQU 1
R2 EQU 2
R0 EQU 3
R0 EQU 4
R0 EQU 5
R0 EQU 6
R0 EQU 7
R0 EQU 8
R0 EQU 9
R0 EQU 10
R0 EQU 11
R0 EQU 12
R0 EQU 13
R0 EQU 14
R0 EQU 15

*FILE DEFS...
INFILE DCB DDNAME='Indepen.TXT',
MACRF=GM,
BLKSIZE=1,
LRECL=1,
EODAD=EOFI


LINES DS
STATEMENTS DS 0CL
WORDS DS
COMMAS DS
PERIODS DS
CHARACTERS DS

COUNTER

*INPUT RECORD
RECIN DS 0CL95
FIRSTCHR DS CL95

SAVEAREA DS 18F

END

This article has been dead for over six months. Start a new discussion instead.