I'm trying to create a report for a given input file where I am supposed to ill examine each record to determine if it fails to meet certain criteria. The issue that I am facing now is that the cob file wont compile eventhough it doesn't explicitly show any errors when compiling it on the command window and the executable doesn't get created. I was wondering if any of you could help me figure out where the error lies in my code.
Identification Division.
Program-ID. lab5.
Environment Division.
Input-Output Section.
File-Control.
Select PayrollFile
Assign to "lab5-in.dat"
Organization is Line Sequential.
Select OutputReport
Assign to "lab5-out.dat"
Organization is Line Sequential.
Data Division.
File Section.
FD PayrollFile.
01 Input-Rec.
05 Rec-RegionNum Pic X(2).
05 Rec-RegionName Pic X(15).
05 Rec-DeptNum Pic X(5).
05 Rec-DeptName Pic X(30).
05 Rec-EmployeeNum Pic X(5).
05 Rec-LastName Pic X(20).
05 Rec-FirstName Pic X(15).
05 Rec-Gender Pic X.
05 Rec-Address Pic X(20).
05 Rec-CityState Pic X(20).
05 Rec-Title Pic X(20).
05 Rec-DOB Pic 9(8).
05 Rec-DOH.
10 RecDOH-YYYY Pic 9(4).
10 RecDOH-MM Pic 9(2).
10 RecDOH-DD Pic 9(2).
05 Rec-Marital Pic X.
05 Rec-Deps Pic 99.
05 Rec-SD Pic X(3).
05 Rec-Ins Pic X(3).
05 Rec-401k Pic V999.
05 Rec-PayCode Pic X.
05 Rec-Pay Pic 9(7)V9(2).
05 Rec-HrsPerWeek Pic 9(2)V9(2).
05 Rec-CommissionRate Pic V999.
05 Rec-ActualSales Pic 9(7)V9(2).
FD OutputReport.
01 Output-Rec Pic X(210).
Working-Storage Section.
01 WS-EmployeeNum Pic X(5).
01 WS-DeptName Pic X(30).
01 WS-Gender Pic X.
88 ValidGender Values "M" "m" "F" "f".
01 WS-Marital Pic X.
88 ValidMarital Values "D" "d" "M" "m" "P" "p" "S" "s" "W"
"w".
01 WS-PayCode Pic X.
88 ValidPayCode Values "C" "c" "H" "h" "S" "s".
01 WS-HrsPerWeek Pic S9(2)V9(2).
01 WS-Pay Pic S9(7)V9(2).
01 WS-DOH.
10 DOH-YYYY Pic 9(4).
10 DOH-MM Pic 9(2).
10 DOH-DD Pic 9(2).
01 WS-SD Pic X(3).
01 WS-Date.
05 WS-YYYY Pic 9(4).
05 WS-MM Pic 9(2).
05 WS-DD Pic 9(2).
01 EndOfFileIndicator Pic X.
88 EOF Value "Y" When Set To False is "N".
01 Total-Line.
05 Pic X(25) Value "Total errors: ".
05 TL-TotalE Pic ZZ9.
01 TotalRE-Line.
05 Pic X(50) Value "Total record with errors: ".
05 TL-TotalRE Pic ZZ9.
01 TotError Pic 9(3).
01 TotRecordError Pic 9(3).
01 CurrentRec Pic X(208).
01 Blank-Line Pic X Value Spaces.
01 Report-Fields.
05 PageNumber Pic 99 Value 0.
05 LinesPerPage Pic 99 Value 35.
05 LineNumber Pic 99 Value 99.
Procedure Division.
000-MAIN.
Perform 100-initialize
Perform until EOF
Read PayrollFile
At End
Set EOF to True
not at end
perform 300-process
End-read
End-perform
Perform 900-finalize
Close PayrollFile OutputReport
Stop Run.
100-initialize.
Perform 110-open-files
Move Zero to TotError
Move Zero to TotRecordError.
110-open-files.
Open Input PayrollFile
Open Output OutputReport.
300-Process.
Move Input-Rec to CurrentRec
Move Rec-EmployeeNum to WS-EmployeeNum
Move Rec-DeptName to WS-DeptName
Move Rec-Gender to WS-Gender
Move Rec-Marital to WS-Marital
Move Rec-PayCode to WS-PayCode
Move Rec-HrsPerWeek to WS-HrsPerWeek
Move Rec-Pay to WS-Pay
Move Rec-DOH to WS-DOH
Perform 400-check.
400-check.
If WS-EmployeeNum is Not Numeric
Add 1 to TotError TotRecordError
End-If
If WS-DeptName Is Not Alphabetic
Add 1 to TotError TotRecordError
End-If
If Not ValidGender
Add 1 to TotError TotRecordError
End-If
If Not ValidMarital
Add 1 to TotError TotRecordError
End-If
If Not ValidPayCode
Add 1 to TotError TotRecordError
End-If
If WS-HrsPerWeek Is Negative And >= 60
Add 2 to TotError
Add 1 to TotRecordError
End-If
If WS-HrsPerWeek Is Negative Or >=60
Add 1 to TotError TotRecordError
End-If
If WS-Pay Is Not Numeric and Is Negative
Add 2 to TotError
Add 1 to TotRecordError
End-If
If WS-Pay Is Negative Or Not Numeric
Add 1 to TotError TotRecordError
End-If
If Function Test-Date-YYYYMMDD(WS-DOH) Is Not Zero Or WS-DOH Is Not Numeric
Add 1 to TotError TotRecordError
End-If.
900-finalize.
perform 950-print-grand-total.
950-print-grand-total.
Write Output-Rec from Blank-Line
After advancing 1 line
Move TotError to TL-TotalE
Write Output-Rec from Total-Line
after advancing 1 line
Move TotRecordError to TL-TotalRE
Write Output-Rec from TotalRE-Line
after advancing 1 line.
As you've used the GnuCOBOL tag I've just used a simple compile.
Result:
main.cobc: in paragraph '400-check':
main.cobc: 139: error: invalid expression
main.cobc: 143: error: invalid expression
main.cobc: 146: error: invalid expression
main.cobc: 150: error: invalid expression
main.cobc: 153: error: FUNCTION 'TEST-DATE-YYYYMMDD' has invalid parameter
main.cobc: 153: error: invalid expression
main.cobc: 153: error: invalid expression
The invalid expression part is "is negative" (additional line 139 doesn't make sense "Negative And >= 60" as this would never be true; line 146 is even more weird: "Is Not Numeric and Is Negative").
The issue that I am facing now is that the cob file wont compile eventhough it doesn't explicitly show any errors when compiling it
I guess the messages from the compilers are redirected somewhere.
Related
This program is to read in the SEQ file and take the data thru different validations, if it fails to comply with one of the validations the error message is moved to FIELD-NAME and FIELD-VALUE is the errored field.
After all data is processed all transaction are to be used to create the RPT file.
PROBLEM: When reviewing the RPT file, a weird issue is that ERROR FIELD NAME/ERROR FIELD VALUE keeps repeating the same error after entry is passed. I believe the problem is located in the 300, 310, 320, 330, 340, 350 sections.
Part number validation requirements Col. 01-05 must be a number, col 06 must be a capital, 07-08 must be a number in the range 01-68 or 78-99
Quantity validation requirements Leading spaces are allowed(can be all spaces), if not all spaces must be a number after leading spaces, zero value is allowed, value over 20,000 is an error
Date validation requirements month value must be 01-12, day value must be 01-31
Charge Number validation requirements cannot be blank, must be left justified(no leading spaces), and no more than one dash (hyphen) allowed
Initial validation requirements both must be letters (upper or lower case OK)
Transaction Code validation requirements must be REC, ISS, AJ+, or AJ-
If you run my attached program with the attached SEQ, your RPT will look like mine.
Below is the desired output. (pg 1)
SEQ:
11438A01 5000102667-X44 JBISS
12345A77 120103OK BY MIKELLREC
12789B02 14460606144-X22A AJ+
13168A02 31231722394 mkISS
13168A02 70102221-Q18 JBAJ-
2074B01 25 0532 OK BY JIMK RE
22109A04 20000325669-Y5Z DCISS
3077.B22 1000801144X MWAJ-
32149A01 10625567-X1 dcREC
39886B02 2000203517-AA JBAJ+
40442A2( 33 333-Q67 MKISS
43009B01 1440801899-23 MKISS
47890A02 30000422X-4-8 DCISS
49000B01 1000831901-Y6 MWAJ+
51111A011052X0905901-Y66 JBREC
52301A02 10228733876-X1 ABREC
55986b01 99990430A DCISS
57989A01 21130144X JBAJ+
57989A01 500831722394-XX MKISS
59901B0220300133X966-QQ22 MWREC
60022A01 400823 517-X1-33MWAJ+
66780B01 1000831722-YY BwREC
68999A01 21028123-Q88 MKISS
75312B01 500222966-32 BISS
77771A03 12780606 ABISS
78896B02 1000831123456-X13DCREC
80090B01 881$25983334-X25jbAJ
82432A05 420912722-X9 MWISS
83058C04 65000325Q1234 K*AJ+
85987D02 1061214Charge #32KBAJ-
87167B01 7000930144XX DCAJ+
91986 01 25072 900-23 MWISS
9576XA00 1001122j55 kbREC
96134B05 60214GOOD BSAJ-
98407C03254*00416Confirmed EHISS
Code:
IDENTIFICATION DIVISION.
PROGRAM-ID. INVTRAN.
* Tate
***************************************************************
* This program reads a fie of inventory transaction,
* validates the data, prints a report showing all transactions
* (with errors indicated), and writes a data file of
* all transactions without errors.
***************************************************************
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INVENTORY-TRANS-FILE-IN
ASSIGN TO 'INVTRAN.SEQ'
ORGANIZATION IS LINE SEQUENTIAL.
* SELECT INVENTORY-TRANS-FILE-OUT
* ASSIGN TO 'INVTRAN.OUT'
* ORGANIZATION IS LINE SEQUENTIAL.
SELECT INVENTORY-TRANS-FILE-OUT-2
ASSIGN TO 'INVTRAN.RPT'
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD INVENTORY-TRANS-FILE-IN.
01 INVENTORY-TRANS-RECORD-IN.
05 PART-NUMBER-IN.
10 PART-NUMERIC-1-IN PIC X(5).
10 PART-ALPHABETIC-IN PIC X.
10 PART-NUMERIC-2-IN PIC XX.
88 VALID-PART-NUMERIC-2 VALUE '01' THRU '68' '78' THRU '99'.
05 QUANTITY-IN.
10 QUANTITY-9-IN PIC 9(5).
05 DATE-IN.
10 MONTH-IN PIC XX.
88 VALID-MONTH-IN VALUE '01' THRU '12'.
10 DAY-IN PIC XX.
88 VALID-DAY-IN VALUE '01' THRU '31'.
05 CHARGE-NUMBER-IN PIC X(10).
05 INITIALS-IN.
10 INITIALS-1-IN PIC X.
10 INITIALS-2-IN PIC X.
05 TRANS-CODE-IN PIC X(3).
88 VALID-TRANS-CODE-IN VALUE 'REC' 'ISS' 'AJ+' 'AJ-'.
FD INVENTORY-TRANS-FILE-OUT-2.
01 INVENTORY-TRANS-RECORD-OUT-2 PIC X(80).
WORKING-STORAGE SECTION.
01 WS-FIRST-TIME-THRU PIC X(3) VALUE 'YES'.
01 LINES-PRINTED PIC 99 VALUE 99.
01 PAGE-NUMBER PIC 99 VALUE ZERO.
01 RECORDS-ERROR-SWITCH PIC X(3).
01 FIELD-ERROR-SWITCH PIC X(3).
01 WS-TOTAL PIC 99 VALUE ZERO.
01 WS-ERROR PIC 99 VALUE ZERO.
01 WS-GOOD PIC 99 VALUE ZERO.
01 WS-QUANTITY PIC 9(4) VALUE ZERO.
01 TOTAL-ERROR-COUNT PIC 9(3) VALUE ZERO.
01 TOTAL-GOOD-COUNT PIC 9(3) VALUE ZERO.
01 TOTAL-GOOD-QUANTITY PIC 9(5) VALUE ZERO.
01 WS-CURRENT-DATE-DATA.
05 WS-CURRENT-DATE.
10 RUN-YEAR PIC XX.
10 RUN-MONTH PIC XX.
10 RUN-DAY PIC XX.
01 HEADING-LINE-1.
05 PIC X(17) VALUE SPACES.
05 PIC X(35) VALUE 'INVENTORY TRANSACTIONS AUDIT TRAIL'.
05 PIC X(8) VALUE SPACES.
05 HL-1-DATE.
10 MONTH-1 PIC XX.
10 PIC X VALUE '/'.
10 DAY-1 PIC XX.
10 PIC X VALUE '/'.
10 YEAR-1 PIC XX.
05 PIC X(3) VALUE SPACES.
05 PIC X(5) VALUE 'PAGE'.
05 HL-1-PAGE-NUMBER PIC Z9.
01 HEADING-LINE-2.
05 PIC X(10) VALUE 'PART NO'.
05 PIC X(5) VALUE 'QUAN'.
05 PIC X(5) VALUE 'DATE'.
05 PIC X(11) VALUE 'CHARGE NO'.
05 PIC X(3) VALUE 'IN'.
05 PIC X(4) VALUE 'TRN'.
05 PIC X(3) VALUE SPACES.
05 PIC X(20) VALUE 'ERROR FIELD NAME'.
05 PIC X(17) VALUE 'ERROR FIELD VALUE'.
01 DETAIL-LINE.
05 PART-NUMBER PIC X(8).
05 PIC X VALUE SPACE.
05 QUANTITY PIC X(5).
05 PIC X VALUE SPACE.
05 DATE-X PIC X(4).
05 PIC X VALUE SPACE.
05 CHARGE-NUMBER PIC X(10).
05 PIC X VALUE SPACE.
05 INITIALS PIC XX.
05 PIC X VALUE SPACE.
05 TRANS-CODE PIC X(3).
05 PIC X(4) VALUE SPACES.
05 FIELD-NAME PIC X(18).
05 PIC XX VALUE SPACES.
05 FIELD-VALUE PIC X(10).
01 TRANSACTIONS.
05 PIC X(41) VALUE 'Total Transactions:'.
05 T-1 PIC 99.
01 ERROR-TRANSACTIONS.
05 PIC X(41) VALUE 'Total Error Transactions:'.
05 T-2 PIC 99.
01 GOOD-TRANSACTIONS.
05 PIC X(41) VALUE 'Total Good Transactions:'.
05 T-3 PIC 99.
01 QUANTITY-TOTAL.
05 PIC X(41) VALUE 'Good Transactions Quantity Total:'.
05 Q-4 PIC 9,999.
PROCEDURE DIVISION.
100-MAIN.
OPEN INPUT INVENTORY-TRANS-FILE-IN
OPEN OUTPUT INVENTORY-TRANS-FILE-OUT-2
ACCEPT WS-CURRENT-DATE FROM DATE
MOVE RUN-MONTH TO MONTH-1
MOVE RUN-DAY TO DAY-1
MOVE RUN-YEAR TO YEAR-1
PERFORM 150-WRITE-HEADINGS
PERFORM UNTIL RECORDS-ERROR-SWITCH = 'YES'
READ INVENTORY-TRANS-FILE-IN
AT END
PERFORM 500-TRANSACTIONS
PERFORM 510-ERROR-TRANSACTIONS
PERFORM 520-GOOD-TRANSACTIONS
PERFORM 530-QUANTITY
MOVE 'YES' TO RECORDS-ERROR-SWITCH
NOT AT END
PERFORM 200-PROCESS-ONE-RECORD
END-READ
END-PERFORM
CLOSE INVENTORY-TRANS-FILE-IN
CLOSE INVENTORY-TRANS-FILE-OUT-2
STOP RUN.
150-WRITE-HEADINGS.
ADD 1 TO PAGE-NUMBER
MOVE PAGE-NUMBER TO HL-1-PAGE-NUMBER
MOVE HEADING-LINE-1 TO INVENTORY-TRANS-RECORD-OUT-2
IF WS-FIRST-TIME-THRU = 'YES'
WRITE INVENTORY-TRANS-RECORD-OUT-2
MOVE 'NO' TO WS-FIRST-TIME-THRU
ELSE
WRITE INVENTORY-TRANS-RECORD-OUT-2 AFTER ADVANCING PAGE
END-IF
MOVE HEADING-LINE-2 TO INVENTORY-TRANS-RECORD-OUT-2
WRITE INVENTORY-TRANS-RECORD-OUT-2
MOVE 1 TO LINES-PRINTED.
200-PROCESS-ONE-RECORD.
IF LINES-PRINTED > 54
PERFORM 150-WRITE-HEADINGS
END-IF
MOVE 'NO' TO RECORDS-ERROR-SWITCH
PERFORM 300-VALIDATE-PART-NUMBER
PERFORM 310-VALIDATE-QUANTITY
PERFORM 320-VALIDATE-DATE
PERFORM 330-VALIDATE-CHARGE-NUMBER
PERFORM 340-VALIDATE-INITIALS
PERFORM 350-VALIDATE-TRANSACTION-CODE
MOVE PART-NUMBER-IN TO PART-NUMBER
MOVE QUANTITY-IN TO QUANTITY
MOVE DATE-IN TO DATE-X
MOVE CHARGE-NUMBER-IN TO CHARGE-NUMBER
MOVE INITIALS-IN TO INITIALS
MOVE TRANS-CODE-IN TO TRANS-CODE
IF RECORDS-ERROR-SWITCH = 'NO'
ADD 1 TO TOTAL-GOOD-COUNT
ADD 1 TO TOTAL-GOOD-QUANTITY
MOVE DETAIL-LINE TO INVENTORY-TRANS-RECORD-OUT-2
WRITE INVENTORY-TRANS-RECORD-OUT-2
ELSE
ADD 1 TO TOTAL-ERROR-COUNT
END-IF.
300-VALIDATE-PART-NUMBER.
IF NOT VALID-PART-NUMERIC-2
MOVE 'Part Number' TO FIELD-NAME
MOVE PART-NUMBER-IN TO FIELD-VALUE
END-IF.
310-VALIDATE-QUANTITY.
IF FUNCTION NUMVAL (QUANTITY-IN) IS GREATER THAN 20000
MOVE 'Quantity' TO FIELD-NAME
MOVE QUANTITY-IN TO FIELD-VALUE
END-IF.
320-VALIDATE-DATE.
IF NOT VALID-MONTH-IN
MOVE 'Date' TO FIELD-NAME
MOVE DATE-IN TO FIELD-VALUE
ELSE
IF NOT VALID-DAY-IN
MOVE 'Date' TO FIELD-NAME
MOVE DATE-IN TO FIELD-VALUE
END-IF
END-IF.
330-VALIDATE-CHARGE-NUMBER.
IF CHARGE-NUMBER-IN IS EQUAL TO ' '
MOVE 'Charge Number' TO FIELD-NAME
MOVE CHARGE-NUMBER-IN TO FIELD-VALUE
END-IF.
340-VALIDATE-INITIALS.
IF ((INITIALS-1-IN IS EQUAL TO ' ') OR (INITIALS-2-IN IS EQUAL TO ' '))
MOVE 'Initials' TO FIELD-NAME
MOVE INITIALS-IN TO FIELD-NAME
END-IF.
350-VALIDATE-TRANSACTION-CODE.
IF NOT VALID-TRANS-CODE-IN
MOVE 'Transaction Code' TO FIELD-NAME
MOVE TRANS-CODE-IN TO FIELD-VALUE
END-IF.
500-TRANSACTIONS.
MOVE WS-TOTAL TO TRANSACTIONS
MOVE T-1 TO INVENTORY-TRANS-RECORD-OUT-2
WRITE INVENTORY-TRANS-RECORD-OUT-2 AFTER ADVANCING 2 LINES.
510-ERROR-TRANSACTIONS.
MOVE WS-ERROR TO ERROR-TRANSACTIONS
MOVE T-2 TO INVENTORY-TRANS-RECORD-OUT-2
WRITE INVENTORY-TRANS-RECORD-OUT-2 AFTER ADVANCING 2 LINES.
520-GOOD-TRANSACTIONS.
MOVE WS-GOOD TO GOOD-TRANSACTIONS
MOVE T-3 TO INVENTORY-TRANS-RECORD-OUT-2
WRITE INVENTORY-TRANS-RECORD-OUT-2 AFTER ADVANCING 2 LINES.
530-QUANTITY.
MOVE WS-QUANTITY TO QUANTITY-TOTAL
MOVE Q-4 TO INVENTORY-TRANS-RECORD-OUT-2
WRITE INVENTORY-TRANS-RECORD-OUT-2 AFTER ADVANCING 2 LINES.
Please ask questions if you need more clarification.
Thank you.
The reason the content of FIELD-NAME and FIELD-VALUE are repeated is that nothing was done to change the content of those fields. At a minimum, it is necessary to move spaces into those fields after writing the report line. In 200-PROCESS-ONE-RECORD, insert a MOVE statement after writing the record, such as that shown below.
MOVE DETAIL-LINE TO INVENTORY-TRANS-RECORD-OUT-2
WRITE INVENTORY-TRANS-RECORD-OUT-2
MOVE SPACES TO FIELD-NAME FIELD-VALUE
This program is to read in the SEQ file and take the data thru different validations, if it fails to comply with one of the validations the error message is moved to FIELD-NAME.
After all data is processed all transaction are to be used to create the RPT file.
PROBLEM: When reviewing the RPT file, everything is duplicated except the Heading-Line-1. Another weird issue is that ERROR FIELD NAME/ERROR FIELD VALUE keeps repeating the same error after entry is passed.
If you run the code provided with the SEQ also provide you will see how the data currently prints. Attached below is a link to how the first page of data should look.
Desired Output file
SEQ:
11438A01 5000102667-X44 JBISS
12345A77 120103OK BY MIKELLREC
12789B02 14460606144-X22A AJ+
13168A02 31231722394 mkISS
13168A02 70102221-Q18 JBAJ-
2074B01 25 0532 OK BY JIMK RE
22109A04 20000325669-Y5Z DCISS
3077.B22 1000801144X MWAJ-
32149A01 10625567-X1 dcREC
39886B02 2000203517-AA JBAJ+
40442A2( 33 333-Q67 MKISS
43009B01 1440801899-23 MKISS
47890A02 30000422X-4-8 DCISS
49000B01 1000831901-Y6 MWAJ+
51111A011052X0905901-Y66 JBREC
52301A02 10228733876-X1 ABREC
55986b01 99990430A DCISS
57989A01 21130144X JBAJ+
57989A01 500831722394-XX MKISS
59901B0220300133X966-QQ22 MWREC
60022A01 400823 517-X1-33MWAJ+
66780B01 1000831722-YY BwREC
68999A01 21028123-Q88 MKISS
75312B01 500222966-32 BISS
77771A03 12780606 ABISS
78896B02 1000831123456-X13DCREC
80090B01 881$25983334-X25jbAJ
82432A05 420912722-X9 MWISS
83058C04 65000325Q1234 K*AJ+
85987D02 1061214Charge #32KBAJ-
87167B01 7000930144XX DCAJ+
91986 01 25072 900-23 MWISS
9576XA00 1001122j55 kbREC
96134B05 60214GOOD BSAJ-
98407C03254*00416Confirmed EHISS
Code:
IDENTIFICATION DIVISION.
PROGRAM-ID. INVTRAN.
* Tate
***************************************************************
* This program reads a fie of inventory transaction,
* validates the data, prints a report showing all transactions
* (with errors indicated), and writes a data file of
* all transactions without errors.
***************************************************************
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INVENTORY-TRANS-FILE-IN
ASSIGN TO 'INVTRAN.SEQ'
ORGANIZATION IS LINE SEQUENTIAL.
* SELECT INVENTORY-TRANS-FILE-OUT
* ASSIGN TO 'INVTRAN.OUT'
* ORGANIZATION IS LINE SEQUENTIAL.
SELECT INVENTORY-TRANS-FILE-OUT-2
ASSIGN TO 'INVTRAN.RPT'
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD INVENTORY-TRANS-FILE-IN.
01 INVENTORY-TRANS-RECORD-IN.
05 PART-NUMBER-IN.
10 PART-NUMERIC-1-IN PIC X(5).
10 PART-ALPHABETIC-IN PIC X.
10 PART-NUMERIC-2-IN PIC XX.
88 VALID-PART-NUMERIC-2 VALUE '01' THRU '68' '78' THRU '99'.
05 QUANTITY-IN.
10 QUANTITY-9-IN PIC 9(5).
05 DATE-IN.
10 MONTH-IN PIC XX.
88 VALID-MONTH-IN VALUE '01' THRU '12'.
10 DAY-IN PIC XX.
88 VALID-DAY-IN VALUE '01' THRU '31'.
05 CHARGE-NUMBER-IN PIC X(10).
05 INITIALS-IN.
10 INITIALS-1-IN PIC X.
10 INITIALS-2-IN PIC X.
05 TRANS-CODE-IN PIC X(3).
88 VALID-TRANS-CODE-IN VALUE 'REC' 'ISS' 'AJ+' 'AJ-'.
FD INVENTORY-TRANS-FILE-OUT-2.
01 INVENTORY-TRANS-RECORD-OUT-2 PIC X(80).
WORKING-STORAGE SECTION.
01 WS-FIRST-TIME-THRU PIC X(3) VALUE 'YES'.
01 LINES-PRINTED PIC 99 VALUE 99.
01 PAGE-NUMBER PIC 99 VALUE ZERO.
01 RECORDS-ERROR-SWITCH PIC X(3).
01 FIELD-ERROR-SWITCH PIC X(3).
01 WS-TOTAL PIC 99 VALUE ZERO.
01 WS-ERROR PIC 99 VALUE ZERO.
01 WS-GOOD PIC 99 VALUE ZERO.
01 WS-QUANTITY PIC 9V999 VALUE ZERO.
01 TOTAL-ERROR-COUNT PIC 9(3) VALUE ZERO.
01 TOTAL-GOOD-COUNT PIC 9(3) VALUE ZERO.
01 TOTAL-GOOD-QUANTITY PIC 9(5) VALUE ZERO.
01 WS-CURRENT-DATE-DATA.
05 WS-CURRENT-DATE.
10 RUN-YEAR PIC XX.
10 RUN-MONTH PIC XX.
10 RUN-DAY PIC XX.
01 HEADING-LINE-1.
05 PIC X(17) VALUE SPACES.
05 PIC X(35) VALUE 'INVENTORY TRANSACTIONS AUDIT TRAIL'.
05 PIC X(8) VALUE SPACES.
05 HL-1-DATE.
10 MONTH-1 PIC XX.
10 PIC X VALUE '/'.
10 DAY-1 PIC XX.
10 PIC X VALUE '/'.
10 YEAR-1 PIC XX.
05 PIC X(3) VALUE SPACES.
05 PIC X(5) VALUE 'PAGE'.
05 HL-1-PAGE-NUMBER PIC Z9.
01 HEADING-LINE-2.
05 PIC X(10) VALUE 'PART NO'.
05 PIC X(5) VALUE 'QUAN'.
05 PIC X(5) VALUE 'DATE'.
05 PIC X(11) VALUE 'CHARGE NO'.
05 PIC X(3) VALUE 'IN'.
05 PIC X(4) VALUE 'TRN'.
05 PIC X(3) VALUE SPACES.
05 PIC X(20) VALUE 'ERROR FIELD NAME'.
05 PIC X(17) VALUE 'ERROR FIELD VALUE'.
01 DETAIL-LINE.
05 PART-NUMBER PIC X(8).
05 PIC X VALUE SPACE.
05 QUANTITY PIC X(5).
05 PIC X VALUE SPACE.
05 DATE-X PIC X(4).
05 PIC X VALUE SPACE.
05 CHARGE-NUMBER PIC X(10).
05 PIC X VALUE SPACE.
05 INITIALS PIC XX.
05 PIC X VALUE SPACE.
05 TRANS-CODE PIC X(3).
05 PIC X(4) VALUE SPACES.
05 FIELD-NAME PIC X(18).
05 PIC XX VALUE SPACES.
05 FIELD-VALUE PIC X(10).
01 TRANSACTIONS.
05 PIC X(41) VALUE 'Total Transactions:'.
05 T-1 PIC 99.
01 ERROR-TRANSACTIONS.
05 PIC X(41) VALUE 'Total Error Transactions:'.
05 T-2 PIC 99.
01 GOOD-TRANSACTIONS.
05 PIC X(41) VALUE 'Total Good Transactions:'.
05 T-3 PIC 99.
01 QUANTITY-TOTAL.
05 PIC X(41) VALUE 'Good Transactions Quantity Total:'.
05 Q-4 PIC 9,999.
PROCEDURE DIVISION.
100-MAIN.
OPEN INPUT INVENTORY-TRANS-FILE-IN
OPEN OUTPUT INVENTORY-TRANS-FILE-OUT-2
ACCEPT WS-CURRENT-DATE FROM DATE
MOVE RUN-MONTH TO MONTH-1
MOVE RUN-DAY TO DAY-1
MOVE RUN-YEAR TO YEAR-1
PERFORM 150-WRITE-HEADINGS
PERFORM UNTIL RECORDS-ERROR-SWITCH = 'YES'
READ INVENTORY-TRANS-FILE-IN
AT END
PERFORM 500-TRANSACTIONS
PERFORM 510-ERROR-TRANSACTIONS
PERFORM 520-GOOD-TRANSACTIONS
PERFORM 530-QUANTITY
MOVE 'YES' TO RECORDS-ERROR-SWITCH
NOT AT END
PERFORM 200-PROCESS-ONE-RECORD
END-READ
END-PERFORM
CLOSE INVENTORY-TRANS-FILE-IN
CLOSE INVENTORY-TRANS-FILE-OUT-2
STOP RUN.
150-WRITE-HEADINGS.
ADD 1 TO PAGE-NUMBER
MOVE PAGE-NUMBER TO HL-1-PAGE-NUMBER
MOVE HEADING-LINE-1 TO INVENTORY-TRANS-RECORD-OUT-2
IF WS-FIRST-TIME-THRU = 'YES'
WRITE INVENTORY-TRANS-RECORD-OUT-2
MOVE 'NO' TO WS-FIRST-TIME-THRU
ELSE
WRITE INVENTORY-TRANS-RECORD-OUT-2 AFTER ADVANCING PAGE
END-IF
MOVE HEADING-LINE-2 TO INVENTORY-TRANS-RECORD-OUT-2
WRITE INVENTORY-TRANS-RECORD-OUT-2
MOVE 1 TO LINES-PRINTED.
200-PROCESS-ONE-RECORD.
IF LINES-PRINTED > 54
PERFORM 150-WRITE-HEADINGS
END-IF
MOVE 'NO' TO RECORDS-ERROR-SWITCH
PERFORM 300-VALIDATE-PART-NUMBER
PERFORM 310-VALIDATE-QUANTITY
PERFORM 320-VALIDATE-DATE
PERFORM 330-VALIDATE-CHARGE-NUMBER
PERFORM 340-VALIDATE-INITIALS
PERFORM 350-VALIDATE-TRANSACTION-CODE
MOVE PART-NUMBER-IN TO PART-NUMBER
MOVE QUANTITY-IN TO QUANTITY
MOVE DATE-IN TO DATE-X
MOVE CHARGE-NUMBER-IN TO CHARGE-NUMBER
MOVE INITIALS-IN TO INITIALS
MOVE TRANS-CODE-IN TO TRANS-CODE
IF RECORDS-ERROR-SWITCH = 'NO'
ADD 1 TO TOTAL-GOOD-COUNT
ADD 1 TO TOTAL-GOOD-QUANTITY
WRITE INVENTORY-TRANS-RECORD-OUT-2
MOVE DETAIL-LINE TO INVENTORY-TRANS-RECORD-OUT-2
WRITE INVENTORY-TRANS-RECORD-OUT-2
ELSE
ADD 1 TO TOTAL-ERROR-COUNT
END-IF.
300-VALIDATE-PART-NUMBER.
IF NOT VALID-PART-NUMERIC-2
MOVE 'Part Number' TO FIELD-NAME
MOVE PART-NUMBER-IN TO FIELD-VALUE
END-IF.
310-VALIDATE-QUANTITY.
IF QUANTITY-9-IN IS GREATER THAN '20,000'
MOVE 'Quantity' TO FIELD-NAME
MOVE QUANTITY-IN TO FIELD-VALUE
END-IF.
320-VALIDATE-DATE.
IF NOT VALID-MONTH-IN
MOVE 'Date' TO FIELD-NAME
MOVE DATE-IN TO FIELD-VALUE
ELSE
IF NOT VALID-DAY-IN
MOVE 'Date' TO FIELD-NAME
MOVE DATE-IN TO FIELD-VALUE
END-IF
END-IF.
330-VALIDATE-CHARGE-NUMBER.
IF CHARGE-NUMBER-IN IS EQUAL TO ''
MOVE 'Charge Number' TO FIELD-NAME
MOVE CHARGE-NUMBER-IN TO FIELD-VALUE
END-IF.
340-VALIDATE-INITIALS.
IF ((INITIALS-1-IN IS EQUAL TO '') OR (INITIALS-2-IN IS EQUAL TO ''))
MOVE 'Initials' TO FIELD-NAME
MOVE INITIALS-IN TO FIELD-NAME
END-IF.
350-VALIDATE-TRANSACTION-CODE.
IF NOT VALID-TRANS-CODE-IN
MOVE 'Transaction Code' TO FIELD-NAME
MOVE TRANS-CODE-IN TO FIELD-VALUE
END-IF.
500-TRANSACTIONS.
MOVE WS-TOTAL TO TRANSACTIONS
MOVE T-1 TO INVENTORY-TRANS-RECORD-OUT-2
WRITE INVENTORY-TRANS-RECORD-OUT-2 AFTER ADVANCING 2 LINES.
510-ERROR-TRANSACTIONS.
MOVE WS-ERROR TO ERROR-TRANSACTIONS
MOVE T-2 TO INVENTORY-TRANS-RECORD-OUT-2
WRITE INVENTORY-TRANS-RECORD-OUT-2 AFTER ADVANCING 2 LINES.
520-GOOD-TRANSACTIONS.
MOVE WS-GOOD TO GOOD-TRANSACTIONS
MOVE T-3 TO INVENTORY-TRANS-RECORD-OUT-2
WRITE INVENTORY-TRANS-RECORD-OUT-2 AFTER ADVANCING 2 LINES.
530-QUANTITY.
MOVE WS-QUANTITY TO QUANTITY-TOTAL
MOVE Q-4 TO INVENTORY-TRANS-RECORD-OUT-2
WRITE INVENTORY-TRANS-RECORD-OUT-2 AFTER ADVANCING 2 LINES.
If you have any questions please let me know.
The duplicate output occurs in the following code.
IF RECORDS-ERROR-SWITCH = 'NO'
ADD 1 TO TOTAL-GOOD-COUNT
ADD 1 TO TOTAL-GOOD-QUANTITY
WRITE INVENTORY-TRANS-RECORD-OUT-2
MOVE DETAIL-LINE TO INVENTORY-TRANS-RECORD-OUT-2
WRITE INVENTORY-TRANS-RECORD-OUT-2
The first WRITE statement prints a duplicate of the previous line. The second WRITE statement prints a new line, which is printed again on the next loop. Remove the first WRITE statement.
Other problems I noted are:
Invalid literals
330-VALIDATE-CHARGE-NUMBER.
IF CHARGE-NUMBER-IN IS EQUAL TO ''
340-VALIDATE-INITIALS.
IF ((INITIALS-1-IN IS EQUAL TO '') OR (INITIALS-2-IN IS EQUAL TO ''))
A zero-length literal is not permitted; thus, in each case, '' should be ' '.
Invalid numeric compare
310-VALIDATE-QUANTITY.
IF QUANTITY-9-IN IS GREATER THAN '20,000'
QUANTITY-9-IN is defined as PIC 9(5); however the data contains leading spaces and '20,000' is not valid for numeric comparisons. A proper numeric comparison could be:
IF FUNCTION NUMVAL (QUANTITY-IN) IS GREATER THAN 20000
These following were not investigated further than noted.
Print spacing does not match the desired output
There are no ADVANCING phrases for the lines written, thus only single-spacing is used.
Totals do not print correctly
WS-QUANTITY is defined as PIC 9V999. It should be 9999 or 9(4).
The data items for the totals are not being incremented.
The MOVE statements in the 500-, 510-, 520-, and 530- paragraphs overwrite fixed text.
I am still new to COBOL and have been working on a project for school for almost a week now. I am running OpenCobol 1.1.
When I try to compile it I get this error.
typeck.c:5912: Invalid type cast from 'null'
Tag 1 0 Tag 2 10
Aborting compile of lab4.cob at line 214
I've been frustrated because I've tried changing the code around a lot with no luck.
Procedure Division.
000-Main.
Perform 100-initialize
Perform Until EndOfFile = "Y"
Read Lab4-in-File
At End
Move "Y" To EndOfFile
Not At End
Perform 300-process
End-Read
End-Perform
Perform 900-finalize
Stop Run.
100-intialize.
Perform 110-open-files
Perform 120-get-data.
110-open-files.
Open Input Lab4-in-File
Output Ot-File.
120-get-date.
Accept WS-date from date yyyymmdd
Move WS-Year To PH-Year
Move WS-Month To PH-Month
Move WS-Day To PH-Day.
300-process.
Move Dept-no To dl-dep-no
Move Employee-no To dl-emp-no
If First-name Not = "Null"
String First-name Delimited By Size
" " Delimited By Size
Last-name Delimited By Size
Into dl-emp
else
Move Last-name To dl-emp
End-If
Move Job-title To dl-job
Move DOH To dl-doh
Move Mar-status To dl-marital
Move Dependents To dl-dependents
Move MCoverage To dl-insurance
Move DCoverage To dl-insurance
Move VCoverage To dl-insurance
Move 401K To dl-401k
Move Pay-code To dl-pay-code
If Pay-code = "C" Or "S"
Compute Pay-hold rounded =
Pay / 12
Move Pay-hold To dl-monthly-pay
else
Compute Pay-hold rounded =
Pay * HPW * 4
Move Pay-hold To dl-monthly-pay
End-If
If Pay-code = "C"
Compute Com-hold rounded =
Act-sale * C-rate
Move Com-hold To dl-commission
Else
Move 0 To dl-commission
End-If
Perform 800-print
Multiply C-rate By Act-sale Giving
total-sales
Add Pay To total-sales.
800-print.
If LineNum > LinesPerPage
Perform 825-new-page
End-If
Write Lab4-Record2 From Detail-Line
**After advancing 1 line** *> This is line 214
Add 1 To LineNum.
825-new-page.
If PageNum > 0
Write Lab4-Record2 From Blank-line
After advancing 1 line
End-If
Add 1 To PageNum
Move PageNum To PH-PageNo
Write Lab4-Record2 From Page-Header
After advancing page
Write Lab4-Record2 From Blank-line
After advancing 1 line
Write Lab4-Record2 From Column-Header
After advancing 1 line
Write Lab4-Record2 From Blank-line
After advancing 1 line
Move 5 To LineNum.
900-finalize.
Perform 950-print-monthly-total
Perform 999-close-files.
950-print-monthly-total.
If LineNum + 1 > LinesPerPage
Perform 825-new-page
End-If
Write Lab4-Record2 From Blank-line
After advancing 1 line
Move total-sales To Total-pay
Write Lab4-Record2 From Total-Line
After advancing 1 line
Add 2 To LineNum.
999-close-files.
Close Lab4-in-File Ot-File.
I would really appreciate it if someone could help me find what is causing the error. Thanks in advance!
Working-Storage Section.
01 EndOfFile Pic X Value "N".
01 Report-fields.
05 PageNum Pic 9(3) value 0.
05 LinesPerPage Pic 9(2) value 40.
05 LineNum Pic 9(2) value 41.
01 WS-date.
05 WS-Year Pic 9(4).
05 WS-Month Pic 99.
05 WS-Day Pic 99.
01 total-fields.
05 total-sales Pic 9(11)v99 Value 0.
01 Page-Header.
05 PH-Month Pic Z9/.
05 PH-Day Pic 99/.
05 PH-Year Pic 9999.
05 Pic X(7) Value Spaces.
05 Pic X(29) Value "Stomper &" &
" Wombat's Emporium"
05 Pic X(6) Value "Page:".
05 PH-PageNo Pic ZZ9.
01 Column-Header.
05 Pic X(8) Value "Dep #".
05 Pic X(15) Value "Emp #".
05 Pic X(27) Value "Employee".
05 Pic X(18) Value "Title".
05 Pic X(9) Value "DOH".
05 Pic X(9) Value "Marital".
05 Pic X(7) Value "#Deps".
05 Pic X(6) Value "Ins".
05 Pic X(6) Value "401K".
05 Pic X(6) Value "Pay".
05 Pic X(27) Value "Expected " &
"Pay + Commission".
01 Pay-hold Pic 9(9)V9(2) Value 0.
01 Com-hold Pic 9(9)V9(2) Value 0.
01 Detail-Line.
05 dl-dep-no Pic X(5).
05 Pic X(1) Value spaces.
05 dl-emp-no Pic X(5).
05 Pic X(1) Value spaces.
05 dl-emp Pic X(35).
05 Pic X(1) Value spaces.
05 dl-job Pic X(20).
05 Pic X(1) Value spaces.
05 dl-doh Pic X(8).
05 Pic X(1) Value spaces.
05 dl-marital Pic X.
05 Pic X(1) Value spaces.
05 dl-dependents Pic 9(2).
05 Pic X(1) Value spaces.
05 dl-insurance Pic X(3).
05 Pic X(1) Value spaces.
05 dl-401k Pic Z.9ZZ.
05 Pic X(1) Value spaces.
05 dl-pay-code Pic X.
05 Pic X(1) Value spaces.
05 dl-monthly-pay Pic $$$$,$$$,$$9.99.
05 Pic X(1) Value spaces.
05 dl-commission Pic $$$,$$9.99.
01 Total-Line.
05 Pic X(61) Value Spaces.
05 Pic X(24) Value "Total" &
" Expected Payroll: ".
05 Total-pay Pic $$$$,$$$,$$$,$$9.99.
01 Blank-line Pic X Value spaces.
The compiler has a broken parser. It is broken because of a coding error (still a compiler bug). In cases like this you only have the chance to either spot the error or - much better - use a newer version.
I've just put your code in an online compiler using the last release of the compiler: GnuCOBOL 2.2. I highly suggest to upgrade to at least this version.
See your code here - I've just added a minimal header and end.
Then click on "Execute" and you compile it online, leading to the following error messages:
main.cobc: 27: error: duplicate PICTURE clause
main.cobc: 27: error: duplicate VALUE clause
main.cobc: 64: error: a Z or * which is after the decimal point cannot follow 9
If you check the line 27 in this program you see
05 Pic X(29) Value "Stomper &" &
" Wombat's Emporium" *> <<- missing period
05 Pic X(6) Value "Page:".
Fixed code is also available.
I'm trying to code a program to determine if different kinds of errors appear in a given file. I'm going to post my entire code, because I honestly have no idea where I'm going wrong here. It's just abending on me. The data validation is 2100-error-checking.
IDENTIFICATION DIVISION.
PROGRAM-ID. ASSIGNMENT1.
AUTHOR. AARON.
******************************************************************
ENVIRONMENT DIVISION.
* defines the external files - an input file and output file
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT DATVAL02 ASSIGN TO DATAIN
FILE STATUS IS EF-STATUS.
SELECT REPORT-FILE ASSIGN TO DATAOUT
FILE STATUS IS PF-STATUS.
DATA DIVISION.
FILE SECTION.
FD DATVAL02.
01 SALES-RECORD.
05 RECORD-CODE PIC XX.
05 FILLER PIC X.
05 VEND-NUM PIC X(8).
05 DATE-DUE.
05 YEAR-DUE PIC XX.
05 MONTH-DUE PIC XX.
05 DAY-DUE PIC XX.
05 VEND-NAME PIC X(20).
05 FILLER PIC XXX.
05 AMT-DUE PIC S9(6)V99.
FD REPORT-FILE.
01 REPORT-RECORD PIC X(80).
WORKING-STORAGE SECTION.
01 FLAGS-AND-ACCUMLATORS.
05 VALID-RECORDS PIC S99 VALUE 0.
05 INVALID-RECORDS PIC S99 VALUE 0.
05 EF-STATUS PIC 99 VALUE 0.
05 PF-STATUS PIC 99 VALUE 0.
05 A-ERROR PIC X VALUE SPACE.
05 C-ERROR PIC X VALUE SPACE.
05 E-ERROR PIC X VALUE SPACE.
05 F-ERROR PIC X VALUE SPACE.
05 B-ERROR PIC X VALUE SPACE.
05 D-ERROR PIC X VALUE SPACE.
05 G-ERROR PIC X VALUE SPACE.
05 H-ERROR PIC X VALUE SPACE.
05 I-ERROR PIC X VALUE SPACE.
05 A-AST PIC XX VALUE SPACES.
05 BC-AST PIC X(8) VALUE SPACES.
05 D-AST PIC XX VALUE SPACES.
05 E-AST PIC XX VALUE SPACES.
05 F-AST PIC XX VALUE SPACES.
05 G-AST PIC X(15) VALUE SPACES.
05 H-AST PIC X(15) VALUE SPACES.
05 I-AST PIC X(8) VALUE SPACES.
05 END-OF-FILE PIC XXX VALUE "NO".
05 ERROR-FLAG PIC XXX VALUE SPACES.
05 ERROR-FLAG2 PIC XXX VALUE SPACES.
05 ERROR-FILLER PIC XXX VALUE SPACES.
05 VC PIC XX VALUE "VC".
05 NOO PIC XX VALUE "NO".
05 D-CHECK PIC S9999999V99.
05 DAY-DUE-NUM PIC 99.
05 MONTH-DUE-NUM PIC 99.
01 HEADING-LINE-1.
05 PIC X(15) VALUE SPACES.
05 PIC X(24) VALUE
"VENDOR RECORD VALIDATION".
05 PIC X(24) VALUE SPACES.
05 PIC X(6) VALUE
"PAGE 1".
01 HEADING-LINE-2.
05 PIC XX VALUE
"RC".
05 PIC X VALUE SPACE.
05 PIC X(8) VALUE
"VENDOR #".
05 PIC XX VALUE SPACES.
05 PIC X(8) VALUE
"DATE DUE".
05 PIC XX VALUE SPACES.
05 PIC X(11) VALUE
"VENDOR NAME".
05 PIC X(6) VALUE SPACES.
05 PIC X(10) VALUE
"AMOUNT DUE".
05 PIC XXX VALUE SPACES.
05 PIC X(16) VALUE
"-- ERROR CODES--".
01 DETAIL-LINE.
05 RECORD-CODE-OUT PIC XX.
05 PIC X VALUE SPACE.
05 VEND-NUM-OUT PIC X(8).
05 PIC XX VALUE SPACES.
05 YEAR-DUE-OUT PIC XX.
05 MONTH-DUE-OUT PIC XX.
05 DAY-DUE-OUT PIC XX.
05 PIC XX VALUE SPACES.
05 VEND-NAME-OUT PIC X(20).
05 PIC XX VALUE SPACES.
05 AMT-DUE-OUT PIC 999,999.99.
05 PIC XX VALUE SPACES.
05 A-ERROR-OUT PIC X VALUE SPACES.
05 PIC XX VALUE SPACES.
05 B-ERROR-OUT PIC X VALUE SPACE.
05 PIC XX VALUE SPACES.
05 C-ERROR-OUT PIC X VALUE SPACE.
05 PIC XX VALUE SPACES.
05 D-ERROR-OUT PIC X VALUE SPACE.
05 PIC XX VALUE SPACES.
05 E-ERROR-OUT PIC X VALUE SPACE.
05 PIC XX VALUE SPACES.
05 F-ERROR-OUT PIC X VALUE SPACE.
05 PIC XX VALUE SPACES.
05 G-ERROR-OUT PIC X VALUE SPACE.
05 PIC XX VALUE SPACES.
05 H-ERROR-OUT PIC X VALUE SPACE.
05 PIC XX VALUE SPACES.
05 I-ERROR-OUT PIC X VALUE SPACE.
01 ASTERISK-LINE.
05 A-AST-OUT PIC XX VALUE SPACES.
05 PIC X VALUE SPACE.
05 BC-AST-OUT PIC X(8) VALUE SPACES.
05 PIC XX VALUE SPACES.
05 D-AST-OUT PIC XX VALUE SPACES.
05 PIC X VALUE SPACE.
05 E-AST-OUT PIC XX VALUE SPACES.
05 PIC X VALUE SPACE.
05 F-AST-OUT PIC XX VALUE SPACES.
05 PIC XX VALUE SPACES.
05 G-AST-OUT PIC X(15) VALUE SPACES.
05 PIC XX VALUE SPACES.
05 I-AST-OUT PIC X(8) VALUE SPACES.
05 PIC XX VALUE SPACES.
05 H-AST-OUT PIC X(8) VALUE SPACES.
01 RECORD-TOTALS.
05 PIC X(16) VALUE
"VALID RECORDS: ".
05 VALID-RECORDS-OUT PIC 99.
05 PIC XX VALUE SPACES.
05 PIC X(17) VALUE
"INVALID RECORDS: ".
05 INVALID-RECORDS-OUT PIC 99.
PROCEDURE DIVISION.
1000-MAIN-CONTROL.
PERFORM 2000-INITIALIZE.
PERFORM UNTIL END-OF-FILE = "YES"
READ DATVAL02
AT END
MOVE "YES" TO END-OF-FILE
NOT AT END
PERFORM 2100-ERROR-ROUTINE
IF ERROR-FLAG = "YES"
PERFORM 2500-PROCESS
PERFORM 3000-PROCESS
PERFORM 4200-REINITILIZE
END-IF
IF ERROR-FLAG = "NO"
PERFORM 2500-PROCESS
END-IF
END-READ
END-PERFORM.
PERFORM 4000-PROCESS.
PERFORM 4500-TERMINATE.
STOP RUN.
2000-INITIALIZE.
OPEN INPUT DATVAL02.
OPEN OUTPUT REPORT-FILE.
WRITE REPORT-RECORD FROM HEADING-LINE-1.
WRITE REPORT-RECORD FROM HEADING-LINE-2.
2100-ERROR-ROUTINE.
MOVE "NO" TO ERROR-FLAG.
MOVE "NO" TO ERROR-FLAG2.
IF VEND-NUM = SPACES
MOVE "YES" TO ERROR-FLAG
MOVE "********" TO BC-AST-OUT
MOVE "B" TO B-ERROR-OUT
END-IF.
IF VEND-NUM IS NOT NUMERIC AND ERROR-FLAG = NOO
MOVE "YES" TO ERROR-FLAG
MOVE "********" TO BC-AST-OUT
MOVE "C" TO C-ERROR-OUT
END-IF.
IF RECORD-CODE IS NOT = VC
MOVE "YES" TO ERROR-FLAG
MOVE "**" TO A-AST-OUT
MOVE "A" TO A-ERROR-OUT
END-IF.
IF DATE-DUE IS NOT NUMERIC
MOVE "YES" TO ERROR-FLAG2
MOVE "YES" TO ERROR-FLAG
MOVE "**" TO D-AST-OUT
MOVE "D" TO D-ERROR-OUT
MOVE "**" TO E-AST-OUT
MOVE "**" TO F-AST-OUT
END-IF.
IF DATE-DUE = 0 AND ERROR-FLAG2 = NOO
IF AMT-DUE IS > 0
MOVE "YES" TO ERROR-FLAG
MOVE "YES" TO ERROR-FLAG2
MOVE "**" TO D-AST-OUT
MOVE "D" TO D-ERROR-OUT
MOVE "**" TO E-AST-OUT
MOVE "**" TO F-AST-OUT
END-IF
END-IF.
MOVE DAY-DUE TO DAY-DUE-NUM.
MOVE MONTH-DUE TO MONTH-DUE-NUM.
IF DAY-DUE-NUM > 31 OR DAY-DUE < 0 AND ERROR-FLAG2 = NOO
MOVE "YES" TO ERROR-FLAG
MOVE "**" TO E-AST-OUT
MOVE "E" TO E-ERROR-OUT
END-IF.
IF MONTH-DUE-NUM > 12 OR < 1 AND ERROR-FLAG2 = NOO
MOVE "YES" TO ERROR-FLAG
MOVE "**" TO F-AST-OUT
MOVE "F" TO F-ERROR-OUT
END-IF.
IF VEND-NAME = SPACES
MOVE "YES" TO ERROR-FLAG
MOVE "***************" TO G-AST-OUT
MOVE "G" TO G-ERROR-OUT
END-IF.
IF VEND-NAME(1:1) IS EQUAL TO SPACE
MOVE "YES" TO ERROR-FLAG
MOVE "***************" TO H-AST-OUT
MOVE "H" TO H-ERROR-OUT
IF AMT-DUE IS NOT NUMERIC
MOVE "YES" TO ERROR-FLAG
MOVE "********" TO I-AST-OUT
MOVE "I" TO I-ERROR-OUT
END-IF.
IF ERROR-FLAG = "YES"
ADD 1 TO INVALID-RECORDS
END-IF.
IF ERROR-FLAG = "NO"
ADD 1 TO VALID-RECORDS
END-IF.
2500-PROCESS.
MOVE RECORD-CODE TO RECORD-CODE-OUT.
MOVE VEND-NUM TO VEND-NUM-OUT.
MOVE YEAR-DUE TO YEAR-DUE-OUT.
MOVE MONTH-DUE TO MONTH-DUE-OUT.
MOVE DAY-DUE TO DAY-DUE-OUT.
MOVE VEND-NAME TO VEND-NAME-OUT.
MOVE AMT-DUE TO AMT-DUE-OUT.
WRITE REPORT-RECORD FROM DETAIL-LINE.
3000-PROCESS.
WRITE REPORT-RECORD FROM ASTERISK-LINE.
4000-PROCESS.
MOVE VALID-RECORDS TO VALID-RECORDS-OUT.
MOVE INVALID-RECORDS TO INVALID-RECORDS-OUT.
WRITE REPORT-RECORD FROM RECORD-TOTALS.
4200-REINITILIZE.
MOVE A-ERROR TO A-ERROR-OUT.
MOVE B-ERROR TO B-ERROR-OUT.
MOVE C-ERROR TO C-ERROR-OUT.
MOVE D-ERROR TO D-ERROR-OUT.
MOVE E-ERROR TO E-ERROR-OUT.
MOVE F-ERROR TO F-ERROR-OUT.
MOVE G-ERROR TO G-ERROR-OUT.
MOVE H-ERROR TO H-ERROR-OUT.
MOVE I-ERROR TO I-ERROR-OUT.
MOVE A-AST TO A-AST-OUT.
MOVE BC-AST TO BC-AST-OUT.
MOVE D-AST TO D-AST-OUT.
MOVE E-AST TO E-AST-OUT.
MOVE F-AST TO F-AST-OUT.
MOVE G-AST TO G-AST-OUT.
MOVE H-AST TO H-AST-OUT.
MOVE I-AST TO I-AST-OUT.
MOVE ERROR-FILLER TO ERROR-FLAG.
MOVE ERROR-FILLER TO ERROR-FLAG2.
MOVE A-AST TO DAY-DUE-NUM.
MOVE A-AST TO MONTH-DUE-NUM.
4500-TERMINATE.
CLOSE DATVAL02, REPORT-FILE.
Data in looks as such...
VC 10045380051005ABC ELECTRONICS 00001298
VT 000000 00020000
Looking to achieve this
XX 9AAA9999 99/99/99 SHIFTED 12A 4GL 78 A C E F H I
** ******** ** ** *************** *** *** **
where * are under errors in the data. And letters show what errors are found.
In your latest version, you have made a group item (DATE-DUE) but you have not adjusted the level-numbers for the other date fields which are subordinate to it. I have made those three level 10. To use SYSIN data to be convenient for me, I added a 32-byte FILLER to the end of the input record.
I compile, gets an RC/CC of 4, so the linkedit/binder runs.
I used this data from your other question:
VC 10045380051005ABC ELECTRONICS 00001298
VC 050926XYZ COMPANY 00R00549
VT 12348760051115QUALITY ASSURANCE CO 00400053
VC A14BCF80051201 00100930
And got this output, with no abend:
VENDOR RECORD VALIDATION PAGE 1
RC VENDOR # DATE DUE VENDOR NAME AMOUNT DUE -- ERROR CODES--
VC 10045380 051005 ABC ELECTRONICS 000,012.98
VC 050926 XYZ COMPANY 009,005.49 B
********
VT 12348760 051115 QUALITY ASSURANCE CO 004,000.53 A
**
VC A14BCF80 051201 001,009.30 C G H
******** *************** ********
VALID RECORDS: 01 INVALID RECORDS: 03
I have pasted the data from your other question.
Note, if your actual data is incorrect, you may get an abend with the amount field.
Note also what has happened to the R in the amount field. You haven't validated that for NUMERIC.
I have now compiled and run your program with the two corrections (the VALUE clauses for the two counts, and the END-READ). Here is the output:
VENDOR RECORD VALIDATION PAGE 1
RC VENDOR # DATE DUE VENDOR NAME AMOUNT DUE -- ERROR CODES--
VC 10045380 051005 ABC ELECTRONICS 000,01298
VT 0 000000 000,20000 B
********
VALID RECORDS: 01 INVALID RECORDS: 01
I used a fixed-length file, as I don't have access to your actual file, which must be variable-length (it is good to be explicit in the FD, then you don't get those I-informational messages at the end of your compile).
You still have some things to sort out, but the program is running and producing output. If you make those code changes and still have problems, then it is your file that is in error.
You have a very frustrating problem which seems to be down to the "environment". You need to be able to see your compile listings. If the compile fails (RC/CC above 4) then your linkedit/binder step won't run, and you won't get a new executable program. I think that is your problem, but you need help from your tutor to sort out how to find the compile listing and confirm that there are no errors.
I have not used Rational Developer and don't know if you are using zPDT or are compiling on the Mainframe or how you'd look at the compiler output in either case from your Rational Developer session.
Your code is basically OK for a learner, and probably has been for a couple of days. You have been struggling with a problem not directly to do with the code, but to do with not knowing your program had compile errors. Basically, except for a couple of typos, it was there.
When you do get it running in your environment, update your Code Review question please.
A really good thing to know is what compile produced the version of the program that you ran, whether or not it abended.
You can display the date and time that the program was compiled:
WORKING-STORAGE SECTION.
01 W-WHEN-COMPILED PIC X(8)BX(8).
...
Before doing anything else, other than identifying that it is the first time in a CALLed sub-program, something like this:
MOVE WHEN-COMPILED TO W-WHEN-COMPILED
DISPLAY
"Program XXXXXXXX compiled on "
W-WHEN-COMPILED
The output you get will be the date/time from the actual compile of that program, matching exactly to the date/time on the compile listing.
I've used code like that, and recommended it to others, for over 30 years, and it has saved shed-loads of time.
There is also an intrinsic FUNCTION, WHEN-COMPILED. This is the same, but with a four-digit year. Since for the forseeable future the CC in the year will be 20 you can chose which one to do. Both are resolved at compile-time, and impact on run-time will be minimal.
You have no END-READ. This gives you an E-level diagnostic from the compile, a Return-Code/Condition-Code of 8, and you linkedit/binder step following probably hasn't run (have a look at the COND for the step in file 2 of the spool for your job).
Here is your code as a reminder:
PERFORM UNTIL END-OF-FILE = "YES"
READ DATVAL02
AT END
MOVE "YES" TO END-OF-FILE
NOT AT END
PERFORM 2100-ERROR-ROUTINE
IF ERROR-FLAG = "YES"
PERFORM 2500-PROCESS
PERFORM 3000-PROCESS
END-IF
IF ERROR-FLAG = "NO"
PERFORM 2500-PROCESS
END-IF
END-PERFORM.
Here is what it could look like with the END-READ:
PERFORM UNTIL END-OF-FILE = "YES"
READ DATVAL02
AT END
MOVE "YES" TO END-OF-FILE
NOT AT END
PERFORM 2100-ERROR-ROUTINE
IF ERROR-FLAG = "YES"
PERFORM 2500-PROCESS
PERFORM 3000-PROCESS
END-IF
IF ERROR-FLAG = "NO"
PERFORM 2500-PROCESS
END-IF
END-READ
END-PERFORM
Since no new program has been linked, you are running the old program still and getting the old error still.
You are adding to non-binary fields which you have not given an initial value.
05 VALID-RECORDS PIC S99.
05 INVALID-RECORDS PIC S99.
IF ERROR-FLAG = "YES"
ADD 1 TO INVALID-RECORDS
END-IF.
IF ERROR-FLAG = "NO"
ADD 1 TO VALID-RECORDS
END-IF.
Without an initial value (either from a VALUE clause, or a MOVE or even the dread INITIALIZE), the value is undefined and is unlikely to be valid for a zoned-decimal field, so S0C7.
Have a look at this: https://stackoverflow.com/a/17102485/1927206 to see if you can work out from that exactly where it is failing in your program.
Program which compiles clean, with RC 0 and no diagnostic messages, and runs without abend:
ID DIVISION.
PROGRAM-ID. VARA.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT DATVAL02 ASSIGN TO DATAIN
FILE STATUS IS EF-STATUS.
SELECT REPORT-FILE ASSIGN TO DATAOUT
FILE STATUS IS PF-STATUS.
DATA DIVISION.
FILE SECTION.
FD DATVAL02 RECORDING MODE F.
01 SALES-RECORD.
05 RECORD-CODE PIC XX.
05 FILLER PIC X.
05 VEND-NUM PIC X(8).
05 YEAR-DUE PIC 99.
05 MONTH-DUE PIC 99.
05 DAY-DUE PIC 99.
05 VEND-NAME PIC X(20).
05 FILLER PIC XXX.
05 AMT-DUE PIC S9(6)V99.
05 FILLER PIC X(32).
FD REPORT-FILE RECORDING MODE F.
01 REPORT-RECORD PIC X(80).
WORKING-STORAGE SECTION.
01 W-WHEN-COMPILED PIC X(8)BX(8).
01 FLAGS-AND-ACCUMLATORS.
05 VALID-RECORDS PIC S99 VALUE ZERO.
05 INVALID-RECORDS PIC S99 VALUE ZERO.
05 EF-STATUS PIC 99 VALUE 0.
05 PF-STATUS PIC 99 VALUE 0.
05 A-ERROR PIC X VALUE SPACE.
05 C-ERROR PIC X VALUE SPACE.
05 E-ERROR PIC X VALUE SPACE.
05 F-ERROR PIC X VALUE SPACE.
05 B-ERROR PIC X VALUE SPACE.
05 D-ERROR PIC X VALUE SPACE.
05 G-ERROR PIC X VALUE SPACE.
05 H-ERROR PIC X VALUE SPACE.
05 I-ERROR PIC X VALUE SPACE.
05 A-AST PIC XX VALUE SPACES.
05 BC-AST PIC X(8) VALUE SPACES.
05 D-AST PIC XX VALUE SPACES.
05 E-AST PIC XX VALUE SPACES.
05 F-AST PIC XX VALUE SPACES.
05 G-AST PIC X(15) VALUE SPACES.
05 I-AST PIC X(8) VALUE SPACES.
05 END-OF-FILE PIC XXX VALUE "NO".
05 ERROR-FLAG PIC XXX VALUE SPACES.
05 ERROR-FLAG2 PIC XXX VALUE SPACES.
05 VC PIC XX VALUE "VC".
05 NOO PIC XX VALUE "NO".
05 D-CHECK PIC S9999999V99.
01 HEADING-LINE-1.
05 PIC X(15) VALUE SPACES.
05 PIC X(24) VALUE
"VENDOR RECORD VALIDATION".
05 PIC X(24) VALUE SPACES.
05 PIC X(6) VALUE
"PAGE 1".
01 HEADING-LINE-2.
05 PIC XX VALUE
"RC".
05 PIC X VALUE SPACE.
05 PIC X(8) VALUE
"VENDOR #".
05 PIC XX VALUE SPACES.
05 PIC X(8) VALUE
"DATE DUE".
05 PIC XX VALUE SPACES.
05 PIC X(11) VALUE
"VENDOR NAME".
05 PIC X(6) VALUE SPACES.
05 PIC X(10) VALUE
"AMOUNT DUE".
05 PIC XXX VALUE SPACES.
05 PIC X(16) VALUE
"-- ERROR CODES--".
01 DETAIL-LINE.
05 RECORD-CODE-OUT PIC XX.
05 PIC X VALUE SPACE.
05 VEND-NUM-OUT PIC 9(8).
05 PIC XX VALUE SPACES.
05 YEAR-DUE-OUT PIC XX.
05 MONTH-DUE-OUT PIC XX.
05 DAY-DUE-OUT PIC XX.
05 PIC XX VALUE SPACES.
05 VEND-NAME-OUT PIC X(20).
05 PIC XX VALUE SPACES.
05 AMT-DUE-OUT PIC 999,999.99.
05 PIC XX VALUE SPACES.
05 A-ERROR-OUT PIC X.
05 PIC XX VALUE SPACES.
05 B-ERROR-OUT PIC X.
05 PIC XX VALUE SPACES.
05 C-ERROR-OUT PIC X.
05 PIC XX VALUE SPACES.
05 D-ERROR-OUT PIC X.
05 PIC XX VALUE SPACES.
05 E-ERROR-OUT PIC X.
05 PIC XX VALUE SPACES.
05 F-ERROR-OUT PIC X.
05 PIC XX VALUE SPACES.
05 G-ERROR-OUT PIC X.
05 PIC XX VALUE SPACES.
05 H-ERROR-OUT PIC X.
05 PIC XX VALUE SPACES.
05 I-ERROR-OUT PIC X.
01 ASTERISK-LINE.
05 A-AST-OUT PIC XX.
05 PIC X VALUE SPACE.
05 BC-AST-OUT PIC X(8).
05 PIC XX VALUE SPACES.
05 D-AST-OUT PIC XX.
05 PIC X VALUE SPACE.
05 E-AST-OUT PIC XX.
05 PIC X VALUE SPACE.
05 F-AST-OUT PIC XX.
05 PIC XX VALUE SPACES.
05 G-AST-OUT PIC X(15).
05 PIC XX VALUE SPACES.
05 I-AST-OUT PIC X(8).
05 PIC XX VALUE SPACES.
05 H-AST-OUT PIC X(8).
01 RECORD-TOTALS.
05 PIC X(16) VALUE
"VALID RECORDS: ".
05 VALID-RECORDS-OUT PIC 99.
05 PIC XX VALUE SPACES.
05 PIC X(17) VALUE
"INVALID RECORDS: ".
05 INVALID-RECORDS-OUT PIC 99.
PROCEDURE DIVISION.
1000-MAIN-CONTROL.
MOVE WHEN-COMPILED TO W-WHEN-COMPILED
DISPLAY
"TEST PROGRAM COMPILED ON "
W-WHEN-COMPILED
PERFORM 2000-INITIALIZE.
PERFORM UNTIL END-OF-FILE = "YES"
READ DATVAL02
AT END
MOVE "YES" TO END-OF-FILE
NOT AT END
PERFORM 2100-ERROR-ROUTINE
IF ERROR-FLAG = "YES"
PERFORM 2500-PROCESS
PERFORM 3000-PROCESS
END-IF
IF ERROR-FLAG = "NO"
PERFORM 2500-PROCESS
END-IF
END-READ
END-PERFORM.
PERFORM 4000-PROCESS.
PERFORM 4500-TERMINATE.
STOP RUN.
2000-INITIALIZE.
OPEN INPUT DATVAL02.
OPEN OUTPUT REPORT-FILE.
WRITE REPORT-RECORD FROM HEADING-LINE-1.
WRITE REPORT-RECORD FROM HEADING-LINE-2.
2100-ERROR-ROUTINE.
MOVE "NO" TO ERROR-FLAG.
MOVE "NO" TO ERROR-FLAG2.
IF VEND-NUM = SPACES
MOVE "YES" TO ERROR-FLAG
MOVE "********" TO BC-AST-OUT
MOVE "B" TO B-ERROR-OUT
END-IF.
IF ERROR-FLAG = "YES"
ADD 1 TO INVALID-RECORDS
END-IF.
IF ERROR-FLAG = "NO"
ADD 1 TO VALID-RECORDS
END-IF.
2500-PROCESS.
MOVE RECORD-CODE TO RECORD-CODE-OUT.
MOVE VEND-NUM TO VEND-NUM-OUT.
MOVE YEAR-DUE TO YEAR-DUE-OUT.
MOVE MONTH-DUE TO MONTH-DUE-OUT.
MOVE DAY-DUE TO DAY-DUE-OUT.
MOVE VEND-NAME TO VEND-NAME-OUT.
MOVE AMT-DUE TO AMT-DUE-OUT.
WRITE REPORT-RECORD FROM DETAIL-LINE.
3000-PROCESS.
WRITE REPORT-RECORD FROM ASTERISK-LINE.
4000-PROCESS.
MOVE VALID-RECORDS TO VALID-RECORDS-OUT.
MOVE INVALID-RECORDS TO INVALID-RECORDS-OUT.
WRITE REPORT-RECORD FROM RECORD-TOTALS.
4500-TERMINATE.
CLOSE DATVAL02, REPORT-FILE.
I seem to have yet another problem dealing with COBOL. My teacher has assigned us with having to take a file of names and make it into two columns going 54 rows down. I thought this was going to be simple as I looked in the book as it was more or less using a new function to do what I had all ready been doing, but once I got home and put down my code it all went to heck. Th program I made, for some reason unknown to me, only writes one name in the first column of row one and the does the same ever 54 rows. I am obviously on the wrong track but in my mind it looks right. Here is what I got:
WORKING-STORAGE SECTION.
01 ARE-THERE-MORE-RECORDS PIC X(3) VALUE 'YES'.
01 REPORT-START PIC X VALUE 'Y'.
01 LINE-COUNT PIC 99 VALUE ZEROS.
01 PAGE-NUMBER PIC 99 VALUE ZEROS.
01 NAME-COUNT PIC 9(3) VALUE ZEROS.
01 WORK-AREA-1.
05 N-COLUMN-1 PIC 99 VALUE ZEROS.
01 WORK-AREA-2.
05 N-COLUMN-2 PIC 9(3) VALUE 54.
01 NAME-STORAGE.
05 NAME-STO OCCURS 108 TIMES PIC X(30).
01 WS-DATE.
05 RUN-YEAR PIC XX.
05 RUN-MONTH PIC XX.
05 RUN-DAY PIC XX.
01 HEADING-LINE-1.
05 PIC X(32) VALUE SPACES.
05 PIC X(16)
VALUE 'NAME LIST REPORT'.
05 PIC X(6) VALUE SPACES.
05 HL-1-DATE.
10 MONTH-2 PIC XX.
10 PIC X VALUE '/'.
10 DAY-2 PIC XX.
10 PIC X VALUE '/'.
10 YEAR-2 PIC XX.
05 PIC X(4) VALUE SPACES.
05 PAGE-1 PIC X(4) VALUE 'PAGE'.
05 PIC X(1) VALUE SPACES.
05 NUMBER-PAGE PIC Z9.
01 DETAIL-LINE.
05 BLANK-A-OUT PIC X(4) VALUE SPACES.
05 DL-COLUMN-1 PIC X(30).
05 BLANK-E-OUT PIC X(20) VALUE SPACES.
05 DL-COLUMN-2 PIC X(30).
PROCEDURE DIVISION.
100-MAIN.
OPEN INPUT NAMELIST-FILE-IN
OPEN OUTPUT NAMELIST-FILE-OUT
ACCEPT WS-DATE FROM DATE
MOVE RUN-MONTH TO MONTH-2
MOVE RUN-DAY TO DAY-2
MOVE RUN-YEAR TO YEAR-2
PERFORM 200-NEXT-PAGE
PERFORM UNTIL ARE-THERE-MORE-RECORDS = 'NO '
READ NAMELIST-FILE-IN
AT END
MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
NOT AT END
PERFORM 300-STORE-NAME
END-READ
END-PERFORM
CLOSE NAMELIST-FILE-IN
CLOSE NAMELIST-FILE-OUT
STOP RUN.
200-NEXT-PAGE.
ADD 1 TO PAGE-NUMBER
MOVE PAGE-NUMBER TO NUMBER-PAGE
MOVE HEADING-LINE-1 TO NAMELIST-RECORD-OUT
IF REPORT-START = 'N'
WRITE NAMELIST-RECORD-OUT
AFTER ADVANCING PAGE
ELSE
MOVE 'N' TO REPORT-START
WRITE NAMELIST-RECORD-OUT
AFTER ADVANCING 1 LINE
END-IF.
MOVE ZEROS TO LINE-COUNT.
300-STORE-NAME.
ADD 1 TO NAME-COUNT
MOVE NAME-IN TO NAME-STORAGE
IF NAME-COUNT > 54
PERFORM 400-PROCESS-FILE
END-IF.
400-PROCESS-FILE.
IF LINE-COUNT >= 52
PERFORM 200-NEXT-PAGE
END-IF
ADD 1 TO LINE-COUNT
ADD 1 TO N-COLUMN-1
ADD 1 TO N-COLUMN-2
MOVE NAME-STO (N-COLUMN-1) TO DL-COLUMN-1
MOVE NAME-STO (N-COLUMN-2) TO DL-COLUMN-2
MOVE DETAIL-LINE TO NAMELIST-RECORD-OUT
WRITE NAMELIST-RECORD-OUT
AFTER ADVANCING 1 LINE
IF N-COLUMN-2 = 108
MOVE 0 TO NAME-COUNT
MOVE 0 TO N-COLUMN-1
MOVE 54 TO N-COLUMN-2
END-IF.
This is not all I have to do, but until I figure this out I cannot continue.
I'm not familiar with this dialect of COBOL, but i thnk the problem is with:
MOVE NAME-IN TO NAME-STORAGE
I t should look like this:
MOVE NAME-IN TO NAME-STO OF NAME-STORAGE(NAME-COUNT)
Am i right am i wrong or am i just dreaming?