VTAM application network definition example

The following example shows a complete network definition for four VTAM® applications that use all of the session setups and session types available to communicate with each other. This network demonstrates the ability of VTAM applications to communicate with each other as if they were communicating with a logical unit associated with an SNA terminal.

The four VTAM applications in this example are known to VTAM by the resource names APPL1, APPL2, APPL3, and APPL4. These resource names must be used for session initiation. The four VTAM applications are known to WSim as BIG_APPL, VA_APPL2, VA_APPL3, and VA_APPL4. You do not have to use WSim names that are different from those that VTAM knows; you can name the applications APPL1, APPL2, APPL3, and APPL4 for WSim VTAMAPPL definitions as well.

VTAM application BIG_APPL assumes the role of a simple 3270 application program that can communicate with real 3270 LU Type 2 terminals. BIG_APPL also has one secondary LU half-session that simulates a 3270 LU Type 2 to another VTAM application (VA_APPL4).

VTAM applications VA_APPL2 and VA_APPL3 communicate with BIG_APPL and simulate a single 3270 secondary LU Type 2 half-session. This type of VTAM application definition is required to communicate with most VTAM application programs. Like most SNA terminals, these VTAM applications support only one session. Normally, you need to define single-session VTAM applications to communicate with CICS/VS or IMS/VS applications.

VTAM application VA_APPL4 is somewhat like BIG_APPL in reverse. VA_APPL4 simulates two 3270 secondary LU Type 2 half-sessions and communicates with BIG_APPL. VA_APPL4 also looks like a simple 3270 application program to the secondary half-session simulated by BIG_APPL.

Message generation deck SLU_DECK generates standard 3270 LU Type 2 data streams. Message generation deck PLU_DECK processes the 3270 data streams received and generates a response message with the appropriate 3270 command and write control character (WCC) bytes based on the AID received. Refer to Introducing message generation decks for information about the message generation statements included in these message generation decks.
VTAM_EX1 NTWRK    MSGTRACE=YES,UTI=100,STLTRACE=YES

PLU_PATH PATH     PLU_DECK           primary message deck
SLU_PATH PATH     SLU_DECK           secondary message deck

*      VTAM Application                           VTAM Application
*    and LU Half-sessions                       and LU Half-sessions
* --------------------------                 --------------------------
* BIG_APPL PLUHS_AB_1 LU (pri)  <-session->  VA_APPL2 SLU_HS_A_1 LU (sec)
* BIG_APPL PLUHS_AB_2 LU (pri)  <-session->  VA_APPL3 SLU_HS_B_1 LU (sec)
* BIG_APPL PHUHS_CD_1 LU (pri)  <-session->  VA_APPL4 SLU_HS_C_1 LU (sec)
* BIG_APPL PLUHS_CD_2 LU (pri)  <-session->  VA_APPL4 SLU_HS_D_1 LU (sec)
* BIG_APPL SLUHS_E_1  LU (sec)  <-session->  VA_APPL4 PLUHS_E_1  LU (pri)
*
*     primary sends BIND, secondary receives BIND
*     Parallel sessions exist between BIG_APPL and VA_APPL4.
*-----------------------------------------------------------------------
* Define a VTAM application with four primary and one secondary
* LU half-sessions.
*
* APPL1  APPL     AUTH=(ACQ),          minimum VTAM "APPL" required
*                 PARSESS=YES
*

BIG_APPL VTAMAPPL APPLID=APPL1         VTAM APPL = 'APPL1'

PLUHS_AB LU       MAXSESS=(2,0),       two primary half-sessions
                  INIT=SEC,            secondary will initiate session
                  PATH=(PLU_PATH),     primary path
                  DELAY=F0             no delays for primary
PLUHS_CD LU       MAXSESS=(2,0),       two primary half-sessions
                  INIT=PRI,            primary will initiate session
                  PATH=(PLU_PATH),     primary path
                  RESOURCE=APPL4,      generate INIT-SELF to 'APPL4'
                  DLOGMOD=D4A32782,    VTAM logon mode table entry
                  DELAY=F0,            no delays for primary
                  FRSTTXT=HOLDUP       delay before sending INIT-SELF
SLUHS_E  LU       MAXSESS=(0,1),       one secondary half-session
                  LUTYPE=LU2,          LU Type 2 secondary half-session
                  INIT=PRI,            primary will initiate session
                  PATH=(SLU_PATH),     secondary path
                  LOGDSPLY=BOTH,       log display images
                  THKTIME=UNLOCK       start delay after keyboard unlock
