Running the program control examples

You can run the channel and COMMAREA examples to understand how CICS processes channels and containers or COMMAREAs. Programs can use either method to pass data, but containers are not limited to 32 KB.

Before you begin

Ensure the CICS region is configured, as described in Running the JCICS examples.

About this task

The examples demonstrate how to use the JCICS Program class to pass a channel and container or COMMAREA to another program. The COMMAREA example also shows you how to convert ASCII characters in the Java code to and from the equivalent EBCDIC used by the native CICS program.

The programs are started by sample CICS transactions. The examples use the following Java classes and CICS programs:

Example Transaction Program Java class
Channel JPC3 DFJ$JPC3 ProgramControl.ClassThree
Channel JPC3 DFJ$JPC4 ProgramControl.ClassFour
Channel JPC3 DFH$LCCC (C language) N/A
COMMAREA JPC1 DFJ$JPC1 ProgramControl.ClassOne
COMMAREA JPC1 DFJ$JPC2 ProgramControl.ClassTwo
COMMAREA JPC1 DFH$LCCA (C language) N/A

DFH$LCCA and DFH$LCCC are standard CICS programs that can be written in any of the supported high-level languages. If you do not have a C compiler, you can write COBOL versions of DFH$LCCA and DFH$LCCC and use them in place of the supplied C versions.

Procedure

  • To run the channel example:
    1. Enter the JPC3 transaction in a terminal.
      You receive the following messages on Task.out (usually your terminal):
      Entering ProgramControlClassThree.main() 
      About to link to C program 
      Leaving ProgramControlClassThree.main()
    2. Clear the screen.
      The following messages are displayed:
      Entering ProgramControlClassFour.main()
      ProgramControlClassFour invoked with Container "IntData         " 
      ProgramControlClassFour invoked with Container "StringData      " 
      ProgramControlClassFour invoked with Container "Response        " 
      Leaving ProgramControlClassFour.main()
      The messages that list the containers might appear in a different order.
    The following processing is taking place in CICS:
    1. The transaction runs the main Java class that is defined in the PROGRAM resource DFJ$JPC3. The Java program constructs a Channel object with two containers, and links to the C program, DFH$LCCC.
    2. DFH$LCCC processes the containers, creates a new response container, and returns.
    3. The Java program checks the data in the response container and schedules a pseudoconversational transaction to be started, passing the Channel object to the started transaction.
    4. The started transaction runs another Java class that is defined in the PROGRAM resource DFJ$JPC4. This Java program browses the Channel using a ContainerIterator object and displays the name of each container it finds.
  • To run the COMMAREA example:
    1. Enter the JPC1 CICS transaction to run the example.
      You receive the following messages on Task.out (usually your terminal):
          Entering ProgramControlClassOne.main()
          About to link to C program
          Leaving ProgramControlClassOne.main()
    2. Clear the screen.
      The following messages are displayed:
      Entering ProgramControlClassTwo.main()
      data received correctly
      Leaving ProgramControlClassTwo.main()

    The following processing is taking place in CICS:

    1. The transaction runs the main Java class that is defined in the PROGRAM resource DFJ$JPC1. The Java program constructs a COMMAREA and links to the C program, DFH$LCCA.
    2. The C program processes the COMMAREA, updates it, and returns to the Java program.
    3. The Java program checks the data in the COMMAREA and schedules a pseudoconversational transaction to be started, passing the started transaction the changed data in its COMMAREA.
    4. The started transaction runs another main Java class that is defined in the PROGRAM resource DFJ$JPC2. This Java program reads the COMMAREA and validates it again.