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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.