*
* Define a VTAM application with one secondary LU half-session.
*
* APPL2  APPL                          minimum VTAM "APPL" required
*

VA_APPL2 VTAMAPPL APPLID=APPL2         VTAM APPL = 'APPL2'

SLU_HS_A  LU      MAXSESS=(0,1),       one secondary half-session
                  LUTYPE=LU2,          LU Type 2 secondary half-session
                  INIT=SEC,            secondary will initiate session
                  PATH=(SLU_PATH),     secondary path
                  RESOURCE=APPL1,      generate INIT-SELF to 'APPL1'
                  DLOGMOD=D4A32782,    VTAM logon mode table entry
                  LOGDSPLY=BOTH,       log display images
                  THKTIME=UNLOCK       start delay after keyboard unlock
*-----------------------------------------------------------------------
* Define a VTAM application with one secondary LU half-session.
*
* APPL3  APPL                          minimum VTAM "APPL" required
*
VA_APPL3 VTAMAPPL APPLID=APPL3         VTAM APPL = 'APPL3'

SLU_HS_B  LU      MAXSESS=(0,1),       one secondary half-session
                  LUTYPE=LU2,          LU Type 2 secondary half-session
                  INIT=SEC,            secondary will initiate session
                  PATH=(SLU_PATH),     secondary path
                  DLOGMOD=D4A32782,    VTAM logon mode table entry
                  LOGDSPLY=BOTH,       log display images
                  THKTIME=UNLOCK,      start delay after keyboard unlock
                  FRSTTXT=LOGAPPL1     generate INIT-SELF to 'APPL1'
*-----------------------------------------------------------------------
* Define a VTAM application with two secondary and one primary LU
* half-sessions.
*
* APPL4  APPL     AUTH=(ACQ),          minimum VTAM "APPL" required
*                 PARSESS=YES
*

VA_APPL4 VTAMAPPL APPLID=APPL4,        VTAM APPL = 'APPL4'
                  LUTYPE=LU2,          LU Type 2 secondary half-session
                  INIT=PRI,            primary will initiate session
                  PATH=(SLU_PATH),     secondary path
                  LOGDSPLY=BOTH,       log display images
                  THKTIME=UNLOCK       start delay after keyboard unlock

SLU_HS_C  LU      MAXSESS=(0,1)        one secondary half-session
SLU_HS_D  LU      MAXSESS=(0,1)        one secondary half-session
PLUHS_E   LU      MAXSESS=(1,0),       one primary half-session
                  PATH=(PLU_PATH),     primary path
                  RESOURCE=APPL1,      generate INIT-SELF to 'APPL1'
                  DLOGMOD=D4A32782,    VTAM logon mode table entry
                  DELAY=F0             no delays for primary
PLU_DECK MSGTXT
         WTO      (Starting $MSGTXTID$)
         TEXT     ('F5C3'),                    Erase/Write, Unlock Keyboard
                  ($LUID$$SESSNO$ is Active)   startup message

* The following IFs are used by the primary LU half-session to
* 1) ignore SNA responses,
* 2) ignore Data Flow Control (DFC) and Session Control (SC) requests,
* 3) ignore Network Control (NC) requests,
* 4) ignore middle-in-chain and last-in-chain chain elements,
* 5) echo data received when an Enter AID is received,
* 6) generate a time-of-day response message when a PF1 AID is received,
* 7) unlock the keyboard when a Clear AID is received, and
* 8) echo data received when any other AID is received.
 
1        IF       LOC=RH+0,TEXT='80',THEN=IGNORE,STATUS=HOLD
2        IF       LOC=RH+0,TEXT='40',THEN=IGNORE,STATUS=HOLD
3        IF       LOC=RH+0,TEXT='20',THEN=IGNORE,STATUS=HOLD
4        IF       LOC=RH+0,TEXT='02',ELSE=IGNORE,STATUS=HOLD
5        IF       LOC=RU+0,TEXT=('7D'),THEN=C-ECHO,STATUS=HOLD,  Enter
                  DATASAVE=(1,B+1,500)                           Save data
