z/OS Communications Server: SNA Programmer's LU 6.2 Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Sample VTAM LU 6.2 application program

z/OS Communications Server: SNA Programmer's LU 6.2 Guide
SC27-3669-00

**********************************************************************
***                                                                ***
***  INTRODUCTION:  This sample application is provided to give    ***
***     potential VTAM LU 6.2 application writers a simple         ***
***     example of the major processes needed to facilitate LU 6.2 ***
***     conversations.                                             ***
***                                                                ***
***     One of the main objectives of this sample is to show       ***
***     the logic of a successful conversation.  However           ***
***     keeping the sample simple and easy to follow was made      ***
***     possible by omitting many error paths that can occur       ***
***     during a conversation.  For instance a TPEND exit, which   ***
***     notifies an application of VTAM services ending, was       ***
***     not provided.  Testing to insure a macro instruction       ***
***     was accepted successfully and recovery routines to address ***
***     completion errors were not provided.  Much of a user       ***
***     written application deals with error conditions as opposed ***
***     to successful communication.                               ***
***                                                                ***
***     Note that the application assumes no processing            ***
***     contentions when it allocates storage for                  ***
***     containing conversation related information.               ***
***                                                                ***
***     Much of the logic which complicates the transaction        ***
***     program processing has been replaced by a WTOR to the      ***
***     console operator to dictate the next communication         ***
***     action a transaction program should take.                  ***
***                                                                ***
***  BASIC STRUCTURE of the SAMPLE:  The MAIN code will deal       ***
***     with managing the ACB and upon request issue the           ***
***     necessary macroinstructions to start a conversation.  The  ***
***     rest of the routines will be executed from the completion  ***
***     RPL exit of a previous macro instruction or from the       ***
***     ACB ATTN exit.  All exits are executed unauthorized in     ***
***     order to allow WTO/WTOR macroinstruction to work           ***
***     successfully.  Most of the VTAM macroinstructions are      ***
***     issued OPTCD=ASY and EXIT=address.  This allows the        ***
***     application to take advantage of the processing tasks      ***
***     created by VTAM for RPL completions.  This simplifies      ***
***     the application from doing ATTACHes for the transaction    ***
***     programs but still achieves an asynchronous like           ***
***     operation.                                                 ***
***                                                                ***
***  OTHER DEFINITION NEEDED:                                      ***
***                                                                ***
***     The following are the APPL definitions that would support  ***
***     the two applications that can be generated by this sample  ***
***     code.  Even though the SRBEXIT=NO is defaulted, it is      ***
***     still shown here, to highlight that the ACB exits are      ***
***     executed unauthorized:                                     ***
***                                                                ***
***                                                         col 72 ***
***                                                              | ***
***                                                              V ***
***          VBUILD TYPE=APPL                                      ***
*** ACBVICKY APPL APPC=YES,SRBEXIT=NO,                           X ***
***               DSESLIM=2,DMINWNL=1,DMINWNR=1                    ***
*** ACBGARY  APPL APPC=YES,SRBEXIT=NO,                           X ***
***               DSESLIM=2,DMINWNL=1,DMINWNR=1                    ***
***                                                                ***
***                                                                ***
***     The following is the MODEENT macro that was added to       ***
***     logon mode table (ISTINCLM).  This entry was patterned     ***
***     after the SNASVCMG entry which is shipped with the VTAM    ***
***     default logmode table.  In this example, the max RU        ***
***     size was changed to 512 bytes.                             ***
***                                                                ***
***                                                                ***
*** SNASVCMG MODEENT LOGMODE=SNASVCMG,FMPROF=X'13',TSPROF=X'07', X ***
***            PRIPROT=X'B0',SECPROT=X'B0',COMPROT=X'D0B1',      X ***
***            RUSIZES=X'8585',ENCR=B'0000',TYPE=0,              X ***
***            PSERVIC=X'060200000000000000000300'                 ***
*** LU62CONV MODEENT LOGMODE=LU62CONV,FMPROF=X'13',TSPROF=X'07', X ***
***            PRIPROT=X'B0',SECPROT=X'B0',COMPROT=X'D0B1',      X ***
***            RUSIZES=X'8686',ENCR=B'0000',TYPE=0,              X ***
***            PSERVIC=X'060200000000000000000300'                 ***
***                                                                ***
**********************************************************************
         EJECT
**********************************************************************
***  ASSEMBLER NOTES:  The following assembler variable (&SIDE) is ***
***  used to include appropriate instructions for building one of  ***
***  two VTAM LU 6.2 sample applications.  This assembler variable ***
***  can be set to "LEFT " or "RIGHT".  The result of each value   ***
***  will generate the following information:                      ***
***                                                                ***
***    &SIDE SETC 'LEFT ' ==> will generate a CSECT name of        ***
***      APPCAPPL, OPEN an ACB with an APPLID value of "ACBVICKY"  ***
***      and pre-allocate storage to contain conversation-related  ***
***      information.  Names, JEFFERY and KIMBERLY, have been      ***
***      assigned to each pre-allocated storage.                   ***
***                                                                ***
***    &SIDE SETC 'RIGHT' ==> will generate a CSECT name of        ***
***      APPCAPPR, OPEN an ACB with an APPLID value of "ACBGARY"   ***
***      and pre-allocate storage to contain conversation-related  ***
***      information.  Names, JAIME and TIMOTHY, have been         ***
***      assigned to each pre-allocated storage.                   ***
***                                                                ***
***  Assembler H was used to assemble this source which allows     ***
***  symbols to be used before they are defined.  If Assembler F   ***
***  is used, the DSECTs will need to be moved ahead of the code   ***
***  that references the symbols defined in the DSECTs.            ***
**********************************************************************
         SPACE 3
         LCLC  &SIDE
&SIDE    SETC  'LEFT '
* &SIDE    SETC  'RIGHT'
         SPACE 3
         AIF   ('&SIDE' EQ 'LEFT ').LCSECT
APPCAPPR CSECT
         AGO   .ECSECT
.LCSECT  ANOP
APPCAPPL CSECT
.ECSECT  ANOP
         SPACE 3
**********************************************************************
*                                                                    *
*    Register EQUATES                                                *
*                                                                    *
**********************************************************************
R0       EQU   0
R1       EQU   1
R2       EQU   2
R3       EQU   3
R4       EQU   4
R5       EQU   5
R6       EQU   6
R7       EQU   7
R8       EQU   8
R9       EQU   9
R10      EQU   10
R11      EQU   11
R12      EQU   12
R13      EQU   13
R14      EQU   14
R15      EQU   15
         EJECT
***
**********************************************************************
*                                                                    *
*    Initialization Section - Perform standard linkage convention    *
*    and establish addressability for the program and RPL and        *
*    RPL extension.                                                  *
*                                                                    *
*      Registers on entry:                                           *
*                R13 address of an 18 word save area                 *
*                R14 return address                                  *
*                R15 entry address of this program                   *
**********************************************************************
         SPACE 3
