PAUDBLOD
Source: app-authorization-ims-db2-mq/cbl/PAUDBLOD.CBL
Type: Batch program
Purpose
PAUDBLOD is a batch data-load utility that reloads a Pending Authorization IMS database from two sequential extract files. It reads "root" segment records (pending authorization summary) and "child" segment records (pending authorization details) and re-inserts them into the IMS database via CBLTDLI calls, effectively rebuilding the hierarchical database from flat-file input. This is typically used in reload/restore or migration scenarios where a previously unloaded database is being restored.
How it works
Processing is driven by MAIN-PARA, which runs sequentially through four stages:
-
1000-INITIALIZE — Captures the current date/day (for display/logging only) and opens both input files, INFILE1 and INFILE2. If either file fails to open (status not spaces/'00'), it displays an error and calls 9999-ABEND, which sets RETURN-CODE to 16 and terminates the program (GOBACK).
-
2000-READ-ROOT-SEG-FILE (looped until end-of-file) — Reads one record from INFILE1, moves it into the PENDING-AUTH-SUMMARY structure, and calls 2100-INSERT-ROOT-SEG, which issues an IMS ISRT (insert) call via CBLTDLI using ROOT-UNQUAL-SSA to insert the root segment (PAUTSUM0). Success, duplicate ('II'), or failure status is checked; any other non-space/non-'II' status triggers 9999-ABEND.
-
3000-READ-CHILD-SEG-FILE (looped until end-of-file) — Reads one record from INFILE2 (containing a ROOT-SEG-KEY and a child detail record). If ROOT-SEG-KEY is numeric, it moves the key into the SSA qualifier and the detail record into PENDING-AUTH-DETAILS, then calls 3100-INSERT-CHILD-SEG. This paragraph first does an IMS GU (get-unique) call qualified on ACCNTID to locate/verify the matching root segment. On success it calls 3200-INSERT-IMS-CALL, which performs the actual ISRT of the child segment (PAUTDTL1) under that root. Any unexpected PCB status from either the GU or ISRT call causes 9999-ABEND.
-
4000-FILE-CLOSE — Closes both files, displaying errors (but not abending) if close status is bad.
After all four stages complete, MAIN-PARA issues GOBACK to end normally.
Inputs & outputs
No SQL tables or CICS commands are used by this program (confirmed by parser: empty sql_tables and cics_commands lists).
Things to know
-
Hard-coded abend code: 9999-ABEND always sets RETURN-CODE to 16 regardless of the actual error, so downstream JCL/step conditions can't distinguish which failure occurred from the return code alone — the actual cause is only visible in the DISPLAY messages in the job log.
-
Inconsistent error handling severity: Open/insert/GU failures cause an abend, but close failures (4000-FILE-CLOSE) only produce a DISPLAY message and processing continues — files may be left in an inconsistent state without a nonzero return code from this specific failure.
-
Silent skip on non-numeric key: In 3000-READ-CHILD-SEG-FILE, if ROOT-SEG-KEY is not numeric, the record is silently skipped (no insert, no error message) — this could mask malformed input.
-
Duplicate segments tolerated: Both root insert (2100-INSERT-ROOT-SEG) and child insert (3200-INSERT-IMS-CALL) treat IMS status 'II' (duplicate segment) as acceptable, not an error — meaning reloads can be run against a partially-loaded database without failing, but this could also mask unexpected duplicate data.
-
Dead/vestigial code: Several WS-VARIABLES fields (e.g., WS-EXPIRY-DAYS, WS-DAY-DIFF, WS-NO-CHKP, checkpoint ID fields WK-CHKPT-ID) and the PRM-INFO structure are declared but never referenced in the procedure logic shown — likely leftover from a related program or an unused checkpoint/restart feature that was never implemented here.
-
Extensive commented-out code: Many DISPLAY statements and some logic (e.g., PSB name/PCB offset comments, date adjustment lines under 3100-INSERT-CHILD-SEG) are commented out, suggesting this program was adapted/copied from another (possibly the "IMSUNLOD" program, per WS-PGMNAME default value) and not fully cleaned up.
-
No checkpoint/restart logic, despite variable names suggesting it was planned (WK-CHKPT-ID, P-CHKP-FREQ, P-CHKP-DIS-FREQ in PRM-INFO) — if this program processes large volumes, a mid-run failure requires a full rerun from the beginning of both files.
-
CALL parameters FAIL, THRU, TO appearing in the parser's calls list are almost certainly false positives from COBOL keywords (e.g., PERFORM ... THRU, MOVE ... TO) rather than actual program calls — the only real external call is CBLTDLI (the standard IMS DL/I call interface).
-
Copybooks used: CIPAUSMY (root segment layout), CIPAUDTY (child segment layout), IMSFUNCS (IMS function code constants like FUNC-ISRT, FUNC-GU), and PAUTBPCB (PCB mask layout) — the actual segment/field structures are defined in these copybooks and not visible in this source file.
Files
| Logical file | DD name |
|---|---|
| INFILE1 | INFILE1 |
| INFILE2 | INFILE2 |
Copybooks
CIPAUDTY, CIPAUSMY, IMSFUNCS, PAUTBPCB
Calls
CBLTDLI, FAIL, THRU, TO
Paragraph flow
flowchart TD
MAIN_PARA["MAIN-PARA"]
1000_INITIALIZE["1000-INITIALIZE"]
1000_EXIT["1000-EXIT"]
2000_READ_ROOT_SEG_FILE["2000-READ-ROOT-SEG-FILE"]
2000_EXIT["2000-EXIT"]
2100_INSERT_ROOT_SEG["2100-INSERT-ROOT-SEG"]
2100_EXIT["2100-EXIT"]
3000_READ_CHILD_SEG_FILE["3000-READ-CHILD-SEG-FILE"]
3000_EXIT["3000-EXIT"]
3100_INSERT_CHILD_SEG["3100-INSERT-CHILD-SEG"]
3100_EXIT["3100-EXIT"]
3200_INSERT_IMS_CALL["3200-INSERT-IMS-CALL"]
3200_EXIT["3200-EXIT"]
4000_FILE_CLOSE["4000-FILE-CLOSE"]
4000_EXIT["4000-EXIT"]
9999_ABEND["9999-ABEND"]
9999_EXIT["9999-EXIT"]
1000_INITIALIZE --> 9999_ABEND
2000_READ_ROOT_SEG_FILE --> 2100_INSERT_ROOT_SEG
2100_INSERT_ROOT_SEG --> 9999_ABEND
3000_READ_CHILD_SEG_FILE --> 3100_INSERT_CHILD_SEG
3100_INSERT_CHILD_SEG --> 3200_INSERT_IMS_CALL
3100_INSERT_CHILD_SEG --> 9999_ABEND
3200_INSERT_IMS_CALL --> 9999_ABEND
MAIN_PARA --> 1000_INITIALIZE
MAIN_PARA --> 2000_READ_ROOT_SEG_FILE
MAIN_PARA --> 3000_READ_CHILD_SEG_FILE
MAIN_PARA --> 4000_FILE_CLOSE
Paragraphs
| Paragraph | Line | Performs |
|---|---|---|
| MAIN-PARA | 169 | 1000-INITIALIZE, 2000-READ-ROOT-SEG-FILE, 3000-READ-CHILD-SEG-FILE, 4000-FILE-CLOSE |
| 1000-INITIALIZE | 190 | 9999-ABEND, 9999-ABEND |
| 1000-EXIT | 218 | |
| 2000-READ-ROOT-SEG-FILE | 222 | 2100-INSERT-ROOT-SEG |
| 2000-EXIT | 239 | |
| 2100-INSERT-ROOT-SEG | 242 | 9999-ABEND |
| 2100-EXIT | 264 | |
| 3000-READ-CHILD-SEG-FILE | 269 | 3100-INSERT-CHILD-SEG |
| 3000-EXIT | 290 | |
| 3100-INSERT-CHILD-SEG | 292 | 3200-INSERT-IMS-CALL, 9999-ABEND |
| 3100-EXIT | 315 | |
| 3200-INSERT-IMS-CALL | 318 | 9999-ABEND |
| 3200-EXIT | 338 | |
| 4000-FILE-CLOSE | 341 | |
| 4000-EXIT | 357 | |
| 9999-ABEND | 360 | |
| 9999-EXIT | 368 |