Write To Operator
 Assembler Coding Examples
http://www.simotime.com
When technology complements business    Copyright © 1987-2010  SimoTime Enterprises  All Rights Reserved
  Table of Contents Version 10.03.20 
  Introduction
  Examples of Coding Techniques
 
  Display a Simple Text String
  The Execute Format of the WTO Macro
  WTO with User Defined Buffer
  Mainframe JCL for WTO Examples
  Assembler Source Code for WTO Examples
  Summary
 
  Software Agreement and Disclaimer
  Downloads and Links to Similar Pages
  Comments or Suggestions
  About SimoTime

Introduction
(Next) (Previous) (Table-of-Contents)

This sample program describes some of the various techniques used to display a message or text string on the display. The program is written in IBM Mainframe Assembler, it will compile using Assembler/H or HLASM . This program provides examples of some of the coding techniques used to display a message on the user console. It will run as an MVS batch job on an IBM mainframe or as a project with Micro Focus Mainframe Express (MFE) running on a PC with Windows.

This program may serve as a tutorial for programmers that are new to 370 assembler or as a reference for experienced programmers.

Examples of Coding Techniques
(Next) (Previous) (Table-of-Contents)

This section provides examples of specific coding techniques that use the Write-To-Operator or WTO macro.

Display a Simple Text String
(Next) (Previous) (Table-of-Contents)

The simple and easy format of the WTO macro will display a text string that is embedded between a pair of apostrophes.

***********************************************************************
* WTO with text as a literal enclosed in single quotes
*
         WTO   'ASMWTOA1 - Message Text, No Label...'
         LTR   R15,R15     IS REG-15 = ZERO...
         BNZ   ABEND4         IF NOT, ABEND...

The following statement shows the use of the WTO macro with a label name specified in position 1.

WTOLABEL WTO   'ASMWTOA1 - Message Text, with Label...'
         LTR   R15,R15     IS REG-15 = ZERO...
         BNZ   ABEND4         IF NOT, ABEND...

The preceding technique is commonly used to display a literal (or text string) to the terminal. Refer to the 370 assembler source member in the Assembler Source Code for WTO Examples section of this document.

The Execute Format of the WTO Macro
(Next) (Previous) (Table-of-Contents)

This section describes the use of the WTO macro with the EXECUTE format to display a message from a list or table of messages. The WTO list of messages is created using the LIST format as per the following coding example.

***********************************************************************
* WTO using the LIST function. The WTO buffer created by the LIST
* format may be used with a WTO using the EXECUTE format.
*
WTOLIST  EQU   *
LISTMSG1 WTO   'ASMWTOA1 - List Message One from WTOLIST...',MF=L
LISTMSG2 WTO   'ASMWTOA1 - List Message Two from WTOLIST...',MF=L

The following may be used to display a message from the list to the console. The first example shows how to use a label name to access and display a message from the list of messages.

***********************************************************************
* WTO using the EXECUTE format, WTO buffer created by the LIST format.
* The 1st WTO uses a label name, the 2nd WTO uses register notation.
*
         WTO   MF=(E,LISTMSG1)
         LTR   R15,R15     IS REG-15 = ZERO...
         BNZ   ABEND4         IF NOT, ABEND...

The following example shows how to use register notation to access and display a message from the list of messages.

         LA    R8,LISTMSG2
         WTO   MF=(E,(R8))
         LTR   R15,R15     IS REG-15 = ZERO...
         BNZ   ABEND4         IF NOT, ABEND...

WTO with User Defined Buffer
(Next) (Previous) (Table-of-Contents)

This example shows how to create a common routine that may be executed with a Branch-and-Link with a return via register-3. This WTO example will display the text that is in the user defined buffer. Prior to doing the Branch-and-Link the user moves the text to be displayed into the buffer.

         MVC   WTOTEXT(76),WTOMSG1
         BAL   R3,DOMSG              DISPLAY MESSAGE, RETURN VIA R3
         MVC   WTOTEXT(76),WTOMSG2
         BAL   R3,DOMSG              DISPLAY MESSAGE, RETURN VIA R3

The common routine to display a user message is as follows.

***********************************************************************
* Common WTO routine to display WTOBLOCK...
*
DOMSG    EQU   *
         WTO   MF=(E,WTOBLOCK)
         LTR   R15,R15     IS REG-15 = ZERO...
         BNZ   ABEND4         IF NOT, ABEND...
         BR    R3          Return via Register 3

The buffer used by the common routine is defined as follows.

***********************************************************************
* The following is an example of a user-coded WTO buffer.
*
         DS    0H            * INSURE HALF-WORD ALIGNMENT
WTOBLOCK EQU   *
         DC    H'80'         * For WTO, length of WTO buffer...
         DC    H'0'                     should be binary zeroes...
WTOTEXT  DC    CL76'ASMWTOA1 - WTO with user-coded buffer...'
*
WTOMSG1  DC    CL76'ASMWTOA1 - User message number one...'
WTOMSG2  DC    CL76'ASMWTOA1 - User message number two...'