MAIN     EQU   *
         STM   R14,R12,12(R13)         Save registers
         LR    R12,R15                 Establish base for MAIN routine
         AIF   ('&SIDE' EQ 'LEFT ').LUSING
         USING APPCAPPR,R12
         AGO   .EUSING
.LUSING  ANOP
         USING APPCAPPL,R12
.EUSING  ANOP
         CNOP  0,4                     Fullword boundary
         BAL   R1,*+76                 Branch around save area
         DC    18F'0'                  Save area for macroinstruction
         ST    R1,8(0,R13)             Chain
         ST    R13,4(0,R1)               save area
         LR    R13,R1                  Set register 13 to save area
         LA    R9,MAINRPL              Establish addressability
         USING IFGRPL,R9                  to MAIN routine RPL
         LA    R8,MAINRPL6             Establish addressability
         USING ISTRPL6X,R8                to MAIN routine RPL Extension
         SPACE 3
***
**********************************************************************
*                                                                    *
*    Issue OPEN macroinstruction to identify this program to VTAM.   *
*    The OPEN macroinstruction references a VTAM ACB with a label    *
*    of ACB.  The ACB is VTAM's representation of the LU.  All VTAM  *
*    macros used will reference this ACB.                            *
*                                                                    *
**********************************************************************
         SPACE 3
         WTO   'ISSUING OPEN ACB MACRO REQUEST',ROUTCDE=(1)
         XR    R15,R15                 Initialize register 15 = 0
         OPEN  ACB
         LTR   R15,R15                 Test OPEN
         BZ    OPENOK                  Branch if successful
         WTO   'OPEN ACB MACRO REQUEST FAILED ',ROUTCDE=(1)
         B     MAINRETN                Branch to MAIN return
         SPACE 3
**********************************************************************
*                                                                    *
*    Issue SETLOGON macroinstruction to enable VTAM to start         *
*    accepting LU 6.2 session-initiation request on behalf of the    *
*    application program.  The RPL operand of this and other         *
*    macroinstructions specifies the request parameter list (RPL)    *
*    that is used to send and receive information about the          *
*    macroinstruction to and from VTAM.                              *
*                                                                    *
**********************************************************************
         SPACE 3
OPENOK   EQU   *
         WTO   'ISSUING SETLOGON MACRO REQUEST',ROUTCDE=(1)
         SETLOGON RPL=MAINRPL,OPTCD=START
         CLI   RPLRTNCD,USFAOK         RTNCD = X'00' ?
         BNE   SETLOGFL                branch if no
         CLI   RPLFDB2,USFAOOK         FDB2 = X'00'
         BE    LOOP                    branch if yes
SETLOGFL EQU   *
         WTO   'SETLOGON MACRO REQUEST FAILED ',ROUTCDE=(1)
         B     MAINRETN
         EJECT
**********************************************************************
*                                                                    *
*    In any application a user would write, there will be some       *
*    stimulus which will initiate a transaction program.  That       *
*    stimulus will be simulated with a reply from the following      *
*    WTOR macro request.  A reply of "START" will drive code to      *
*    start a conversation.  A reply of "CLOSE" will drive code to    *
*    terminate this application.                                     *
*                                                                    *
**********************************************************************
         SPACE 3
LOOP     EQU   *
         MVC   REPLY,=CL8'        '    Initialize reply storage
         XC    MAINECB,MAINECB         Initialize WTOR ECB
         WTOR  'Enter START to start a transaction or CLOSE to close thX
               e ACB',REPLY,8,MAINECB,ROUTCDE=(1)
         WAIT  ECB=MAINECB             Wait for reply
         CLC   REPLY,=CL8'CLOSE'       Operator reply close?
         BE    MAINEND                 Branch yes
         CLC   REPLY,=CL8'START   '    Operator wants to start a
*                                      conversation?
         BE    STARTUP                 Branch yes
         WTO   'OPERATOR REPLY IS INVALID     ',ROUTCDE=(1)
         B     LOOP
         EJECT
**********************************************************************
*                                                                    *
*    In LU 6.2 architecture before a conversation can be started     *
*    the LUs must first have established some rules and limits       *
*    for the sessions that will be used by the transaction programs. *
*    Therefore this program determines if these rules and limits     *
*    have been established, and if not, issues the appropriate       *
*    macroinstructions to cause this process to happen.  This sample *
*    application will be concerned with LU 6.2 sessions established  *
*    using the LOGMODE named "LU62CONV".                             *
*    The APPCCMD CONTROL=OPRCNTL, QUALIFY=CNOS is the                *
*    macroinstruction used to cause the process for establishing     *
*    these rules and limits.                                         *
*                                                                    *
**********************************************************************
         SPACE 3
STARTUP  EQU   *
         CLI   LUSTATE,LUCNOSD         As a CNOS set establishing
*                                      session limits > 0 been
*                                      processed?
         BE    DOALLOC                 Branch yes (bypass CNOS)
         MVC   RPL6LU,LUNAME           Set RPL extension LU name
         MVC   RPL6MODE,LOGMODE        Set RPL extension LOGMODE
         WTO   'ISSUING CONTROL=OPRCNTL,QUALIFY=CNOS MACRO REQUEST',ROUX
               TCDE=(1)
         APPCCMD CONTROL=OPRCNTL,QUALIFY=CNOS,                         X
               RPL=MAINRPL,AAREA=MAINRPL6,                             X
               AREA=0,RECLEN=0,                                        X
               OPTCD=SYN
         SPACE 3
**********************************************************************
*                                                                    *
*  Verify macroinstruction completed successfully.  If it did not,   *
*  provide notification of its failure.                              *
*                                                                    *
**********************************************************************
         CLI   RPLRTNCD,USFAOK         RTNCD = X'00' ?
         BNE   CNOSFL                  branch no
         CLI   RPLFDB2,USF6APPC        FDB2 = X'0B' ?
         BNE   CNOSFL                  Branch no
         CLC   RPL6RCPR,=AL2(USF6OK)   RCPRI = X'00'?
         BNE   CNOSFL                  branch no
         MVI   LUSTATE,LUCNOSD         set LU state to CNOSed
         B     DOALLOC                 branch to do the allocate
CNOSFL   EQU   *
         SPACE 3
**********************************************************************
*                                                                    *
*  To simplify this sample we will assume an unsuccessful CNOS       *
*  implies the partner LU is not available.                          *
*                                                                    *
**********************************************************************
         WTO   'CONTROL=OPRCNTL,QUALIFY=CNOS MACRO REQUEST FAILED',ROUTX
               CDE=(1)
         B     LOOP
         EJECT