6        IF       LOC=RU+0,TEXT=('F1'),THEN=C-TIME,STATUS=HOLD   PF1
7        IF       LOC=RU+0,TEXT=('6D'),THEN=C-UNLOCK,STATUS=HOLD Clear
8        IF       LOC=RU+0,TEXT=('FF'),THEN=C-ECHO,STATUS=HOLD,  Others
                  COND=NE,DATASAVE=(1,B+1,500)                   Save data
TOPLOOP  WAIT
         BRANCH   LABEL=TOPLOOP

UNLOCK   TEXT     ('F1C3')             Write, Unlock Keyboard
         RETURN                        return to caller

TIME     DATASAVE AREA=1,
                  TEXT=($TOD,8$)       save time-of-day
         TEXT     ('F5C3'),            Erase/Write, Unlock Keyboard
                  (The current time-of-day is ),
                  ($RECALL,1+0,2$:$RECALL,1+2,2$:), hh:mm:ss.hh
                  ($RECALL,1+4,2$.$RECALL,1+6,2$)
         RETURN                        return to caller
ECHO     TEXT     ('F1C3'),            Write, Unlock Keyboard
                  ('11'),              Set Buffer Address (SBA) order
                  ($RECALL,1$),        recall cursor address and data
                  ('13')               Insert Cursor (IC) order
         RETURN                        return to caller
         ENDTXT

HOLDUP   MSGTXT
         WTO      (Starting $MSGTXTID$)
         DELAY    TIME=F5              allow VTAMAPPL VA_APPL4 to start
         ENDTXT

LOGAPPL1 MSGTXT
         WTO      (Starting $MSGTXTID$)
         CMND     COMMAND=INIT,        generate INIT-SELF
                  RESOURCE=APPL1,      to 'APPL1'
                  MODE=D4A32782        VTAM logon mode table entry
         DELAY    TIME=F0              start SLU_DECK quickly
         ENDTXT

SLU_DECK MSGTXT
         WTO      (Starting $MSGTXTID$)

* Wait for the primary side of the session to send the first message.

0        IF       LOC=RU+0,TEXT=(PLU_HS),SCAN=YES,
                  THEN=B-STARTNOW
WAITING  WAIT
         BRANCH   LABEL=WAITING        let PLU_HS send first message
STARTNOW DEACT    IFS=(0)

* Loop until WSim is stopped.

TOPLOOP  CLEAR
         TEXT     (Hello There PLU_HS! This is $LUID$$SESSNO$.)
         ENTER
         PF1
         ERIN
         TEXT     (I feel like I am talking to myself. )
         ENTER
         PF24
         WTO      (Loop Completed for $LUID$$SESSNO$ $SEQ,5$)
         BRANCH   LABEL=TOPLOOP
         ENDTXT
The following example shows how to code functionally comparable message generation decks that are shown previously using the Structured Translator Language (STL). This example represents the two separate STL programs that are translated by the STL Translator into the message generation decks. Note that program 1 contains PLU_DECK as well as UNLOCK, TIME, ECHO, and HOLDUP, which are STL procedures that are called by PLU_DECK. For information about STL, see WSim Script Guide and Reference.
Program 1
@program=trace1x
plu_deck:  msgtxt
/**********************************************************************/
/* PLU_DECK is used by the primary LUs to check messages received     */
/* from the secondary LUs.  The primary LUs take action based on the  */
/* attention identifier (AID) byte in the received RUs.               */
/*                                                                    */
/* The device buffer is saved for later use when a message is         */
/* received by the primary LU.                                        */
/*                                                                    */
/* Each time a message is received by the primary LU, WSim checks     */
/* to see if the message is to be ignored.  If it is not to be        */
/* ignored, WSim uses the SELECT group to determine what action       */
/* should be taken based on the first byte in the buffer (the AID     */
/* byte).                                                             */
/*                                                                    */
/* The following messages will be ignored:                            */
/*      First byte of RH='80'x - SNA response                         */
/*      First byte of RH='40'x - Data Flow Control                    */
/*      First byte of RH='20'x - Network Control                      */
/*      First byte of RH='02'x - Chaining indicator                   */
/**********************************************************************/
           say 'Starting' MSGTXTID()
           type 'F5C3'x||LUID()||SESSNO()||' is active'
           onin substr(rh,1,1)='80'x then rsp=on
           onin substr(rh,1,1)='40'x then dfc=on
           onin substr(rh,1,1)='20'x then nc=on
           onin substr(rh,1,1)='02'x then chain=on
           onin then received=on
           onin received=on then data_received=buffer
           do forever
            transmit using enter and wait until onin received=on
            if rsp=off & dfc=off & nc=off & chain=off then
             select
              when substr(data_received,1,1)='F1'X then call time
              when substr(data_received,1,1)='6D'X then call unlock
              otherwise call echo
             end
            rsp=off; dfc=off; nc=off; chain=off; received=off
          end
          endtxt
