COBOL data buffering without moving character by character - indexing

I am reading a variable length input file and wanting to create an output buffer (indexed table) that will not utilize a character by character move.
For example: my first input record is 79 characters, I can then move this to my group level of the table. My second input record is 101 characters -- how can I take these 101 characters and place them in my table beginning at position 80 for a length of 101 ? And the next input record beginning at position 180.....etc. We currently Perform Varying 1 by 1 but this is incredibly CPU intensive compared to a block move to a beginning address.
We do this millions of times a day and a solution would be quite useful.

Use reference modification with the length from your record. Consider:
01 Record
05 Rec-LL Pic S9(4) Binary.
05 Rec-Data Pic X(32767).
01 Tgt-Area Pic X(10000000).
01 Curr-Ptr Pic S9(8) Binary.
Once you read your record, you can move based on the length like so:
Move 1 to Curr-Ptr
Perform Get-Next-Record
Perform until no-more-data
Move Rec-Data (1:Rec-LL) to Tgt-Area (curr-ptr:rec-LL)
Compute Curr-Ptr = Curr-Ptr + Rec-LL
Perform Get-Next-Record
End-Perform

Or the old fashioned ( we are talking COBOL here so old fashioned = Jurassic) way:-
01 Record.
05 REC-LL PIC S9(4) Binary.
05 REC-DATA.
10 REC-BYTES PIC X OCCURS 32767 times depending on REC-LL.
01 TARGET-AREA.
05 TARGET-HEADER PIC X(79).
05 TARGET-REC PIC X(101) OCCURS 50 TIMES.
01 TGT-INDEX PIC S9(8) BINARY VALUE 1.
* Length calculation happens by magic!
Perform Read-Record.
move REC-DATA TO TARGET-HEADER.
perform until no-more-data
Perform Read-Record
move REC-DATA to TARGET-RED(TGT-INDEX)
add +1 to TGT-INDEX
end-perform
Or if records really vary between 1 and 101 bytes:
01 Record.
05 REC-LL PIC S9(4) Binary.
05 REC-DATA.
10 REC-BYTES PIC X OCCURS 32767 times depending on REC-LL.
01 TARGET-AREA.
05 TGT-LL PIC s9(8) BINARY.
05 TGT-REC.
10 TGX-BYTE OCCURS 3175 depending on TGT-LL.
05 TGT-EXTRA PIC X(101).
Perform Read-Record.
Move +0 to tgt-LL.
perform until no-more-data
MOVE REC-DATE to TGT-EXTRA
ADD REC-LL TO TGT-LL
Perform Read-Record
add +1 to TGT-INDEX
end-perform

Take a look at the STRING INTO verb, in particular the WITH POINTER clause. Don't forget the ON OVERFLOW imperative when stringing things together like this.
For details, grab a copy of Gary Cutler's OpenCOBOL Programmer's Guide.
http://opencobol.add1tocobol.com/OpenCOBOL%20Programmers%20Guide.pdf
This is a world class COBOL manual, and it's an open and free document (GNU FDL).

Related

How to compute custom timestamp in COBOL85 Tandem?

I want to calculate timestamp for custom date and time.
E.g 23/09/2022 4:30:45
To calculate Julian Timestamp of current date and time you can use JULIANTIMESTAMP using ENTER TAL but for Custom timestamp we have COMPUTETIMESTAMP GPC .
Syntax from GPC Reference manual
jval := COMPUTETIMESTAMP ( date-n-time,
[error-mask] );
Data types
jval is 64-bit Fixed Julian timestamp .
date-n-time is an integer array of date and time [YYYY,MM,DD,HH,,MM,SS,MIL,MIC] all elements of array are compulsory.
error-mask is integer array of bits 1 or 0 of length 8.
So let's Jump to the main Question how to Calculate Custom timestamp in COBOL85 . I have small example .
?ANSI
?save param
?symbols
?inspect
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 USER-FLD-CUST PIC X(50).
01 ARR.
03 DT PIC S9(4) COMP OCCURS 8 TIMES.
01 VAL PIC 9(16).
01 JTIME PIC S9(18) VALUE 0.
01 CER.
03 ERR PIC S9(1) COMP OCCURS 8 TIMES.
PROCEDURE DIVISION.
PROGRAM-BEGIN.
MOVE 2022 TO DT(1).
MOVE 99 TO DT(2).
MOVE 30 TO DT(3).
MOVE 10 TO DT(4).
MOVE 00 TO DT(5).
MOVE 00 TO DT(6).
MOVE 000 TO DT(7).
MOVE 000 TO DT(8).
ENTER TAL "COMPUTETIMESTAMP" USING ARR , CER
GIVING JTIME.
IF JTIME = -1
DISPLAY "INVALID DATE"
ELSE
DISPLAY JTIME.
STOP RUN.