Mainframe JCL for WTO Example
(Next) (Previous) (Table-of-Contents)

The following is a list of the JCL member (ASMWTOJ1.JCL) for the WTO examples to run as a job on the mainframe. This will also run on the PC using Mainframe Express provided by Micro Focus.

//ASMWTOJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=O,NOTIFY=LRSP1
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2010 All Rights Reserved             *
//*                                                                   *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - 370 Assembler, Write-To-Operator or WTO macro
//* Author - SimoTime Enterprises
//* Date   - January 01, 1997
//*
//* This 370 Assembler program provides different techniques for
//* using the Write-To-Operator (WTO) macro.
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express.
//*
//* Micro Focus Mainframe Express, version 2.5 or later (MFE) with
//* the Assembler Option should be used to Animate or visualize the
//* execution of the sample program.
//*
//* The Animator or Debugger is an excellent tool for visualizing the
//* execution of the individual instructions as they execute.
//*
//* This is a very effective way to become familiar with the 370
//* instruction set.
//*
//* *******************************************************************
//* Step   1 of 1  This is a single step job.
//*
//ASMWTOS1 EXEC PGM=ASMWTOA1
//STEPLIB  DD  DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR
//*

Assembler Source Code for WTO Example
(Next) (Previous) (Table-of-Contents)

The following is a list of the source member (ASMWTOA1.MLC) for the WTO examples.

ASMWTOA1 CSECT
***********************************************************************
*                    This program is provided by:                     *
*                     SimoTime Enterprises, LLC                       *
*            (C) Copyright 1987-2010 All Rights Reserved              *
*                                                                     *
*              Web Site URL:   http://www.simotime.com                *
*                    e-mail:   helpdesk@simotime.com                  *
***********************************************************************
*                                                                     *
* Created: 1993/06/01, Simmons                                        *
* Changed: 1993/06/01, Simmons, no changes to date...                 *
*                                                                     *
***********************************************************************
*                                                                     *
* This program will run an an IBM Mainframe using MVS or a PC using   *
* Micro Focus Mainframe Express, version 2.5 or later (MFE) with      *
* the Assembler Option.                                               *
*                                                                     *
* This program provides a sample of some of the coding techniques     *
* used by assembler programmers. You can immediately see the results  *
* of each instruction execution. This is a very effective way to      *
* become familiar with how these techniques work.                     *
*                                                                     *
* The purpose of this program is to test the various forms of the     *
* WTO (Write-To-Operator) macro.                                      *
*                                                                     *
***********************************************************************
*
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
*
***********************************************************************
         SAVE  (14,12)
         BALR  12,0
         USING *,12
*
***********************************************************************
* WTO to display the copyright information
*
         WTO   '* ASMWTOA1 An Example of using the WTO macro  v03.01.24-
                http://www.simotime.com'
         LTR   R15,R15     IS REG-15 = ZERO...
         BNZ   ABEND4         IF NOT, ABEND...
*
         WTO   '* ASMWTOA1 Copyright 1987-2010  SimoTime Enterprises, L-
               LC   All Rights Reserved'
         LTR   R15,R15     IS REG-15 = ZERO...
         BNZ   ABEND4         IF NOT, ABEND...
***********************************************************************
* WTO with text as a literal enclosed in single quotes
*
         WTO   '* ASMWTOA1 is STARTING, Hello Mainframe World...'
         LTR   R15,R15     IS REG-15 = ZERO...
         BNZ   ABEND4         IF NOT, ABEND...
*
         WTO   '* ASMWTOA1 Message Text, No Label...'
         LTR   R15,R15     IS REG-15 = ZERO...
         BNZ   ABEND4         IF NOT, ABEND...
*
WTOLABEL WTO   '* ASMWTOA1 Message Text, with Label...'
         LTR   R15,R15     IS REG-15 = ZERO...
         BNZ   ABEND4         IF NOT, ABEND...
*
*
***********************************************************************
* WTO using the EXECUTE format, WTO buffer created by the LIST format.
* The 1st WTO uses a label name, the 2nd WTO uses register notation.
*
         WTO   MF=(E,LISTMSG1)
         LTR   R15,R15     IS REG-15 = ZERO...
         BNZ   ABEND4         IF NOT, ABEND...
*
         LA    R8,LISTMSG2
         WTO   MF=(E,(R8))
         LTR   R15,R15     IS REG-15 = ZERO...
         BNZ   ABEND4         IF NOT, ABEND...
*
*
***********************************************************************
* WTO using the EXECUTE format with user-coded WTO buffer. This
* routine illustrates the use of a single WTO to display different
* messages.
*
         BAL   R3,DOMSG              DISPLAY MESSAGE, RETURN VIA R3
         MVC   WTOTEXT(76),WTOMSG1
         BAL   R3,DOMSG              DISPLAY MESSAGE, RETURN VIA R3
         MVC   WTOTEXT(76),WTOMSG2
         BAL   R3,DOMSG              DISPLAY MESSAGE, RETURN VIA R3
