Skip to main content

Find copybook usage

org.openrewrite.cobol.search.FindCopybook

Find all copy statements with the copybook name.

Recipe source

GitHub: FindCopybook.java, Issue Tracker, Maven Central

This recipe is available under the Moderne Source Available License.

Options

TypeNameDescriptionExample
StringcopybookNameOptional. The copybook name to search for. If not provided, all copy statements will be returned.KP008
BooleanonlyMissingCopybooksOptional. Only find copy statements and exec sql include statements that are missing copybooks.True

Example

Parameters
ParameterValue
copybookNameINCEPTION
onlyMissingCopybooksfalse
Before
000000 IDENTIFICATION DIVISION.                                         *
PROGRAM-ID. IC109A. *
DATA DIVISION. *
LINKAGE SECTION. *
01 GRP-01. *
COPY INCEPTION. *
After
000000 IDENTIFICATION DIVISION.                                         *
PROGRAM-ID. IC109A. *
DATA DIVISION. *
LINKAGE SECTION. *
01 GRP-01. *
COPY ~~>INCEPTION. *

Usage

This recipe has no required configuration options. It can be activated by adding a dependency on org.openrewrite:rewrite-cobol in your build file or by running a shell command (in which case no build changes are needed):

  1. Add the following to your build.gradle file:
build.gradle
plugins {
id("org.openrewrite.rewrite") version("latest.release")
}

rewrite {
activeRecipe("org.openrewrite.cobol.search.FindCopybook")
setExportDatatables(true)
}

repositories {
mavenCentral()
}

dependencies {
rewrite("org.openrewrite:rewrite-cobol:2.15.0")
}
  1. Run gradle rewriteRun to run the recipe.

See how this recipe works across multiple open-source repositories

Run this recipe on OSS repos at scale with the Moderne SaaS.

The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories.

Please contact Moderne for more information about safely running the recipes on your own codebase in a private SaaS.

Data Tables

Copybook source information

org.openrewrite.cobol.table.CopybookSource

Information about copybook references in a COBOL source.

Column NameDescription
Source pathThe source path of the file that contains the copy statement.
Copybook nameThe copybook name from a copy statement in a COBOL source.
Copybook source pathThe source path of the copybook that was resolved during resolution of copybooks.
Resolution statusThe status of the resolved copybook in a copy statement.
Marked wordThe current word being visited from the post-processed LST.