Loading...
Loading...
In mainframe environments, SDSF (System Display and Search Facility) is a critical tool used to monitor, manage, and analyze job output. Jobs submitted to z/OS produce output logs (called SYSOUT or job logs) that contain return codes, messages, and step-level results. Your task is to simulate a simplified SDSF-style log analyzer.
You are given a list of job log entries. Each entry is a string in the format:
<JOBNAME> <STEP> <RC> <MESSAGE>
JOBNAME — alphanumeric job name (up to 8 chars)STEP — step name within the jobRC — return code (integer, 0 = success, 4 = warning, 8+ = error)MESSAGE — a description string (no spaces)Your goal is to parse the job log entries and return a summary of each unique job, reporting:
"SUCCESS" if max RC == 0, "WARNING" if max RC == 4, "FAILED" if max RC >= 8.Return the results as a list of strings, one per unique job, sorted alphabetically by job name, in the format:
<JOBNAME>: STEPS=<count>, MAXRC=<rc>, STATUS=<status>
logs: A list of strings, each representing one log entry.Input: ["JOBABC STEP1 0 OK", "JOBABC STEP2 4 WARN", "JOBABC STEP3 0 OK"]
Output: ["JOBABC: STEPS=3, MAXRC=4, STATUS=WARNING"]
Explanation: JOBABC has 3 steps. The highest RC is 4, so status is WARNING.
Input: ["JOBX STEP1 0 OK", "JOBY STEP1 8 ERROR", "JOBX STEP2 0 DONE"]
Output: ["JOBX: STEPS=2, MAXRC=0, STATUS=SUCCESS", "JOBY: STEPS=1, MAXRC=8, STATUS=FAILED"]
Explanation: Two distinct jobs. JOBX succeeds; JOBY fails with RC=8.
Input: ["PAYJOB STEP1 12 ABEND", "PAYJOB STEP2 0 OK"]
Output: ["PAYJOB: STEPS=2, MAXRC=12, STATUS=FAILED"]
Explanation: RC=12 is >= 8, so status is FAILED even though one step passed.
1 <= logs.length <= 10^4 Each log entry has exactly 4 space-separated tokens 0 <= RC <= 4095 JOBNAME length: 1 to 8 characters (uppercase alphanumeric) STEP names are unique per job (no duplicate steps per job) No empty log list guaranteed for core cases; handle edge with single entry