*
*
***********************************************************************
* WTO using the EXECUTE format with user-coded WTO buffer. This
* routine illustrates the use of a single WTO to display different
* messages. This will cause a length error with WTO execution.
*
         WTO   MF=(E,WTOCRASH)
         LTR   R15,R15     IS REG-15 = ZERO...
         BZ    ABEND4         THEN ABEND, SHOULD BE 4...
         B     EOJ
*
*
***********************************************************************
* Common WTO routine to display WTOBLOCK...
*
DOMSG    EQU   *
         WTO   MF=(E,WTOBLOCK)
         LTR   R15,R15     IS REG-15 = ZERO...
         BNZ   ABEND4         IF NOT, ABEND...
         BR    R3          Return via Register 3
***********************************************************************
* Return to caller
*
EOJ      EQU   *
         WTO   '* ASMWTOA1 is FINISHED...'
         RETURN (14,12),RC=0
***********************************************************************
* Abnormal termination of program
*
ABEND4   EQU   *
         WTO   '* ASMWTOA1 MLC, is ABENDING, RC=4...'
         RETURN (14,12),RC=4
*
***********************************************************************
* WTO using the LIST function. The WTO buffer created by the LIST
* format may be used with a WTO using the EXECUTE format.
*
WTOLIST  EQU   *
LISTMSG1 WTO   '* ASMWTOA1 List Message One from WTOLIST...',MF=L
LISTMSG2 WTO   '* ASMWTOA1 List Message Two from WTOLIST...',MF=L
*
*
***********************************************************************
* The following is an example of a user-coded WTO buffer.
*
         DS    0H            * INSURE HALF-WORD ALIGNMENT
WTOBLOCK EQU   *
         DC    H'80'         * For WTO, length of WTO buffer...
         DC    H'0'                     should be binary zeroes...
WTOTEXT  DC    CL76'* ASMWTOA1 WTO with user-coded buffer...'
*
WTOMSG1  DC    CL76'* ASMWTOA1 User message number one...'
WTOMSG2  DC    CL76'* ASMWTOA1 User message number two...'
*
*
***********************************************************************
* The following is an example of a user-coded WTO buffer that will
* cause an error conditions, length of text exceeds 251 bytes.
         DS    0H            * INSURE HALF-WORD ALIGNMENT
WTOCRASH EQU   *
         DC    H'512'        * For WTO, length of WTO buffer...
         DC    H'0'                     should be binary zeroes...
WTOCTEXT DC    CL76'* ASMWTOA1 WTO FOR CRASH TEST...'
*
         DC    436CL1'X'
*
         END

Summary
(Next) (Previous) (Table-of-Contents)

The purpose of this document is to assist as a tutorial for new assembler programmers or as a quick reference for experienced programmers. This example focuses on the various techniques used to display a message from the program to the user or system console. As always, it is the programmer's responsibility to thoroughly test all programs.

Software Agreement and Disclaimer
(Next) (Previous) (Table-of-Contents)

Permission to use, copy, modify and distribute this software for any commercial purpose requires a fee to be paid to Simotime Enterprises. Once the fee is received by SimoTime the latest version of the software will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Enterprises.

Permission to use, copy, modify and distribute this software for a non-commercial purpose and without fee is hereby granted, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Enterprises.

SimoTime Enterprises makes no warranty or representations about the suitability of the software for any purpose. It is provided "AS IS" without any express or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Enterprises shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software.

If you have any questions, suggestions or comments please call or send an e-mail to: helpdesk@simotime.com

Downloads and Links to Similar Pages
(Next) (Previous) (Table-of-Contents)

You may download this example at http://www.simotime.com/sim4dzip.htm#AsmWTO as a Z-Pack. The Z-Packs provide individual programming examples, documentation and test data files in a single package. The Z-Packs are usually in zip format to reduce the amount of time to download.

Please view the complete list of SimoTime Z-Pack Examples at http://www.simotime.com/sim4dzip.htm .

Note: You must be attached to the Internet to download a Z-Pack or view the list.

Check out   The Assembler Connection   for more examples of mainframe Assembler coding techniques and sample code.

Check out   The JCL Connection   for more mainframe JCL examples.

Check out   The SimoTime Library   for a wide range of topics for Programmers, Project Managers and Software Developers.

To review all the information available on this site start at   The SimoTime Home Page  .

Comments or Suggestions
(Next) (Previous) (Table-of-Contents)

If you have any questions, suggestions or comments please call or send an e-mail to: helpdesk@simotime.com

About SimoTime Enterprises
(Next) (Previous) (Table-of-Contents)

Founded in 1987, SimoTime Enterprises is a privately owned company. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. This includes the smallest thin client using the Internet and the very large mainframe systems. There is more to making the Internet work for your company's business than just having a nice looking WEB site. It is about combining the latest technologies and existing technologies with practical business experience. It's about the business of doing business and looking good in the process. Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems. Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com


Return-to-Top
Copyright © 1987-2010  SimoTime Enterprises  All Rights Reserved
When technology complements business
http://www.simotime.com