COBOL File I/O Formatting

As the title may indicate, I am having some difficulty getting the desired output for my COBOL program. The program takes in data from a file and outputs in a specific format, this is for a homework assignment. When i run the program it works for the name header, schoolID header, and column header. The first course works fine then the output starts to cut off by one and messes up all my other outputs.
Input File example
CMPS161 ALGORITHM DSGN/IMPLMNT I A 3.00
CMPS280 ALGORITHM DSGN/IMPLEM II B 3.00
Output file desired example
<Name>
<schoolID>
Course Title GR Earned
CMPS161 ALGORITHM DSGN/IMPLMNT I A 3.00
CMPS280 ALGORITHM DSGN/IMPLEM II B 3.00
Output actual example
<Name>
<schoolID>
Course Title GR Earned
CMPS161 ALGORITHM DSGN/IMPLMNT I A 0.00
MPS280 ALGORITHM DSGN/IMPLEM II B 0.00
COBOL Project
IDENTIFICATION DIVISION.
PROGRAM-ID. P2.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT myInFile ASSIGN TO "P2In.dat".
SELECT myOutFile ASSIGN TO "P2Out.dat".
DATA DIVISION.
FILE SECTION.
FD myInFile.
01 inRecord.
02 Course PIC X(13).
02 Title PIC X(32).
02 Grade PIC X(4).
02 Earned PIC Z9.99.
02 FILLER PIC X(3).
FD myOutFile.
01 outRecord.
02 myCourse PIC X(13).
02 myTitle PIC X(32).
02 myGrade PIC X(4).
02 myEarned PIC Z9.99.
02 FILLER PIC X(3).
WORKING-STORAGE SECTION.
01 E0F PIC X(3) VALUE "NO ".
01 NAME-HDR.
05 FILLER PIC X(10) VALUE "NAME HERE ".
01 SCHOOLID-HDR.
05 FILLER PIC X(8) VALUE "SCHOOLID"
01 COLUMN-HDR.
05 FILLER PIC X(6) VALUE "COURSE".
05 FILLER PIC X(6) VALUE SPACES.
05 FILLER PIC X(6) VALUE "TITLE".
05 FILLER PIC X(6) VALUE SPACES.
05 FILLER PIC X(6) VALUE "GR".
05 FILLER PIC X(6) VALUE SPACES.
05 FILLER PIC X(6) VALUE "EARNED".
PROCEDURE DIVISION.
MAIN-PROGRAM.
PERFORM HEADER.
PERFORM FILE-IO.
PERFORM CLOSING.
STOP RUN.
HEADER.
OPEN INPUT myInFile
OUTPUT myOutFile.
WRITE outRecord FROM NAME-HDR
AFTER ADVANCING 1 LINE.
WRITE outRecord FROM SCHOOLID-HDR
AFTER ADVANCING 1 LINE.
WRITE outRecord FROM COLUMN-HDR
AFTER ADVANCING 2 LINES.
MOVE SPACES TO outRecord.
WRITE outRecord
AFTER ADVANCING 1 LINE.
FILE-IO.
READ myInFile
AT END
MOVE "YES" TO EOF.
PERFORM PROCESS-RECORD
UNTIL EOF = "YES".
PROCESS-RECORD.
MOVE SPACES TO outRecord.
MOVE Course to myCourse.
MOVE Title to myTitle.
MOVE Grade to myGrade.
MOVE Earned to myEarned.
WRITE outRecord
AFTER ADVANCING 1 LINE.
READ myInFile
AT END
MOVE "YES" TO EOF.
CLOSING.
CLOSE myInFile
myOutFile.
My COBOL is very rusty but I don't think that 'Z' in input formats will work. Leading zero suppression is just for output formats. You may simply have to replace leading spaces with zeroes before you do anything with the data. Try something like:
INSPECT Earned REPLACING ALL SPACES BY '0'.
after the read (and change the input format to 99.99). It's a common problem but I can't remember how I used to deal with it.