unlock:   msgtxt
/**********************************************************************/
/* UNLOCK is called by PLU_DECK whenever a '6D'x byte is detected in  */
/* the first byte of the RU received from the secondary LU.  A '6D'x  */
/* byte means that the 'CLEAR' key of the secondary has been pressed  */
/* to clear the screen.  The primary LU sends back a 'F1C3'x, which   */
/* clears the screen and unlocks the keyboard.                        */
/**********************************************************************/
          type 'F1C3'x
          return
          endtxt
time:     msgtxt
/**********************************************************************/
/* TIME is called by PLU_DECK whenever a 'F1'x byte is detected in the*/
/* first byte of the RU returned from the secondary LU.  A 'F1'x byte */
/* means that the PF01 key of the secondary LU has been pressed to    */
/* request the time of day.  The TOD(6) function returns the time     */
/* of day in the format HHMMSS.  TIME puts the time of day into the   */
/* format HH:MM:SS.  The time is inserted in a time                   */
/* message and sent back to the secondary LU.                         */
/**********************************************************************/
          time_of_day=substr(tod(6),1,2)||':'||,
                      substr(tod(6),3,2)||':'||,
                      substr(tod(6),5,2)
          type 'F1C3'x||'The current time-of-day is '||time_of_day
          return
          endtxt
echo:     msgtxt
/**********************************************************************/
/* ECHO is called by PLU_DECK each time the primary LU receives a     */
/* message it is not to ignore (no "ignore" switch is set)            */
/* and the AID byte associated with the message is something other    */
/* than '6d'x (CLEAR) or 'F1'x (PF01).  This procedure extracts       */
/* everything in the device buffer from the second byte on and        */
/* sends it back to the secondary LU.                                 */
/**********************************************************************/
          type 'F1C311'x||substr(data_received,2)||'13'x
          return
          endtxt
holdup:   msgtxt
/**********************************************************************/
/* HOLDUP is used by the primary LUs to ensure that the secondary     */
/* LUs have a chance to get started before WSim begins sending        */
/* messages.  It is a simple 5-second delay.                          */
/**********************************************************************/
          say 'Starting' MSGTXTID()
          suspend(5)
          endtxt
Program 2
@program=trace2x
logappl1: msgtxt
/**********************************************************************/
/* LOGAPPL1 is used as a FRSTTXT deck by some of the secondary LUs.   */
/* It sends an initiate-self RU to the primary LU to establish a      */
/* session.                                                           */
/**********************************************************************/
          say 'Starting' MSGTXTID()
          initself('APPL1','D4A32782')
          endtxt
slu_deck:  msgtxt
/**********************************************************************/
/* SLU_DECK is used by the secondary LUs.  It waits in a DO WHILE     */
/* loop until 'PLUHS' appears in the buffer, indicating the primary   */
/* LU has contacted the secondary LU.                                 */
/*                                                                    */
/* The DO FOREVER loop that follows sends a CLEAR, types and enters   */
/* a message, sends a PF1, erases to end-of-input, and types and      */
/* sends another message with a PF24.  Since THKTIME=UNLOCK is        */
/* specified in the network definitions, the next message in this     */
/* series is not sent until the primary LU returns a keyboard unlock. */
/*                                                                    */
/* A counter is incremented by one and a message is written to the    */
/* operator console indicating that the loop has been successfully    */
/* completed the number of times indicated by the counter.            */
/**********************************************************************/
           count=0
           say 'Starting' MSGTXTID()
           do while index(buffer,'PLUHS')=0
            suspend(2)
           end
           do forever
            transmit using clear
            type 'Hello There PLUHS! This is '||LUID()||SESSNO()||'.'
            transmit using enter
            transmit using pf1
            erin
            type 'I feel as if I am talking to myself.'
            transmit using pf24
            count=count+1
            say 'Loop completed for '||LUID()||SESSNO()||'-'||char(count)
           end
           endtxt