Code Monkey home page Code Monkey logo

hello-cics's Introduction

hello-cics

Experimental project to try out modern development techniques with CICS

The journey so far...

Dev Container

Attempting to create a dev container suitable for the IBM Z Open Editor

Create a global Zowe CLI team configuration, either using the Zowe Explorer or with the following zowe command.

zowe config init --global-config

Edit the config file as required, either using the Zowe Explorer, or with the zowe CLI. For example, to accept self-signed certificates.

zowe config set "profiles.base.properties.rejectUnauthorized" "false" --global-config

CICS Program

Attempting to create a very basic CICS program using the @CICSProgram annotation!

Created a new gradle project using gradle init --type basic (no way to bootstrap a CICS project?)

See:

Configuring CICS to provide a dev environment (TBC)

Some CICS stuff... here be dragons...

TODO: script somehow- using DFHCSDUP? E.g. CSDUPDAT.jclsamp

Need a JVM server

CEDA COPY GROUP(DFH£WLP) JVMSERVER(DFHWLP) TO(WLPGROUP) AS(WLPFTW)
CEDA INSTALL GROUP(WLPGROUP)
CEMT INQUIRE JVMSERVER(WLPFTW)

TODO need JVM profile, and <work_dir>/WLPFTW/wlp/usr/servers/defaultServer/server.xml needs to include the cicsts:link-1.0 feature, e.g.

	<featureManager>
        <feature>cicsts:core-1.0</feature>
        <feature>cicsts:defaultApp-1.0</feature>
        <feature>transportSecurity-1.0</feature>
        <feature>cicsts:link-1.0</feature>
    </featureManager>

Create a bundle

CEDA DEFINE BUNDLE
Bundle       ==> HELLOB
Group        ==> BGROUP
...
BUndledir    ==> <bundle_deploy_root>/<bundle_id>_<bundle_version>

where,

  • <bundle_deploy_root> was specified by -Dcom.ibm.cics.jvmserver.cmci.bundles.dir in EYUSMSSJ.jvmprofile, and
  • <bundle_id> is the gradle rootProject.name

e.g. /u/cicsdev/cmciBundles/hello-cics_1.0.0

CEDA INSTALL GROUP(BGROUP)
CEMT INQUIRE BUNDLE(HELLOB)

Installing the bundle should cause a program matching the @CICSProgram annotation to get created automatically due to the cicsts:link-1.0 feature, which you can check with

CEMT INQUIRE PROGRAM(HELLODFH)

TODO: would it be better just to include a program in the bundle to avoid having to add the cicsts:link-1.0 feature?

The bundle also includes an LO1 transaction which uses the program, which you can check with

CEMT INQUIRE TRANSACTION(LO1)

TODO use the same group for the bundle and transaction definitions, e.g. HELLOGRP?

Run the transaction!!!

LO1

Deploying the CICS bundle (TBC)

Note: a CICS bundle is not the same thing as an OSGi bundle!

Gradle build, ftp CICS bundle to USS, and unzip to a suitable bundle directory using jar -xvf <bundle>.zip

For example, using zowe

./gradlew build
zowe ssh issue cmd "rm -Rf ~/cicsBundle && mkdir -p ~/cicsBundle"
zowe zftp upload ftu ./build/distributions/hello-cics-1.0.0.zip "<bundle_dir>/hello-cics-1.0.0.zip" --binary
zowe ssh issue cmd "cd ~/cicsBundle && jar -xvf hello-cics-1.0.0.zip && rm hello-cics-1.0.0.zip"

Alternatively, use ./gradlew deployCICSBundle

This requires CMCI to be working and the 'managedcicsbundles' endpoint to be enabled with the -Dcom.ibm.cics.jvmserver.cmci.bundles.dir parameter. See Configuring the CMCI JVM server for the CICS bundle deployment API

Scripting with Zowe seems quite nice since credentials are stored securely, and the bundle deployement API still requires the bundle to have been defined up front anyway. The bundle deployment API does "just work" when it works though.

Using resource builder and DFHCSDUP to configure CICS

Generate the resource definitions schema

zrb generate -m src/main/resources/sample.cicsresourcemodel.yaml -o src/main/resources/sample.cicsresourcedefinitions.schema.json

Build the DFHCSDUP commands file

zrb build --model src/main/resources/sample.cicsresourcemodel.yaml --resources src/main/resources/sample.cicsresourcedefinitions.yaml --output src/main/resources/DFHCSD.txt

TODO:

  • there's probably a better place to generate the schema and DFHCSD.txt files
  • use yq to fix the bundledir

The resulting commands file can be used when invoking DFHCSDUP as a batch program. See: https://www.ibm.com/docs/en/cics-ts/6.1?topic=dfhcsdup-sample-job-invoking-as-batch-program

First upload the DFHCSDUP commands file to a suitable data set. For example, to create a new partitioned data set and upload the DFHCSD.txt file using Zowe...

zowe zos-files create data-set-partitioned NEW.DFHCSD.DATASET
zowe zos-files upload file-to-data-set "DFHCSD.txt" "NEW.DFHCSD.DATASET(SAMPLE)"

Then refer to your data set in the DFHCSDUP JCL, e.g.

//CSDUP   JOB  ...
//CSDUP   EXEC PGM=DFHCSDUP,REGION=0M,
//             PARM='CSD(READWRITE),PAGESIZE(60),NOCOMPAT'
//STEPLIB  DD DISP=SHR,DSN=xxx.SDFHLOAD
//DFHCSD   DD DISP=SHR,DSN=xxx.DFHCSD
//SYSPRINT DD SYSOUT=*
//SYSIN    DD DISP=SHR,DSN=NEW.DFHCSD.DATASET(SAMPLE)

Using CMCI and a REST client to configure CICS!

The REST Client for VS Code works quite well (see the cmci.http file for example), or just use cURL...

curl --request POST \
  --url http://cmci.example.org:1490/CICSSystemManagement/CICSDefinitionBundle/<cics_region> \
  --header 'authorization: Basic <encoded_username_password>' \
  --header 'content-type: application/xml' \
  --data '<request><create><parameter name="CSD"/><attributes name="HELLO" bundledir="/u/ibmuser/cmciBundles/hello-cics_1.0.0" csdgroup="SAMPLE"/></create></request>'

hello-cics's People

Contributors

jt-nti avatar

Stargazers

 avatar

Watchers

 avatar

hello-cics's Issues

Zowe explorer for CICS secure credentials issue

Currently seeing an error from the zowe explorer for CICS extension in vscode when clicking the + icon…

{"stack":"ProfInfoErr: Failed to initialize secure credential manager at ProfileInfo.<anonymous> (/home/vscode/.vscode-server/extensions/zowe.cics-extension-for-zowe-2.3.0/node_modules/@zowe/cli/node_modules/@zowe/imperative/lib/config/src/ProfileInfo.js:829:23) at Generator.throw (<anonymous>) at rejected (/home/vscode/.vscode-server/extensions/zowe.cics-extension-for-zowe-2.3.0/node_modules/@zowe/cli/node_modules/@zowe/imperative/lib/config/src/ProfileInfo.js:16:65)","mDetails":{},"mMessage":"Failed to initialize secure credential manager","mItemsInError":[],"name":"ProfInfoErr"}

Secure credentials are working ok for data sets, uss and jobs. The zowe cli is also happy so the team configuration file is presumably ok, e.g.

$ zowe cics get resource CICSTask --rfj | jq .data.response.records.cicstask.runstatus
"RUNNING"

Tried rolling back to v2.6.1 of the zowe explorer extension but saw the same problem.

See zowe/vscode-extension-for-cics#324

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.