COBOL: File status 39 error

here is my cobol code. i have the testinput.txt in my cobol folder. I compiled it and it has no errors but when i try to run it,
there's a message that says
RCL0002: File status 39 on < unopened-file >
Error detected at offset 0046 in segment 00 of program TEST
IDENTIFICATION DIVISION.
PROGRAM-ID. transactionIN.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-PC.
OBJECT-COMPUTER. IBM-PC.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INFILE ASSIGN TO 'testinput.txt'.
SELECT OUTFILE ASSIGN TO 'testoutput'.
DATA DIVISION.
FILE SECTION.
FD INFILE
LABEL RECORD IS STANDARD
DATA RECORD IS INREC.
01 INREC.
02 AC PIC X(99).
FD OUTFILE
LABEL RECORD IS OMITTED
DATA RECORD IS OUTREC.
01 OUTREC.
02 FILLER PIC X(80).
WORKING-STORAGE SECTION.
01 HEAD-1.
02 FILLER PIC X(32) VALUE SPACES.
02 FILLER PIC X(16) VALUE 'China Trust Bank'.
02 FILLER PIC X(32) VALUE SPACES.
01 HEAD-2.
02 FILLER PIC X(34) VALUE SPACES.
02 FILLER PIC X(13) VALUE 'Makati Avenue'.
02 FILLER PIC X(33) VALUE SPACES.
01 HEAD-3.
02 FILLER PIC X(35) VALUE SPACES.
02 FILLER PIC X(12) VALUE 'Makati City'.
02 FILLER PIC X(34) VALUE SPACES.
01 HEAD-4.
02 FILLER PIC X(33) VALUE SPACES.
02 FILLER PIC X(14) VALUE 'Account Report'.
02 FILLER PIC X(33) VALUE SPACES.
01 SUB-1.
02 FILLER PIC X(20) VALUE SPACES.
02 FILLER PIC X(7) VALUE 'Account'.
02 FILLER PIC X(10) VALUE SPACES.
02 FILLER PIC X(7) VALUE 'Account'.
02 FILLER PIC X(9) VALUE SPACES.
02 FILLER PIC X(7) VALUE 'Balance'.
02 FILLER PIC X(20) VALUE SPACES.
01 SUB-2.
02 FILLER PIC X(20) VALUE SPACES.
02 FILLER PIC X(6) VALUE 'Number'.
02 FILLER PIC X(12) VALUE SPACES.
02 FILLER PIC X(4) VALUE 'Name'.
02 FILLER PIC X(10) VALUE SPACES.
02 FILLER PIC X(18) VALUE SPACES.
SCREEN SECTION.
01 SCRE.
02 BLANK SCREEN.
PROCEDURE DIVISION.
MAIN-RTN.
PERFORM INIT-RTN THRU INIT-RTN-END.
PERFORM FINISH-RTN.
STOP RUN.
INIT-RTN.
OPEN INPUT INFILE, OUTPUT OUTFILE.
READ INFILE AT END PERFORM END-RTN
GO TO INIT-RTN-END.
PERFORM HEADING-RTN.
INIT-RTN-END.
END-RTN.
DISPLAY 'EMPTY FILE' LINE 3 COLUMN 20.
HEADING-RTN.
WRITE OUTREC FROM HEAD-1 AFTER PAGE.
WRITE OUTREC FROM HEAD-2 AFTER 1.
WRITE OUTREC FROM HEAD-3 AFTER 1.
WRITE OUTREC FROM HEAD-4 AFTER 3.
WRITE OUTREC FROM SUB-1 AFTER 2.
WRITE OUTREC FROM SUB-2 AFTER 1.
PROCESS-RTN.
DISPLAY SCRE.
FINISH-RTN.
CLOSE INFILE, OUTFILE.
DISPLAY 'TAPOS NA' LINE 6 COLUMN 20.
The FILE STATUS 39 means that there is a difference between what you have told COBOL about the file and what COBOL has discovered whilst attempting to OPEN it.
For the file you have defined in COBOL, the data must be exactly 99 bytes long. If you have 99 bytes per record, followed by one (or more) delimiters, then you'd need to extend the length of INREC to 100 or 101 bytes.
You may want to see if your compiler (from the error message it seems to be CA-Realia) supports LINE SEQUENTIAL files. This particular file-type understands delimited records, and the delimiters will be stripped before being presented to your program.
The simplest file-processing program in COBOL follows this outline:
OPEN files
READ input until end
process input, WRITE output
CLOSE files
That read-loop will typically be one of two forms:
PERFORM until some-flag-shows-end-of-file
READ input-file
AT END
make end-of-file-flag show "end of file"
NOT AT END
do some processing
END-READ
END-PERFORM
READ input-file ("priming read")
PERFORM until FILE STATUS field shows end-of-file
do some processing
READ input-file
END-PERFORM
The second is, to my mind, much simpler and less error-prone. It requires that the FILE STATUS is used on the SELECT for the file. This really should always be done for all files so that you can check after each IO that the IO didn't behave unexpectedly. Separate FILE STATUS field for each file.
Here's your program re-arranged. At the moment, it only reads one record (or none if end-of-file is returned immediately) but that is what you coded.
PROCEDURE DIVISION.
PERFORM INIT-RTN
PERFORM PROCESS-FILE
PERFORM END-RTN
PERFORM FINISH-RTN
STOP RUN
.
INIT-RTN.
OPEN INPUT INFILE
check file status
OPEN OUTPUT OUTFILE
check file status
PERFORM HEADING-RTN
.
PROCESS-FILE.
READ INFILE
check file status
.
END-RTN.
DISPLAY 'EMPTY FILE' LINE 3 COLUMN 20
.
HEADING-RTN.
WRITE OUTREC FROM HEAD-1 AFTER PAGE
check file status
WRITE OUTREC FROM HEAD-2 AFTER 1
check file status
WRITE OUTREC FROM HEAD-3 AFTER 1
check file status
WRITE OUTREC FROM HEAD-4 AFTER 3
check file status
WRITE OUTREC FROM SUB-1 AFTER 2
check file status
WRITE OUTREC FROM SUB-2 AFTER 1
check file status
.
PROCESS-RTN.
DISPLAY SCRE
.
FINISH-RTN.
CLOSE INFILE
check file status
CLOSE OUTFILE
check file status
DISPLAY 'TAPOS NA' LINE 6 COLUMN 20
.
So, check on FILE STATUS, LINE SEQUENTIAL, change your file (or program definition of it). Build from there.
You may think the FILE STATUS checking of the report lines will look large and ugly. You can do them like this, instead:
MOVE HEAD-1 TO OUTREC
PERFORM WRITE-OUTREC-AFTER-PAGE (other neater ways to do it later)
Where WRITE-OUTREC has the WRITE and the test of the FILE STATUS field.

