Skip to content

Instantly share code, notes, and snippets.

@sandeep-sparrow
Created August 21, 2020 14:34
Show Gist options
  • Save sandeep-sparrow/7bc9915cc7bf42db6cc397e2740c6080 to your computer and use it in GitHub Desktop.
Save sandeep-sparrow/7bc9915cc7bf42db6cc397e2740c6080 to your computer and use it in GitHub Desktop.
A simple COBOL-CICS which sends and receives data from the CICS region
******************************************************************
      * AUTHOR:  SANDEEP                                               *
      * PROGRAM: HELLO                                                 *
      * DESCRIPTION: THIS MODULE IS RECEIVE AND SENDS DATA TO CICS     *
      *              REGION                                            *
      * DATE: 05-08-2020                                               *
      ******************************************************************
       IDENTIFICATION DIVISION.
       PROGRAM-ID. HELLO.
      *
       DATA DIVISION.
      *
       WORKING-STORAGE SECTION.
       01 WS-INPUT.
          05 WS-TRAN-ID      PIC X(4).
          05 WS-MESSAGE-I    PIC X(70).
      *
       01 WS-OUTPUT.
          05 WS-TEXT         PIC X(8).
          05 WS-MESSAGE-O    PIC X(70).
      *
       01 WS-MSG-LENGTH      PIC S9(4) COMP.
      *
       PROCEDURE DIVISION.
       A00-MAIN-PARA.
      *
            INITIALIZE WS-INPUT
                       WS-OUTPUT
      *
            MOVE 74  TO WS-MSG-LENGTH
      *
            EXEC CICS
                 RECEIVE INTO(WS-INPUT)
                 LENGTH(WS-MSG-LENGTH)
            END-EXEC
      *
            MOVE WS-MESSAGE-I    TO WS-MESSAGE-O
            MOVE 'OUTPUT:'       TO WS-TEXT
            MOVE 78              TO WS-MSG-LENGTH
      *
            EXEC CICS
                 SEND FROM(WS-OUTPUT)
                 LENGTH(WS-MSG-LENGTH)
            END-EXEC
      *
EXEC CICS RETURN END-EXEC.
*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment