DEV Community
Follow
Preparing COBOL Error Data for Machine Learning in SageMaker
COBOL jobs that fail generate valuable data in the form of structured error logs, which can be used for supervised learning to predict future job failures. The error logs are stored in S3 as JSON files, but machine learning requires a tabular dataset, so the logs need to be preprocessed. A service cronjob is built to scan the error logs, extract a subset of fields, add a label, and write the data to a CSV file. The CSV file is then uploaded to an ML-specific S3 bucket for SageMaker to consume. The preprocessing service uses Python scripts to parse the error logs, extract relevant fields, and add labels. The resulting CSV file is flat, clean, and ready to be merged with non-error data. The CSV file is used to train a binary classification model using XGBoost to predict error likelihood based on patterns in the input file, job metadata, or record structure. The model provides a proactive signal, allowing for files to be flagged, routed to a validation lane, or skipped entirely if they are predicted to fail. The entire process starts with structured, automated preprocessing of the error logs. By using COBOL failures as machine learning fuel, the system can optimize and improve over time.