COBOL to MSSQL table creation [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
We are trying data load to SQL server. So Can anyone suggest appropriate table schema for below mentioned Layout.
01 PRECALC.
06 NEWGROUP57.
10 PRE-MODIFY-TYPE PIC X.
10 PRE-HMO-ID PIC X(3).
10 PRE-SC-CAP PIC X(1).
10 PRE-ENTRY-SOURCE PIC X(1).
10 PRE-DIV-NBR PIC 9(2).
06 PRE-MEMB-NBR.
10 PRE-MEMGRP PIC 9(5).
10 PRE-MEMSUB PIC 9(9).
10 PRE-MEMDEP PIC 9(2).
06 NEWGROUP58.
10 PRE-CTLNBR PIC 9(12).
10 PRE-AUDNBR PIC 9(8).
10 PRE-AUDSUB PIC 9(2).
10 PRE-DSLW-CONT PIC S9(5)V9(2) DISPLAY SIGN
LEADING SEPARATE.
10 PRE-RECV-CYMD PIC 9(8).
10 PRE-SYS-CYMD PIC 9(8).
06 PRE-DETAIL-AREA.
07 PRE-DTL-DATA-EXP.
10 Z-PRE-DTL-DATA PIC X(1068).
07 PRE-DTL-DATA REDEFINES PRE-DTL-DATA-EXP
OCCURS 4.
08 NEWGROUP59-1.
11 PRE-ICDA-CDE PIC X(5).
11 PRE-PROC PIC X(5).
11 PRE-PROC-MOD PIC X(4).
08 NEWGROUP59-2.
11 PRE-AMT-CLAIMED PIC S9(5)V9(2) DISPLAY SIGN
LEADING SEPARATE.
11 PRE-AMT-COPAY PIC S9(5)V9(2) DISPLAY SIGN
LEADING SEPARATE.
11 PRE-AMT-DISCOUNT PIC S9(5)V9(2) DISPLAY SIGN
LEADING SEPARATE.
08 NEWGROUP59-3.
11 PRE-EPSDT-IND PIC X(1).
11 PRE-NDC-ID PIC X(11).
11 PRE-ORIG-POS-CDE PIC X(2).
08 NEWGROUP59-4.
11 PRE-ALLOW-AMT-RPR PIC S9(5)V9(2) DISPLAY SIGN
LEADING SEPARATE.
06 PRE-DSIERR.
07 PRE-DSI-ERR-EXP.
10 Z-PRE-DSI-ERR PIC X(100).
07 PRE-DSI-ERR REDEFINES PRE-DSI-ERR-EXP
OCCURS 100 PIC 9(1).
06 NEWGROUP60.
10 PRE-PAYOR-INFO PIC X(1).
10 PRE-RECOVERY-FLG PIC X(1).
10 PRE-RECV-MDCY PIC 9(8).
10 PRE-SYS-MDCY PIC 9(8).
10 PRE-PRV-TAX-ID PIC X(9).
06 PRE-RPR-DTL-RJMSG-EXP.
10 Z-PRE-RPR-DTL-RJMS PIC X(8).
06 PRE-RPR-DTL-RJMSG REDEFINES PRE-RPR-DTL-RJMSG-EXP
OCCURS 4 PIC X(2).
06 PRE-RPR-DTL-RSNCD-EXP.
10 Z-PRE-RPR-DTL-RSNC PIC X(16).
06 PRE-RPR-DTL-RSNCD REDEFINES PRE-RPR-DTL-RSNCD-EXP
OCCURS 4 PIC X(4).
It seems like the OP has departed, but here is some general advice is case someone else stumbles upon this.
For a starting point, make anything which has an occurs or redefines another item have its own table. Possibly all of the 06 levels could each be a table for functional clarity, but that would give you a large number of tables with one row each from the source record, which is inefficient.
Some items like this one:
06 PRE-RPR-DTL-RSNCD-EXP.
10 Z-PRE-RPR-DTL-RSNC PIC X(16).
Are just the target of a redefines, and probably don't need to be stored themselves. However, some are not the same size as the redefinition, so you need to know if that data is actually needed.
Note that lower levels placed into a separate table will need a foreign key to identify the parent. And all 06-derived tables will need a common key to link them, since they come from the same source record.
As #cschneid says above, you will end up with a poor database design if you don't take the actual requirements/usage into account. You are starting with a COBOL file record layout, not a database design.
Note: Revised based upon helpful comments from Bill Woodger

Need help with a syntax error (COBOL)

I am working on my last homework assignment for COBOL this semester and I am being hit with a syntax error that is stopping my progress cold. Here is what I got:
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT USED-CAR-FILE-OUT
ASSIGN TO 'USED-CAR.RPT'
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD USED-CAR-FILE-OUT.
01 USED-CAR-RECORD-OUT PIC X(80).
WORKING-STORAGE SECTION.
01 ID-CODE PIC X(3).
01 TOTAL-CASH-PAYMENT PIC 9(5).
01 MONTHLY-PAYMENT PIC 9(4).
01 NUMBER-OF-MONTHS PIC 9(3).
01 BALANCE-TOTAL PIC S9(6)V99 VALUE ZEROS.
01 INTEREST-EARNED PIC S99V99 VALUE ZEROS.
01 COMPARE-MONTH PIC 99 VALUE ZEROS.
01 YEAR-NUMBER PIC 99 VALUE ZEROS.
01 MONTH-NUMBER PIC 99 VALUE ZEROS.
01 DETAIL-LINE.
05 ID-CODE-DL PIC X(3).
05 PIC X(3) VALUE SPACES.
05 PIC X(4) VALUE 'Yr='.
05 YEAR-NUMBER-DL PIC Z9 VALUE ZEROS.
05 PIC X(4) VALUE SPACES.
05 PIC X(4) VALUE 'Mo='.
05 MONTH-NUMBER-DL PIC Z9.
05 PIC X(4) VALUE SPACES.
05 PIC X(5) VALUE 'Pmt='.
05 PAYMENT-DL PIC $$$,$$$.
05 PIC X(4) VALUE SPACES.
05 PIC X(5) VALUE 'Int='.
05 INTEREST-EARNED-DL PIC $$$$.99.
05 PIC X(3) VALUE SPACES.
05 PIC X(5) VALUE 'Bal='.
05 BALANCE-DL PIC $$$,$$$.99.
PROCEDURE DIVISION.
100-MAIN.
OPEN OUTPUT USED-CAR-FILE-OUT
PERFORM 200-INPUT THRU 299-EXIT
CLOSE USED-CAR-FILE-OUT
STOP RUN.
200-INPUT.
DISPLAY 'Used Car Sales Report'
DISPLAY 'Enter the ID Code (or END) - maximum three char.'
ACCEPT ID-CODE
IF ID-CODE = 'END'
GO TO 299-EXIT
END-IF
DISPLAY 'Enter the Total Cash Payment - maximum five digits'
ACCEPT TOTAL-CASH-PAYMENT
DISPLAY 'Enter the Monthly Payment - maximum four digits'
ACCEPT MONTHLY-PAYMENT
DISPLAY 'Enter the Number of Months - maximum three digits'
ACCEPT NUMBER-OF-MONTHS
PERFORM 300-PROCESS.
299-EXIT.
EXIT.
300-PROCESS.
IF TOTAL-CASH-PAYMENT > 0
MOVE TOTAL-CASH-PAYMENT TO PAYMENT-DL
END-IF
IF MONTHLY-PAYMENT > 0
MOVE MONTHLY-PAYMENT TO PAYMENT-DL
END-IF
ADD PAYMENT-DL TO BALANCE-TOTAL
COMPUTE INTEREST-EARNED ROUNDED = .0175 / BALANCE-TOTAL
ADD INTEREST-EARNED TO BALANCE-TOTAL
MOVE BALANCE-TOTAL TO BALANCE-DL
ADD 1 TO COMPARE-MONTH
IF MONTH-NUMBER-DL > 13
ADD 1 TO MONTH-NUMBER
MOVE MONTH-NUMBER TO MONTH-NUMBER-DL
END-IF
IF MONTH-NUMBER-DL = 13
MOVE 1 TO MONTH-NUMBER
MOVE MONTH-NUMBER TO MONTH-NUMBER-DL
END-IF
IF MONTH-NUMBER = 1
ADD 1 TO YEAR-NUMBER
MOVE YEAR-NUMBER TO YEAR-NUMBER-DL
END-IF
MOVE DETAIL-LINE TO USED-CAR-RECORD-OUT
WRITE USED-CAR-RECORD-OUT
AFTER ADVANCING 1 LINE
IF TOTAL-CASH-PAYMENT > 0
MOVE 0 TO TOTAL-CASH-PAYMENT
MOVE 0 TO PAYMENT-DL
END-IF
IF COMPARE-MONTH > NUMBER-OF-MONTHS
PERFORM 300-PROCESS
END-IF
The problem is with PAYMENT-DL, INTEREST-EARNED-DL and BALANCE-DL. It says that an illegal character, but I know that it should work as it shows those pic clauses in my book and the teacher handed out an incomplete version of the program that I have to write. What do I have to do to get rid of those errors?
The invalid character is the "$" sign.
This should be OK, but your compiler may have been customized to use a local currency symbol as the default.
You could switch to your local currency sign (if you know it!) or change it back to "$". Changing it back to "$" depends on which compiler you are using and how the defaults are set -- you really need to read the manual for your particular compiler to find out how this is done.