**********************************************************************
*                                                                    *
*    Once a successful CNOS has been achieved, then the start        *
*    transaction process can be performed.  This sample program      *
*    will first find an available conversation entry in the local    *
*    conversation table, which will be used to maintain knowledge    *
*    of the conversation.  The conversation entry will consist of    *
*    the storage needed to issue VTAM macroinstruction for the       *
*    conversation.                                                   *
*                                                                    *
*    The APPCCMD CONTROL=ALLOC macroinstruction will be issued to    *
*    initiate a conversation.  The AREA field will point to an       *
*    FMH-5 which is used to identify the transaction processing      *
*    this conversation applies.                                      *
*                                                                    *
*    Most of the macroinstruction this sample program issues will    *
*    complete asynchronously with an exit which VTAM will invoke     *
*    when the request has finished.                                  *
*                                                                    *
*   This sample will also utilize the USERFLD of the RPL6 to         *
*   pass the address of the conversation entry to the RPL exit       *
*   specified on the request.                                        *
*                                                                    *
*    NOTE: This sample program will assume that two conversations    *
*    will "NOT" be started at the same time.  This implies that the  *
*    ATTN FMH-5 exit and this procedure will not overlap during      *
*    execution.                                                      *
*                                                                    *
**********************************************************************
         SPACE 3
