I am in my second quarter of the college and take "Advanced COBOL", we only got a task that requires us to code in some validation procedures for different data. Everything has been done for me, except for a small verification procedure.
There is a PART-NUMBER field, the length of which is 8 bytes. The first 5 columns must be a number. The 6th column should be uppercase, and the last 2 columns should be in the range 01-68 or 78-99. The only problem I am facing is figuring out how to confirm that the 6th column is capital.
Here is the code I'm using: From the working repository:
01 DETAIL-LINE. 05 PART-NUMBER. 10 PART-FIRST-FIVE-DL PIC X(5). 10 PART-LETTER-DL PIC X. 88 CAPITAL-LETTER VALUE 'A' THRU 'Z'. 10 PART-LAST-TWO-DL PIC XX.
From 300-VALIDATE-PART-NUMBER
EVALUATE PART-LETTER-DL ALPHABETIC WHEN TRUE EVALUATE CAPITAL-LETTER WHEN FALSE MOVE 'YES' TO RECORD-ERROR-SWITCH MOVE 'PART NUMBER' TO FIELD-NAME MOVE PART-NO-IN TO FIELD-VALUE MOVE 'YES' TO PART-NO-ERROR END-EVALUATE WHEN FALSE MOVE 'YES' TO RECORD-ERROR-SWITCH MOVE 'PART NUMBER' TO FIELD-NAME MOVE PART-NO-IN TO FIELD-VALUE MOVE 'YES' TO PART-NO-ERROR END-EVALUATE
I know that I'm probably not doing this in a very efficient way, but for now I just need to get it to work. I read the entire chapter on data validation from the book, and this is a kind of last-minute error (the program should appear tomorrow), so the teacher is not available. I would really appreciate any help I can handle this. I really lost the way I should check capital letters. The method I'm using now reports an error if there is nothing in the 6th column of the part number except A or Z.
source share