Write To Operator
Mainframe Assembler Coding Example
  Table of Contents  v-24.01.01 - asm4wto1.htm 
  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 Example
  Source Code for WTO Example
  Summary
  Software Agreement and Disclaimer
  Downloads and Links
  Current Server or Internet Access
  Internet Access Required
  Glossary of Terms
  Contact or Feedback
  Company Overview
The SimoTime Home Page 

Table of Contents Previous Section Next Section Introduction

This test case describes and demonstrates 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 on a Windows System with Micro Focus Enterprise Developer.

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


We have made a significant effort to ensure the documents and software technologies are correct and accurate. We reserve the right to make changes without notice at any time. The function delivered in this version is based upon the enhancement requests from a specific group of users. The intent is to provide changes as the need arises and in a timeframe that is dependent upon the availability of resources.

Copyright © 1987-2024
SimoTime Technologies and Services
All Rights Reserved

Table of Contents Previous Section Next Section Examples of Coding Techniques

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

Table of Contents Previous Section Next Section Display a Simple Text String

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.

Table of Contents Previous Section Next Section The Execute Format of the WTO Macro

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

Table of Contents Previous Section Next Section WTO with User Defined Buffer

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...'

Table of Contents Previous Section Next Section Mainframe JCL for WTO Example

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
//* *******************************************************************
//*       ASMWTOJ1.JCL - a JCL Member for Batch Job Processing        *
//*       This JCL Member is provided by SimoTime Technologies        *
//*           (C) Copyright 1987-2022 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 Technologies
//* 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
//*

Table of Contents Previous Section Next Section Source Code for WTO Example

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

ASMWTOA1 CSECT
***********************************************************************
*             ASMWTOA1.MLC - This is an HLASM Program                 *
*                 Provided by SimoTime Technologies                   *
*           (C) Copyright 1987-2022 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...                 *
* Changed: 2022/03/04,
*                                                                     *
***********************************************************************
*                                                                     *
* This program will run on 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-2022 -- SIMOTIME Technologies-
                 -- 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

Table of Contents Previous Section Next Section Summary

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

In the world of programming there are many ways to solve a problem. This documentation and software were developed and tested on systems that are configured for a SIMOTIME environment based on the hardware, operating systems, user requirements and security requirements. Therefore, adjustments may be needed to execute the jobs and programs when transferred to a system of a different architecture or configuration.

SIMOTIME Services has experience in moving or sharing data or application processing across a variety of systems. For additional information about SIMOTIME Services or Technologies please contact us using the information in the  Contact or Feedback  section of this document.

Table of Contents Previous Section Next Section Software Agreement and Disclaimer

Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Technologies. Once the fee is received by SimoTime the latest version of the software, documentation or training material 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 Technologies.

SimoTime Technologies makes no warranty or representations about the suitability of the software, documentation or learning material for any purpose. It is provided "AS IS" without any expressed or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Technologies 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, documentation or training material.

Table of Contents Previous Section Next Section Downloads and Links

This section includes links to documents with additional information that are beyond the scope and purpose of this document. The first group of documents may be available from a local system or via an internet connection, the second group of documents will require an internet connection.

Note: A SimoTime License is required for the items to be made available on a local system or server.

Table of Contents Previous Section Next Section Current Server or Internet Access

The following links may be to the current server or to the Internet.

Link to Internet   Link to Server   Explore the Assembler Connection for more examples of mainframe Assembler programming techniques and sample code.

Link to Internet   Link to Server   Explore the JCL Connection for more examples of JCL functionality with programming techniques and sample code.

Link to Internet   Link to Server   Explore an Extended List of Software Technologies that are available for review and evaluation. The software technologies (or 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.

Link to Internet   Link to Server   Explore The ASCII and EBCDIC Translation Tables. These tables are provided for individuals that need to better understand the bit structures and differences of the encoding formats.

Link to Internet   Link to Server   Explore The File Status Return Codes that are used to interpret the results of accessing VSAM data sets and/or QSAM files.

Table of Contents Previous Section Next Section Internet Access Required

The following links will require an internet connect.

This suite of programs and documentation is available to download for review and evaluation purposes. Other uses will require a SimoTime Software License. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

A good place to start is The SimoTime Home Page for access to white papers, program examples and product information. This link requires an Internet Connection

Explore The Micro Focus Web Site for more information about products (including Micro Focus COBOL) and services available from Micro Focus. This link requires an Internet Connection.

Table of Contents Previous Section Next Section Glossary of Terms

Link to Internet   Link to Server   Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.

Table of Contents Previous Section Next Section Contact or Feedback

This document was created and is maintained by SimoTime Technologies. If you have any questions, suggestions, comments or feedback please use the following contact information.

1. Send an e-mail to our helpdesk.
1.1. helpdesk@simotime.com.
2. Our telephone numbers are as follows.
2.1. 1 415 763-9430 office-helpdesk
2.2. 1 415 827-7045 mobile

 

We appreciate hearing from you.

Table of Contents Previous Section Next Section Company Overview

SimoTime Technologies was founded in 1987 and 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. Our customers include small businesses using Internet technologies to corporations using very large mainframe systems.

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. We specialize in preparing applications and the associated data that are currently residing on a single platform to be distributed across a variety of platforms.

Preparing the application programs will require the transfer of source members that will be compiled and deployed on the target platform. The data will need to be transferred between the systems and may need to be converted and validated at various stages within the process. SimoTime has the technology, services and experience to assist in the application and data management tasks involved with doing business in a multi-system environment.

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
Write To Operator with Mainframe Assembler Coding Examples
Copyright © 1987-2024
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com