Skip to end of metadata
Go to start of metadata

Introduction

Using HB.js, it is possible to create packages that can only be run internally (meaning that they cannot be executed directly using a HTTP request, but can be only be executed from within a service).   This is to allow for reusability of code and to provide additional security against unauthorized use of that code.

Naming Conventions

In order to mark a package as internal use only, you merely need to name the package starting with an underscore or an @ sign:

_this_is_a_package

@this_is_also_a_package

but_this_is_not

-and_one_starting_with_a_hyphen_is_not_either

However, there is no restriction (other than the naming convention above) to what a package is composed of.  Any HB.js construct (JavaScript code, objects, functions) can be used when creating a package.

Standalone Testing of a Package

You can test a package by doing the following:

  • In your CICS region, create a transaction with the name of your choice that references the PROGRAM(HBR$JSE).
  • In your service repository (ex. hbscript), create a service called _tranid_NAME,  where NAME is the transaction defined in the prior step.  This service can either do nothing except invoke a package, or can be a script that does any number of things.
  • You can then execute the _tranid_NAME service by running the defined tranid from a terminal.  If you are using this service to invoke a package and the test succeeds,  then you should be able to invoke the package from any service successfully.




  • No labels
Write a comment…