Skip to content

Sample repository for using JZOS with VS Code and Gradle

License

Notifications You must be signed in to change notification settings

phaumer/jzos-vscode-gradle

Repository files navigation

JZOS with Gradle Example

Example showing how to develop Java applications for z/OS with Gradle and the JZOS library using VS Code.

Preparing your z/OS system

  • Get access to a z/OS system with Java 11 or 17 installed. Make sure this Java is configured for your PATH and JAVA_HOME. We recommend IBM Wazi as a Service systems.
  • Configure access to ssh; ideally password-less ssh
  • Make sure you can use either z/OSMF or RSE API on your system so it can be used with Zowe CLI and Zowe Explorer.
  • Open ports on your z/OS system or VPC subnet when using Wazi as a Service, so you can use RSE API or z/OSMF, ssh, as well as port 8000 for the debugger.

Setting up VS Code

Building the samples

Use the Gradle tools provided by the VS Code extensions you installed or manually build the application with

gradle build

Check the jzos-samples/build.gradle file for what is currently being build. The result will be a see a jzos-samples/build/libs/jzos-samples-1.0-SNAPSHOT.jar jar file that uses the PdsLister as the main class. If you want to work with different JZOS examples modify the entries here.

Running the example

You can use Zowe Explorer to manually copy the jar file and run it on z/OS via ssh, for example

java -jar jzos-samples-1.0-SNAPSHOT.jar "//SAMPLE.COBOL"

There is also sample script (./scripts/run-zos.sh) and VS Code task that can do these steps all for you. Assuming you can run bash-based scripts, have all the recommended extensions installed and Zowe CLI/Explorer configured you can just run the the task "Run Java program on z/OS", which will prompt you for the jar file to use in the Maven targets folder and the input parameter for the program. Then it will use Zowe CLI to upload the jar file to Unix System Services and run the program with the parameter. Depending if you are using Zowe with RSE or z/OSMF you need to adjust the script to use the right settings. See the comments in the script.

Running a debug session for the example

To run a debug session for your program you can use the same script, but start it via the task "Debug Java program on z/OS", which will start it in Debug mode. Set a breakpoint in the source code, e.g. in line 33 in ./jzos-samples/src/main/java/com/ibm/jzos/sample/PdsLister. Edit the debug launch called "Debug (Attach to z/OS)" in ./.vscode/launch.json to provide your z/OS system's IP address. Then run the launch to connect to you waiting debug session.

About

Sample repository for using JZOS with VS Code and Gradle

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published