I'm still having the same problem, I cannot make posts with code.
So, I'm going to make this post without code.
First of all, I would like to express my appreciation to everybody who helped me in the previous posts.
In the topic "Problem COBOL - CICS Program gives ABEND AEIP - INVREQ" that was posted in VSAM/SMS, Mr Robert Sample wrote:
The usual way to process maps is to display the map with every field needed, the terminal user keys data into every relevant field, and then when the map is received validate each field sequentially. If the map needs to be resent to fix errors, every error field will be highlighted and can be fixed at one time. Processing the data in the program often takes no more than a few seconds, while the data entry may require several minutes.
He's right, so I've started to change my program to follow these best practices.
My questions are about the MAP processing and validation.
I've studied the essentials of Basic Map Support but now I'see it was the basic.
In the 050-ADD-RECORD, I'm providing the user with the instructions for fulfilling the fields as a series of SEND MAP.
Then I do the SEND MAP with the message field as "PLEASE WRITE IN FIELDS AS INSTRUCTED ABOVE", and after that the RECEIVE MAP.
Then all the map fields are moved to the corresponding variables in the Working Storage and the record is written in the file.
My first question is about the options, until now I'm providing the options as messages in the MESSAGE field of the map.
I've seen some pages in the internet that show printscreens with the CICS program being executed and showing the options directly on the screen, and I believe that is achieved with protected fields, but how do I change the color and aspect of those fields to be diferent from the protected fields ?
In previous COBOL programs I made some validations.
For example in the pseudo-conversational programs I created LEAPYER and LEAPCAL, the program LEAPYER makes the validation of data, and if the data is validated it is passed to the LEAPCAL program.
The Gregorian year must be a positive number and cannot be 0.
The LEAPCAL program calculates if the number of the Gregorian year is a leap year or a common year.
The validation above is a very simple, so the second question is about data validation, in this CARMAP program the date of sale (SALE DATE) is asked as DD-MM-YYYY.
How can I validate that the user inserted DD-MM-YYYY and not DD/MM/YYYY or even worse DD-MM-YY or MM-DD-YYYY ?
Is it possible to define that a field has to be filled with, for example 5 to 10 characters and validate if the user has inserted less (in this example 3) or more (for example 12) ?
If I create a program that asks for a password can I define in my COBOL program the same criteria as I see in some websites and validate it (for example at least 5 characters and it must include at least one Capital letter and a number) ?
What are the good practices in data validation ?
The third question is, assuming that the user leaves a mandatory field blank or the content of that field is incorrect, how do I change the color of the field to show the user the field that needs to be corrected, and how do I show a message in the map to the user, instructing the user to update that field or fields ?
I apologize if it's a lot of questions but they're all related, so, I decided to ask them all in the same topic.
Thank you,
Roger