MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / handleExec

Function handleExec

src/extraction/languages/cobol.ts:144–169  ·  view source on GitHub ↗

* EXEC ... END-EXEC blocks are opaque single nodes. Mine the text for the * statically-resolvable shapes: CICS LINK/XCTL to a program (cross-program * call), CICS RETURN/START TRANSID (the pseudo-conversational hop — emitted * as a `cics-transid:XXXX` reference the CICS framework resolver maps to

(
  node: SyntaxNode,
  ctx: ExtractorContext,
  fromNodeId: string | undefined
)

Source from the content-addressed store, hash-verified

142 * the owning program), and SQL INCLUDE (a copybook import).
143 */
144function handleExec(
145 node: SyntaxNode,
146 ctx: ExtractorContext,
147 fromNodeId: string | undefined
148): void {
149 const text = getNodeText(node, ctx.source);
150 const cics = EXEC_CICS_PROGRAM_RE.exec(text);
151 if (cics) {
152 const program = cics[1] ?? (cics[2] ? derefSameFileValue(cics[2], ctx) : undefined);
153 if (program) addRef(ctx, fromNodeId, program, 'calls', node);
154 }
155 const transid = EXEC_CICS_TRANSID_RE.exec(text);
156 if (transid) {
157 const tx = transid[1] ?? (transid[2] ? derefSameFileValue(transid[2], ctx) : undefined);
158 if (tx && /^[A-Za-z0-9$#@]{1,4}$/.test(tx)) {
159 addRef(ctx, fromNodeId, `cics-transid:${tx.toUpperCase()}`, 'calls', node);
160 }
161 }
162 const include = EXEC_SQL_INCLUDE_RE.exec(text);
163 if (include?.[1]) {
164 ctx.createNode('import', include[1], node, {
165 signature: collapse(text),
166 });
167 addRef(ctx, fromNodeId ?? currentScope(ctx), include[1], 'imports', node);
168 }
169}
170
171/**
172 * Walk a run of DATA DIVISION entries (working-storage section children or a

Callers 3

walkDataEntriesFunction · 0.85
collectRefsFunction · 0.85
cobol.tsFile · 0.85

Calls 7

getNodeTextFunction · 0.90
derefSameFileValueFunction · 0.85
addRefFunction · 0.85
collapseFunction · 0.85
currentScopeFunction · 0.85
execMethod · 0.65
createNodeMethod · 0.65

Tested by

no test coverage detected