Create & Push Module
Prerequisites
- The OpenLegacy CLI is installed, and you are logged in to the OL Hub. See Log in to OL CLI.
- A
../resourcesfolder (relative to the new module folder) that contains the COBOL source and copybook files the script adds: RACTCS9.cbl, LACTCS9I.cpy, LACTCS9O.cpy, OACTCS9.cbl, GACTCS9I.cpy, GACTCS9O.cpy, UACTCS9.cbl, DACTCS9I.cpy and DACTCS9O.cpy.
Script
#!/bin/bash
echo "Creating a module"
ol create module account-cics --connector mf-cics-cobol
cd ./account-cics
# Test Connection (mainframe.openlegacy.com is an OpenLegacy demo host; use HTTPS for your own hosts)
ol test connection --base-url http://mainframe.openlegacy.com --uri-map /ol/demos
echo $PWD
# add all assets
ol add --source-path ../resources/RACTCS9.cbl --verbose #reset
ol add -i ../resources/LACTCS9I.cpy -o ../resources/LACTCS9O.cpy --program-path LACTCS9 #list
ol add --source-path ../resources/OACTCS9.cbl # creat
ol add -i ../resources/GACTCS9I.cpy -o ../resources/GACTCS9O.cpy --program-path GACTCS9 # get
ol add --source-path ../resources/UACTCS9.cbl #update
ol add -i ../resources/DACTCS9I.cpy -o ../resources/DACTCS9O.cpy --program-path DACTCS9
# Push Module To The HUB
ol push module
What the script does
Create the module
Lines 3-4 create the account-cics module with the mf-cics-cobol connector and switch to the module folder.
Test the connection
Line 7 runs ol test connection to check that the module can reach the mainframe.
Add the assets
Lines 10-16 add the account assets from the COBOL source files and copybooks.
Push the module
Lines 18-19 push the module to the OL Hub.
Confirm the push
Run ol list modules and check that account-cics appears in the list.
Pushing the module again
- After you rebuild an asset and run ol push module again, the pushed asset becomes a new version of the module's asset with the same name and type, even when it has a new id. A re-push can also replace a stored SQL query and set or clear the single-row options.
- A push whose asset ids belong to another module is rejected before anything is written, and the error names the pushed assets. Nothing is left half-created.