DOALLOC  EQU   *
         LA    R6,2(0,0)               R6 assigned to 2 (#entries)
         L     R10,=A(CONVTBL)         R10 address of conversation
*                                      table (1st entry)
         USING CONVTBLD,R10            Establish addressability
*                                      of conversation entry
TSTOPEN  EQU   *
         CLI   CONVSTAT,CONVOPEN       Entry available ?
         BE    GOTONE                  Branch yes
         LA    R10,CONVLEN(0,R10)      Address next entry
         BCT   R6,TSTOPEN              Branch to TESTOPEN if we
*                                      haven't reached end of table.
         SPACE 1
         WTO   'ALL CONVERSATION ENTRIES IN USE',ROUTCDE=(1)
         B     LOOP                    return to mainline prompt
         SPACE 3
GOTONE   EQU   *                       Have conversation entry
         MVI   CONVSTAT,CONVACT        Make entry as allocated
         MVC   CONVRPL,MODLRPL         Initialize RPL
         MVC   CONVRPL6,MODLRPL6       Initialize RPL6
         LA    R1,CONVRPL6             Establish RPL6 basing
         MVC   RPL6LU-ISTRPL6X(L'RPL6LU,R1),LUNAME    Set LUNAME
*                                      field in RPL6
         MVC   RPL6MODE-ISTRPL6X(L'RPL6MODE,R1),LOGMODE  Set LOGMODE
*                                      field in RPL6
         MVC   CONVAREA(L'MODLFMH5),MODLFMH5     Initialize AREA with
*                                      a valid FMH-5
         SPACE 1
         WTO   'ISSUING CONTROL=ALLOC,QUALIFY=ALLOCD MACRO REQUEST',ROUX
               TCDE=(1)
         SPACE 1
         APPCCMD CONTROL=ALLOC,QUALIFY=ALLOCD,                         X
               RPL=CONVRPL,AAREA=CONVRPL6,                             X
               AREA=CONVAREA,RECLEN=L'MODLFMH5,                        X
               OPTCD=ASY,EXIT=AEXT,USERFLD=(R10)
         SPACE 1
         LTR   R15,R15                 ALLOC request accepted OK?
         BZ    LOOP                    Branch if yes
         SPACE 1
         WTO   'CONTROL=ALLOC,QUALIFY=ALLOCD MACRO REQUEST FAILED',ROUTX
               CDE=(1)
         SPACE 1
         B     LOOP                    Go back to WTOR prompt
         EJECT
**********************************************************************
*                                                                    *
*    This termination routine is making the assumption that all      *
*    conversations have completed successfully.  Therefore the work  *
*    remaining is to CNOS the LOGMODE mode LU62CONV session limits   *
*    to zero and then CNOS the SNASVCMG limits to zero.  Once the    *
*    the CNOSes have completed the ACB will be CLOSED and then the   *
*    application will return to the system.                          *
*                                                                    *
**********************************************************************
         SPACE 3
MAINEND  EQU   *
         CLI   LUSTATE,LUCNOSD         Have session limits been set?
         BNE   DOCLOSE                 branch if not
         MVC   RPL6LU,LUNAME           Set RPL extension LU name
         MVC   RPL6MODE,LOGMODE        Set RPL extension LOGMODE
         XC    MAINAREA,MAINAREA       initializing the AREA to zero
*                                      will produce a CNOS structure
*                                      with session limits set to zero
         LA    R1,MAINAREA             Address AREA storage
         SPACE 1
         WTO   'RESETTING SESSION LIMITS FOR LU62CONV MODE        ',ROUX
               TCDE=(1)
         SPACE 1
         APPCCMD CONTROL=OPRCNTL,QUALIFY=CNOS,                         X
               ACB=ACB,RPL=MAINRPL,AAREA=MAINRPL6,                     X
               AREA=MAINAREA,RECLEN=SLCLEN,                            X
               OPTCD=SYN
         SPACE 1
         MVC   RPL6MODE,=CL8'SNASVCMG' Set to CNOS the SNASVCMG mode
         SPACE 1
         WTO   'RESETTING SESSION LIMITS FOR SNASVCMG MODE        ',ROUX
               TCDE=(1)
         SPACE 1
         APPCCMD CONTROL=OPRCNTL,QUALIFY=CNOS,                         X
               ACB=ACB,RPL=MAINRPL,AAREA=MAINRPL6,                     X
               OPTCD=SYN
         SPACE 3
DOCLOSE  EQU   *
         WTO   'ISSUING CLOSE ACB MACRO REQUEST         ',ROUTCDE=(1)
         CLOSE ACB                     Close ACB
         SPACE 3
**********************************************************************
*      Registers on exit:                                            *
*                R0-R14 values that were set upon entry              *
*                R15 set to zero                                     *
**********************************************************************
         SPACE 3
MAINRETN DS    0H
         L     R13,4(0,R13)            Reload register 13
         LM    R14,R12,12(R13)         Reload the remaining registers
         XR    R15,R15                 Set return register to 0
         BR    R14                     Return to system dispatcher
         DROP  R8,R9,R10,R12
         EJECT
**********************************************************************
*                                                                    *
*    MAIN routine data area                                          *
*                                                                    *
**********************************************************************
         SPACE 3
REPLY    DC    CL8' '                  WTOR REPLY area
MAINECB  DC    F'0'                    WTOR ECB
         SPACE 3
MAINRPL  RPL   AM=VTAM,ACB=ACB         MAIN task RPL
MAINRPL6 ISTRPL6                       MAIN task RPL6
MAINAREA DC    XL(SLCLEN)'00'          MAIN task AREA
         SPACE 3
         DS    0F
MODLRPL  RPL   AM=VTAM,ACB=ACB         Model RPL
MODLRPL6 ISTRPL6 CONMODE=CS,FILL=LL,LOGMODE=LU62CONV   Model RPL6
MODLFMH5 DC    XL21'150502FF0003D0000008C140D7C5D9E2D6D5000000' Model
*                                      FMH-5
         SPACE 3
ACB      ACB   AM=VTAM,                                                X
               EXLST=EXLST,                                            X
               APPLID=APPLID
EXLST    EXLST AM=VTAM,                                                X
               ATTN=ATTNEXIT
APPLID   DC    AL1(8)
         AIF   ('&SIDE' EQ 'LEFT ').LAPPLID
         DC    CL8'ACBGARY '
         AGO   .EAPPLID
.LAPPLID ANOP
         DC    CL8'ACBVICKY'
.EAPPLID ANOP
         LTORG
         EJECT
**********************************************************************
*                                                                    *
*        ATTN EXIT Routine                                           *
*                                                                    *
* The ATTN Exit is driven by VTAM to notify the application when     *
* certain events have happened.  The exit's address is supplied in   *
* EXLST control block, which is pointed to by the ACB that was       *
* OPENed.  The three events that are reported are 1) the reception   *
* of an FMH-5, 2) the processing of a CNOS transaction, and 3) the   *
* unbind of the last LU 6.2 session of a mode group.                 *
*                                                                    *
* VTAM enters the ATTN exit with a read-only RPL, which points to    *
* a read-only RPL extension.  The RPL extension contains the name    *
* of the partner LU and logon mode.                                  *
*                                                                    *
* Of the three events, this sample application will be interested in *
* FMH-5 arrivals and CNOS processing.  FMH-5 arrivals will cause     *
* this exit to issue a RCVFMH5 APPCCMD macroinstruction.             *
* For CNOS events this exit will note if session limits are being    *
* initialized or reset.                                              *
*                                                                    *
*  ON ENTRY:                                                         *
*       R1 - address of a 6 word parameter list as documented in     *
*            in the LU 6.2 programming manual                        *
*       R14 - Return address when processing is finished             *
*       R15 - Address of this ATTN exit.                             *
*                                                                    *
**********************************************************************
         SPACE 3
ATTNEXIT DS    0H
         USING ATTNEXIT,R15            Temporary base for this routine
         CNOP  0,4                     Fullword alignment
         BAL   R13,*+76                branch around save area
         DC    18F'0'                  Set up save area chain
         STM   R14,R12,12(R13)         Store current registers
         LR    R12,R15                 Establish normal base register
         DROP  R15                        for this
         USING ATTNEXIT,R12                 ATTN exit
         CNOP  0,4                     Fullword alignment
         BAL   R15,*+76                branch around save area
         DC    18F'0'                  Save area for called routines
*                                      and macro requests
         ST    R15,8(0,R13)            chain save areas
         ST    R13,4(0,R15)               together
         LR    R13,R15                 set R13 to second savearea
         LR    R11,R1                  preserve parameter address
         SPACE 3
         WTO   'ENTERING ATTN ACB EXIT ROUTINE          ',ROUTCDE=(1)
         SPACE 3
         L     R9,16(R11)              Load address of read only RPL
         USING IFGRPL,R9               establish base register
         L     R8,RPLAAREA             Load address of read only RPL6
         USING ISTRPL6X,R8             establish base register
         CLC   RPL6LU,LUNAME           Verify partner LU name
         BE    LUOK                    Branch if OK
         EX    0,*                     0C3 Definition error with
*                                      partner LU
LUOK     EQU   *
         CLC   RPL6MODE,LOGMODE        Is LOGMODE = LU62CONV
         BE    MODEOK                  Branch if yes
         CLC   RPL6MODE,=CL8'SNASVCMG' Is this SNASVCMG LOGMODE
         BE    MODEOK                  Branch if yes
         EX    0,*                     0C3 - Definition erro with
*                                      partner LU
MODEOK   EQU   *
         CLC   12(4,R11),=CL4'CNOS'    Is this a CNOS event?
         BE    ATTNCNOS                branch if yes to CNOS process
         CLC   12(4,R11),=CL4'FMH5'    Is this an FMH-5 reception ?
         BE    ATTNFMH5                branch if yes to FMH-5 process
         CLC   12(4,R11),=CL4'LOSS'    Is this an UNBIND session
*                                      event?
         BE    ATTNLOSS                branch if yes to LOSS process
         EJECT
**********************************************************************
*                                                                    *
*        CNOS Processing Routine                                     *
*                                                                    *
* For ATTN exit driven for CNOS, the read RPL also provides a        *
* pointer to a read-only session limits data structure (ISTSLCNS).   *
* The session limits structure contains the negotiated session       *
* limits between the two LUs.                                        *
**********************************************************************
         SPACE 3
ATTNCNOS EQU   *
         WTO   'ATTN EXIT DRIVEN FOR CNOS          ',ROUTCDE=(1)
         SPACE 3
         L     R7,RPLAREA              Establish addressability to
         USING ISTSLCNS,R7                CNOS structure
         CLC   SLCSESSL,=H'0'          Is the a Reset Session limits?
         BE    RESET                   branch if yes
         MVI   LUSTATE,LUCNOSD         Else this request is setting
*                                      limits which this sample
*                                      program will just make note
*                                      session limits have been CNOSed
         B     ATTNRETN                Branch to return processing
RESET    EQU   *
         MVI   LUSTATE,LUNCNOS         Make note that session limits
*                                      have been reset and that no
*                                      limits are established.
         B     ATTNRETN                Branch to return processing
         DROP  R7                      remove basing to CNOS
*                                      structure
         EJECT
**********************************************************************
*                                                                    *
*        FMH-5 Processing Routine                                    *
*                                                                    *
*   VTAM schedules the ATTN exit with an FMH-5 event that indicates  *
*   the partner has allocated a conversation with this LU.           *
*                                                                    *
*   The main propose of this process is to find an open conversation *
*   entry and issue a RCVFMH5 macroinstruction to receive the FMH-5  *
*   and complete the conversation's initialization on this side.     *
*   This macroinstruction will be issued asynchronously with an      *
*   exit to be driven when the request has completed.                *
*   This sample will assume the FMH-5 can be contained within the    *
*   the area supplied in the conversation entry.                     *
*                                                                    *
*   This sample will also utilize the USERFLD of the RPL6 for        *
*   passing the address of the conversation entry to the RPL exit    *
*   specified on the request.                                        *
*                                                                    *
*                                                                    *
**********************************************************************
         SPACE 3
ATTNFMH5 EQU   *
         WTO   'ATTN EXIT DRIVEN FOR FMH5 RECEIVED ',ROUTCDE=(1)
         SPACE 3
         LA    R6,2(0,0)               R6 assigned to 2 (#entries)
         L     R10,=A(CONVTBL)         R10 address of conversation
*                                      table (1st entry)
         USING CONVTBLD,R10            Establish addressability
*                                      of conversation entry
TESTOPEN EQU   *
         CLI   CONVSTAT,CONVOPEN       Entry available ?
         BE    RCVFMH5                 Branch yes
         LA    R10,CONVLEN(0,R10)      Address next entry
         BCT   R6,TESTOPEN             Branch to TESTOPEN if we
*                                      haven't reached end of table.
         EX    0,*                     Definition error or partner
*                                      LU. Cannot accept this
*                                      conversation request.
         SPACE 3
RCVFMH5  EQU   *
         MVI   CONVSTAT,CONVACT        Set conversation as active
         L     R1,=A(MODLRPL)          Initialize
         MVC   CONVRPL,0(R1)              RPL
         L     R1,=A(MODLRPL6)         Initialize
         MVC   CONVRPL6,0(R1)             RPL6
         SPACE 3
         WTO   'ISSUING CONTROL=RCVFMH5 MACRO REQUEST             ',ROUX
               TCDE=(1)
         SPACE 3
         APPCCMD RPL=CONVRPL,AAREA=CONVRPL6,                           X
               CONTROL=RCVFMH5,AREA=CONVAREA,AREALEN=L'CONVAREA,       X
               OPTCD=ASY,EXIT=R5EXT,USERFLD=(R10)
         B     ATTNRETN                Branch to EXIT return
         EJECT
**********************************************************************
*                                                                    *
*        LOSS Processing Routine                                     *
*                                                                    *
**********************************************************************
         SPACE 3
ATTNLOSS EQU   *
         WTO   'ATTN EXIT DRIVEN FOR LOSS SESSION  ',ROUTCDE=(1)
         B     ATTNRETN
         EJECT
**********************************************************************
*                                                                    *
*        ATTN return processing                                      *
*                                                                    *
**********************************************************************
         SPACE 3
ATTNRETN EQU   *
         WTO   'EXITING ATTN ACB EXIT ROUTINE           ',ROUTCDE=(1)
         L     R13,4(0,R13)            Load address of first savearea
         LM    R14,R12,12(R13)         Load original registers
         BR    R14                     Branch back to VTAM
         SPACE 3
         DROP  R8,R9,R10,R12           remove basing for passed
*                                      structure
         LTORG
         EJECT
**********************************************************************
*                                                                    *
*        Partner LU information                                      *
*                                                                    *
**********************************************************************
         SPACE 3
LUENTRY  DS    0D
         AIF   ('&SIDE' EQ 'LEFT ').LPARTNR
LUNAME   DC    CL8'ACBVICKY'           Partner LU Name
         AGO   .EPARTNR
.LPARTNR ANOP
LUNAME   DC    CL8'ACBGARY '           Partner LU Name
.EPARTNR ANOP
LUSTATE  DC    XL1'00'
LUNCNOS  EQU   X'00'                   Session limits not established
LUCNOSD  EQU   X'80'                   Session limits established
         DC    XL7'00'
LOGMODE  DC    CL8'LU62CONV'           LOGMODE name
         EJECT
**********************************************************************
*                                                                    *
*        RCVFMH5 RPL Exit Routine                                    *
*                                                                    *
*        This routine is given control by VTAM when the RCVFMH5      *
*        macroinstruction has completed.  When the macroinstruction  *
*        completes successfully, VTAM will return the conversation   *
*        ID in the RPL extension.  Because the RPL extension is      *
*        dedicated to this conversation, further manipulation of     *
*        the conversation ID will not be required.  The ID will      *
*        automatically be set for the next macroinstruction issued   *
*        for this conversation.                                      *
*                                                                    *
*  ON ENTRY:                                                         *
*       R1 - address of the RPL used in the macroinstruction         *
*       R14 - Return address when processing is finished             *
*       R15 - Address of this RPL exit                               *
*                                                                    *
*                                                                    *
**********************************************************************
R5EXT    EQU   *
         LR    R12,R15                 Establish normal
         USING R5EXT,R12                    addressability for routine
         SPACE 1
         LR    R9,R1                   Establish base reg for RPL
         USING IFGRPL,R9                   RPL
         SPACE 3
         WTO   'ENTERING RCVFMH5 RPL EXIT ROUTINE       ',ROUTCDE=(1)
         SPACE 3
         L     R8,RPLAAREA             Load address of read only RPL6
         USING ISTRPL6X,R8             set basing
         L     R10,RPL6USR             Establish addressability to
         USING CONVTBLD,R10               conversation entry
         LA    R13,CONVSA              Use the conversation storage
         STM   R14,R12,12(R13)           to save the registers
         LA    R15,CONVCA              establish another save area
*                                        for subsequent calls or
*                                        macro requests.
         ST    R15,8(0,R13)            Normal save area
         ST    R13,4(0,R15)               Save area
         LR    R13,R15                        chaining
         SPACE 3
         APPCCMD RPL=CONVRPL,                                          X
               CONTROL=CHECK
         SPACE 3
**********************************************************************
*                                                                    *
*  Verify macroinstruction completed successfully.  If it did not,   *
*  provide notification of its failure.                              *
*                                                                    *
**********************************************************************
         CLI   RPLRTNCD,USFAOK         RTNCD = X'00' ?
         BNE   RCV5FL                  branch no
         CLI   RPLFDB2,USFAOOK         FDB2 = X'00' ?
         BE    DORCV                   Branch yes
RCV5FL   EQU   *
         WTO   'CONTROL=RCVFMH5 failed',ROUTCDE=(1)
         B     R5XTRETN
         SPACE 3
**********************************************************************
*                                                                    *
*  At this point we know the conversation is in receive state and    *
*  therefore a RECEIVE macroinstruction will need to be issued.      *
*                                                                    *
**********************************************************************
DORCV    EQU   *
         L     R12,=A(RREQ)            Branch to RECEIVE request
*                                       processing
         BR    R12                     Branch to routine
         SPACE 3
R5XTRETN EQU   *
         WTO   'EXITING RCVFMH5 RPL EXIT ROUTINE        ',ROUTCDE=(1)
         L     R13,4(0,R13)            Reload return
         LM    R14,R12,12(R13)           register
         BR    R14                     Branch back to VTAM
         DROP  R8,R9,R10,R12           Drop control block addressing
         EJECT
**********************************************************************
*                                                                    *
*        ALLOC RPL Exit Routine                                      *
*                                                                    *
*        This routine is given control by VTAM when the ALLOC        *
*        macroinstruction has completed.  Because the RPL extension  *
*        is dedicated to this conversation, further manipulation of  *
*        the conversation ID will not be required.  The ID will      *
*        automatically be set for the next macroinstruction issued   *
*        for this conversation.                                      *
*                                                                    *
*  ON ENTRY:                                                         *
*       R1 - address of the RPL used in the macroinstruction         *
*       R14 - Return address when processing is finished             *
*       R15 - Address of this RPL exit                               *
*                                                                    *
*                                                                    *
**********************************************************************
AEXT     EQU   *
         LR    R12,R15                 Establish normal
         USING AEXT,R12                     addressability for routine
         SPACE 1
         LR    R9,R1                   Establish base reg for RPL
         USING IFGRPL,R9                   RPL
         SPACE 3
         WTO   'ENTERING ALLOC RPL EXIT ROUTINE         ',ROUTCDE=(1)
         SPACE 3
         L     R8,RPLAAREA             Load address of read only RPL6
         USING ISTRPL6X,R8             set basing
         L     R10,RPL6USR             Establish addressability to
         USING CONVTBLD,R10               conversation entry
         LA    R13,CONVSA              Use the conversation storage
         STM   R14,R12,12(R13)           to save the registers
         LA    R15,CONVCA              establish another save area
*                                        for subsequent calls or
*                                        macro requests.
         ST    R15,8(0,R13)            Normal save area
         ST    R13,4(0,R15)               Save area
         LR    R13,R15                        chaining
         SPACE 3
         APPCCMD RPL=CONVRPL,                                          X
               CONTROL=CHECK
         SPACE 3
**********************************************************************
*                                                                    *
*  Verify macroinstruction completed successfully.  If it did not,   *
*  provide notification of its failure.                              *
*                                                                    *
**********************************************************************
         CLI   RPLRTNCD,USFAOK         RTNCD = X'00' ?
         BNE   ALLCFL                  branch no
         CLI   RPLFDB2,USFAOOK         FDB2 = X'00' ?
         BE    DOSEND                  Branch yes
ALLCFL   EQU   *
         WTO   'CONTROL=ALLOC   failed',ROUTCDE=(1)
         B     AEXTRETN
         SPACE 3
**********************************************************************
*                                                                    *
*  At this point we know the conversation is in send state and       *
*  therefore a SEND macroinstruction will need to be issued.         *
*                                                                    *
**********************************************************************
         SPACE 3
DOSEND   EQU   *
         L     R12,=A(SREQ)            Load address of SEND request
*                                      routine
         BR    R12                     Branch to it
         SPACE 3
AEXTRETN EQU   *
         WTO   'EXITING ALLOC RPL EXIT ROUTINE          ',ROUTCDE=(1)
         L     R13,4(0,R13)
         LM    R14,R12,12(R13)
         BR    R14
         DROP  R8,R9,R10,R12           Drop control block addressing
         EJECT
**********************************************************************
*                                                                    *
*        SEND  Request Routine                                       *
*                                                                    *
*  When designing an LU 6.2 application, the user is free to utilize *
*  many features of the LU 6.2 protocol to facilitate a transaction. *
*  For our sample program we will                                    *
*  have three options which will be dictated by the console operator *
*  through a WTOR macroinstruction.  The operator can reply with     *
*  the following strings of data:                                    *
*                                                                    *
*        DEALLOCATE - which will cause this application to issue a   *
*                     DEALLOC CONFIRM macroinstruction               *
*        blanks     - which will cause this application to issue a   *
*                     PREPRCV CONFIRM macroinstruction.  This will   *
*                     eventually put the conversation into receive   *
*                     state.                                         *
*        any other string - which will cause this application to     *
*                           take that string and add a length field  *
*                           to the beginning and issue a SEND DATA   *
*                           macroinstruction                         *
*                                                                    *
*                                                                    *
*  ON ENTRY:                                                         *
*        R10 = Conversation entry                                    *
*        R12 = Address of this routine                               *
*        R13 = address of normal save area chain                     *
**********************************************************************
SREQ     EQU   *
         USING SREQ,R12                Establish basing for routine
         USING CONVTBLD,R10            Establish basing for
*                                      conversation entry
         WTO   'ENTERING SEND REQUEST ROUTINE           ',ROUTCDE=(1)
         SPACE 3
         MVC   CONVWTOR(MODLWTRL),MODLWTOR
         MVC   CONVWTOR+12(L'CONVNAME),CONVNAME
         MVC   CONVTXT,BLANKS           Initialize reply area
         XC    CONVWECB,CONVWECB        Initialize ECB
         WTOR  ,CONVTXT,L'CONVTXT,CONVWECB,MF=(E,CONVWTOR)
         WAIT  ECB=CONVWECB
         CLC   CONVTXT(L'DEALLOC),DEALLOC
         BE    DODALLOC
         CLC   CONVTXT,BLANKS           Blanks specified?
         BE    SNDCFM
         MVC   CONVLL,=AL2(L'CONVAREA)
         SPACE 3
         WTO   'ISSUING CONTROL=SEND QUALIFY=DATA  MACRO REQUEST  ',ROUX
               TCDE=(1)
         SPACE 3
         APPCCMD RPL=CONVRPL,AAREA=CONVRPL6,                           X
               CONTROL=SEND,QUALIFY=DATA,                              X
               AREA=CONVAREA,RECLEN=L'CONVAREA,                        X
               OPTCD=ASY,EXIT=SEXT
         B     SREQRETN
         SPACE 3
SNDCFM   EQU   *
         WTO   'ISSUING CONTROL=SEND QUALIFY=CONFIRM MACRO REQUEST',ROUX
               TCDE=(1)
         APPCCMD RPL=CONVRPL,AAREA=CONVRPL6,                           X
               CONTROL=PREPRCV,QUALIFY=CONFIRM,                        X
               OPTCD=ASY,EXIT=SEXT
         B     SREQRETN
         SPACE 3
DODALLOC EQU   *
         WTO   'ISSUING CONTROL=DEALLOC QUALIFY=CONFIRM MACRO REQUEST',X
               ROUTCDE=(1)
         APPCCMD RPL=CONVRPL,AAREA=CONVRPL6,                           X
               CONTROL=DEALLOC,QUALIFY=CONFIRM,                        X
               OPTCD=ASY,EXIT=SEXT
SREQRETN EQU   *
         WTO   'EXITING  SEND REQUEST ROUTINE           ',ROUTCDE=(1)
         L     R13,4(0,R13)
         LM    R14,R12,12(R13)
         BR    R14
         DROP  R10,R12                 Drop control block addressing
DEALLOC  DC    CL10'DEALLOCATE'
BLANKS   DC    CL(CONVALEN)' '
MODLWTOR WTOR  'convname - ENTER message, DEALLOCATE, or blanks to receX
               ive    ',,L'CONVTXT,,MF=L
MODLWTRL EQU   *-MODLWTOR
         EJECT
**********************************************************************
*                                                                    *
*        RECEIVE Request Routine                                     *
*                                                                    *
* This sample program has chosen to receive data in logical records. *
* The FILL=LL is specified to inform VTAM to complete this APPCCMD   *
* CONTROL=RECEIVE macroinstruction one logical record at a time.     *
* The QUALIFY=SPEC operand indicates this macroinstruction applies   *
* to a single conversation that is identified in the CONVID field in *
* the RPL extension.  Remember this field was set by VTAM on the     *
* completion of the macro instruction used to establish this         *
* conversation.  This sample program is written not to disturb the   *
* field once VTAM sets it.                                           *
*                                                                    *
* The AREA operand references storage in the conversation entry      *
* where VTAM can place the logical record.                           *
*                                                                    *
* The APPCCMD CONTROL=RECEIVE will be issued asynchronously with an  *
* exit to be driven by VTAM when the receive operation is complete.  *
* The exit address is supplied in the EXIT= operand.                 *
*                                                                    *
*  ON ENTRY:                                                         *
*        R10 = Conversation entry                                    *
*        R12 = Address of this routine                               *
*        R13 = address of normal save area chain                     *
**********************************************************************
RREQ     EQU   *
         USING RREQ,R12
         WTO   'ENTERING RECEIVE REQUEST ROUTINE        ',ROUTCDE=(1)
         USING CONVTBLD,R10
         WTO   'ISSUING CONTROL=RECEIVE QUALIFY=SPEC MACRO REQUEST   ',X
               ROUTCDE=(1)
         MVI   CONVAREA,C' '
         MVC   CONVAREA+1(L'CONVAREA-1),CONVAREA
         APPCCMD RPL=CONVRPL,AAREA=CONVRPL6,                           X
               CONTROL=RECEIVE,QUALIFY=SPEC,FILL=LL,                   X
               AREA=CONVAREA,AREALEN=L'CONVAREA,                       X
               EXIT=REXT
RREQRETN EQU   *
         WTO   'EXITING RECEIVE REQUEST ROUTINE         ',ROUTCDE=(1)
         L     R13,4(0,R13)
         LM    R14,R12,12(R13)
         BR    R14
         DROP  R10,R12
         EJECT
**********************************************************************
*                                                                    *
*        RECEIVE RPL Exit Routine                                    *
*                                                                    *
* VTAM drives this RPL exit routine when the operation for the       *
* APPCCMD CONTROL=RECEIVE macroinstruction is complete.  Based on    *
* how elaborate or simple the user chooses to make his transaction   *
* dictates what the application needs to do next.  This sample       *
* will insure the receive is successful and then assume it is        *
* completed only with DATA-COMPLETE or CONFIRM or both.              *
* The process of DATA-COMPLETE will be to display the data received  *
* to the operator.  If CONFIRM is specified, then an APPCCMD         *
* CONTROL=SEND,QUALIFY=CONFRMD macroinstruction is issued to         *
* acknowledge the data was successfully processed.                   *
* If CONFIRM is not received, then this routine will branch to the   *
* RECEIVE request routine to build an APPCCMD CONTROL=RECEIVE        *
* macroinstruction.                                                  *
*                                                                    *
*  ON ENTRY:                                                         *
*       R1 - address of the RPL used in the macroinstruction         *
*       R14 - Return address when processing is finished             *
*       R15 - Address of this RPL exit                               *
*                                                                    *
*                                                                    *
**********************************************************************
REXT     EQU   *
         LR    R12,R15                 Establish normal
         USING REXT,R12                     addressability for routine
         SPACE 1
         LR    R9,R1                   Establish base reg for RPL
         USING IFGRPL,R9                   RPL
         SPACE 3
         WTO   'ENTERING RECEIVE RPL EXIT ROUTINE       ',ROUTCDE=(1)
         SPACE 3
         L     R8,RPLAAREA             Load address of read only RPL6
         USING ISTRPL6X,R8             set basing
         L     R10,RPL6USR             Establish addressability to
         USING CONVTBLD,R10               conversation entry
         LA    R13,CONVSA              Use the conversation storage
         STM   R14,R12,12(R13)           to save the registers
         LA    R15,CONVCA              establish another save area
*                                        for subsequent calls or
*                                        macro requests.
         ST    R15,8(0,R13)            Normal save area
         ST    R13,4(0,R15)               Save area
         LR    R13,R15                       chaining
         SPACE 3
         APPCCMD RPL=CONVRPL,                                          X
               CONTROL=CHECK
         SPACE 3
**********************************************************************
*                                                                    *
*  Verify macroinstruction completed successfully.  If it did not,   *
*  provide notification of its failure.                              *
*                                                                    *
**********************************************************************
         CLI   RPLRTNCD,USFAOK         RTNCD = X'00' ?
         BNE   RCVFL                   branch no
         CLI   RPLFDB2,USFAOOK         FDB2 = X'00' ?
         BE    WHATRCV                 Branch yes
RCVFL    EQU   *
         WTO   'CONTROL=RECEIVE FAILED',ROUTCDE=(1)
         B     REXTRETN
         SPACE 3
**********************************************************************
*                                                                    *
*  If data has been received, then display the data to the console   *
*  operator via WTO macroinstruction.                                *
*                                                                    *
**********************************************************************
         SPACE 3
WHATRCV  EQU   *
         TM    RPL6RCV1,RPL6WDAC       DATA-COMPLETE
         BZ    TSTCONF
         MVC   CONVWTO(MODLWTOL),MODLWTO
         MVC   CONVWTO+4(L'CONVNAME),CONVNAME
         MVC   CONVWTO+15(L'CONVTXT),CONVTXT
         WTO   ,,MF=(E,CONVWTO)
         SPACE 3
**********************************************************************
*                                                                    *
*  If the CONFIRM indicator has been set, then issue an APPCCMD      *
*  CONTROL=SEND,QUALIFY=CONFRMD macroinstruction to acknowledge      *
*  the data has been processed.                                      *
**********************************************************************
         SPACE 3
TSTCONF  EQU   *
         TM    RPL6RCV1,RPL6WCFM       CONFIRM
         BZ    RCVTST
         WTO   'ISSUING CONTROL=SEND QUALIFY=CONFRMD MACRO REQUEST   ',X
               ROUTCDE=(1)
         APPCCMD RPL=CONVRPL,AAREA=CONVRPL6,                           X
               CONTROL=SEND,QUALIFY=CONFRMD,                           X
               EXIT=SEXT
         SPACE 3
**********************************************************************
*                                                                    *
*  If the conversation state is in receive state, then branch to the *
*  RECEIVE request issuing routine.  Else assume the conversation    *
*  has ended.                                                        *
**********************************************************************
         SPACE 3
RCVTST   EQU   *
         CLI   RPL6CCST,RPL6RECV
         BNE   REXTRETN
         L     R12,=A(RREQ)
         BR    R12
         SPACE 3
REXTRETN EQU   *
         WTO   'EXITING RECEIVE RPL EXIT ROUTINE        ',ROUTCDE=(1)
         L     R13,4(0,R13)
         LM    R14,R12,12(R13)
         BR    R14
         DROP  R8,R9,R10,R12
MODLWTO  WTO   'convname - 12345678901234567890123456789012345678901234X
               567890 ',ROUTCDE=(1),MF=L
MODLWTOL EQU   *-MODLWTO
         EJECT
**********************************************************************
*                                                                    *
*        SEND RPL Exit Routine                                       *
*                                                                    *
* VTAM drives this RPL exit routine when the operation for the       *
* APPCCMD CONTROL=SEND, CONTROL=PREPRCV, or CONTROL=DEALLOC          *
* macroinstruction has completed.                                    *
* This exit will use the conversation state to dictate what needs to *
* be done next.  This sample will assume only three conditions can   *
* exist at the completion of the macroinstruction that caused this   *
* exit to be driven.  The conversation can be in SEND, RECEIVE, or   *
* DEALLOCATED states.                                                *
*                                                                    *
*  ON ENTRY:                                                         *
*       R1 - address of the RPL used in the macroinstruction         *
*       R14 - Return address when processing is finished             *
*       R15 - Address of this RPL exit                               *
*                                                                    *
*                                                                    *
**********************************************************************
         SPACE 3
SEXT     EQU   *
         LR    R12,R15                 Establish normal
         USING SEXT,R12                     addressability for routine
         SPACE 1
         LR    R9,R1                   Establish base reg for RPL
         USING IFGRPL,R9                   RPL
         SPACE 3
         WTO   'ENTERING SEND RPL EXIT ROUTINE          ',ROUTCDE=(1)
         SPACE 3
         L     R8,RPLAAREA             Load address of read only RPL6
         USING ISTRPL6X,R8             set basing
         L     R10,RPL6USR             Establish addressability to
         USING CONVTBLD,R10               conversation entry
         LA    R13,CONVSA              Use the conversation storage
         STM   R14,R12,12(R13)           to save the registers
         LA    R15,CONVCA              establish another save area
*                                        for subsequent calls or
*                                        macro requests.
         ST    R15,8(0,R13)            Normal save area
         ST    R13,4(0,R15)               Save area
         LR    R13,R15                       chaining
         SPACE 3
         APPCCMD RPL=CONVRPL,                                          X
               CONTROL=CHECK
         SPACE 3
*********************************************************************
*                                                                    *
*  Verify macroinstruction completed successfully.  If it did not,   *
*  provide notification of its failure.                              *
*                                                                    *
**********************************************************************
         CLI   RPLRTNCD,USFAOK         RTNCD = X'00' ?
         BNE   SENDFL                  branch no
         CLI   RPLFDB2,USFAOOK         FDB2 = X'00' ?
         BE    SENDTST                 Branch yes
SENDFL   EQU   *
         WTO   'APPCCMD request FAILED',ROUTCDE=(1)
         B     SEXTRETN
         SPACE 3
**********************************************************************
*                                                                    *
*  Determine the conversation state and branch to the appropriate    *
*  process.                                                          *
*                                                                    *
**********************************************************************
         SPACE 3
SENDTST  EQU   *
         CLI   RPL6CCST,RPL6ENDC       Has the conversation ended?
         BE    RESETCNV                branch yes to conversation
*                                      end process.
         CLI   RPL6CCST,RPL6SND        Are we in send state ?
         BNE   GO2RCV                  branch no - assume receive
*                                      state.
         L     R12,=A(SREQ)            Load address of SEND request
*                                      routine.
         BR    R12                     branch to routine
GO2RCV   EQU   *
         L     R12,=A(RREQ)            Load address of RECEIVE request
*                                      routine
         BR    R12                     branch to routine
         SPACE 3
**********************************************************************
*   Because the conversation has ended, we will reset                *
*   the conversation entry as open, indicating entry available       *
*   for the next conversation.                                       *
**********************************************************************
         SPACE 1
RESETCNV EQU   *
         MVI   CONVSTAT,CONVOPEN       Mark entry as available
         SPACE 3
SEXTRETN EQU   *
         WTO   'EXITING SEND RPL EXIT ROUTINE           ',ROUTCDE=(1)
         L     R13,4(0,R13)            reload
         LM    R14,R12,12(R13)           registers
         BR    R14                     branch to VTAM
         DROP  R8,R9,R10,R12
         LTORG
         EJECT
**********************************************************************
*                                                                    *
*        Conversation table                                          *
*                                                                    *
**********************************************************************
CONVTBL  DS    0D
         AIF   ('&SIDE' EQ 'LEFT ').LCONV
JAIME    DC    (CONVLEN)XL1'00'
         ORG   JAIME
         DC    CL8'JAIME   '
         ORG
TIMOTHY  DC    (CONVLEN)XL1'00'
         ORG   TIMOTHY
         DC    CL8'TIMOTHY '
         ORG
         AGO   .ECONV
.LCONV   ANOP
JEFFERY  DC    (CONVLEN)XL1'00'
         ORG   JEFFERY
         DC    CL8'JEFFERY '
         ORG
KIMBERLY DC    (CONVLEN)XL1'00'
         ORG   KIMBERLY
         DC    CL8'KIMBERLY'
         ORG
.ECONV   ANOP
         EJECT
**********************************************************************
*                                                                    *
*        Conversation Entry Layout                                   *
*                                                                    *
**********************************************************************
CONVTBLD DSECT
CONVNAME DS    CL8                     Transaction program, name of me
CONVSTAT DS    XL1
CONVOPEN EQU   X'00'                   Conversation entry open
CONVACT  EQU   X'80'                   Conversation active
         DS    XL7                     Unused
CONVSA   DS    18F                     Save area for RPL exits
CONVCA   DS    18F                     Save area for CALL routines
CONVRPL  DS    XL112                   RPL
CONVRPL6 DS    XL112                   RPL6
CONVWECB DS    F
CONVAREA DS    0XL52                   AREA
CONVLL   DS    XL2
CONVTXT  DS    XL50
CONVALEN EQU   L'CONVAREA
         DS    0F
CONVWTO  WTO   '                                                       X
                      ',ROUTCDE=(1),MF=L
CONVWTOR WTOR  '                                                       X
                      ',CONVTXT,L'CONVTXT,CONVWECB,MF=L
         DS    0D
CONVLEN  EQU   *-CONVTBLD
         EJECT
         IFGRPL AM=VTAM
         EJECT
         ISTFM5
         EJECT
         ISTSLCNS
SLCLEN   EQU    SLCEND-ISTSLCNS
         ISTUSFBC
         IFGACB AM=VTAM
         END

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014