Small Assembler Program
MACRO and COPY Files
  Table of Contents  v-24.01.01 - maccpy01.htm 
  Introduction
  The JCL Member
  The Mainline Assembler Program
  Macro and Copy Files
  Assembler Copy File (ASMREGS1)
  Assembler Macro File (MACCPYB1)
  Assembler Macro File (MACCPYB2)
  Compile the program
  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 document will focus on the use of macro and copy files in a High Level Assembler (HLASM) program. For the Micro Focus environment the physical location of the macro and copy files is defined in a configuration file.

This is a very simple example of a mainframe assembler program that uses one copy file and two macro files. The copy file is stored in a user copy library. The macro files are stored in a user macro library. However, the second macro file is categorized as a copy file.

The assembler program is written in IBM Mainframe Assembler, it will compile using Assembler/H or HLASM. A JCL member is provided to run the job as an MVS batch job on an IBM mainframe or as a project with Micro Focus Mainframe Express (MFE) running on a Windows System.

This program may serve as a tutorial for programmers that are new to 370 Assembler and 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-2025
SimoTime Technologies and Services
All Rights Reserved

Table of Contents Previous Section Next Section The JCL Member

The following is the mainframe JCL (MACCPYJ1.jcl) required to run the assembler program. The JOB statement will need to be modified for specific mainframe environments. This will also run on a Windows System using Mainframe Express provided by Micro Focus.

//MACCPYJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=O,NOTIFY=LRSP1
//* *******************************************************************
//*       MACCPYJ1.JCL - a JCL Member for Batch Job Processing        *
//*       This JCL Member is provided by SimoTime Technologies        *
//*           (C) Copyright 1987-2019 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - 370 Assembler, Return to Caller with Zero Return Code
//* Author - SimoTime Technologies
//* Date   - January 01, 1997
//*
//* *******************************************************************
//* Step   1 of 1  This is a single step job.
//*
//ASMWTOS1 EXEC PGM=MACCPYA1
//STEPLIB  DD  DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR
//*

Table of Contents Previous Section Next Section The Mainline Assembler Program

The primary objective of this program is not in the execution process but in the compile process. Since the reference to the second macro (ASMMACB2.cpy) is stored as a copy file the Micro Focus Assembler must be configured to handle multiple extensions for macro files.

During execution this program (MACCPYA1.mlc) abides by the mainframe calling protocol and register usage guidelines. Register-15 is used to pass a return-code and register-14 contains the return address for the calling program. This program simply does a subtract of Register-15 from itself (i.e. setting the value to zero) and then does an unconditional branch to the address specified in Register-14.

***********************************************************************
*             MACCPYA1.MLC - This is an HLASM Program                 *
*                 Provided by SimoTime Technologies                   *
*           (C) Copyright 1987-2019 All Rights Reserved               *
*             Web Site URL:   http://www.simotime.com                 *
*                   e-mail:   helpdesk@simotime.com                   *
***********************************************************************
*                                                                     *
* Created: 1974/06/01, Simmons                                        *
* Changed: 1974/06/01, Simmons, no changes to date...                 *
*                                                                     *
***********************************************************************
*
MACCPYA1 CSECT
*
* Step 1, Process a Copy File
         COPY  ASMREGS1
*
* Step 2, Process a Macro File
         MACCPYB1
*
* Step 3, Process a Macro File that was saved as a Copy File
         MACCPYB2
*
* Step 4, Set the Return code to ZERO and Return to Caller.
         SR    15,15                 * Set Return Code to Zero
         BR    14                    * Return to Caller
         END

Table of Contents Previous Section Next Section Macro and Copy Files

The following is a description of the copy and macro files used in this example.

Table of Contents Previous Section Next Section Assembler Copy File (ASMREGS1)

The following member (ASMREGS1.cpy) is the Assembler Copy File that defines the register equates.

***********************************************************************
*             ASMREGS1.CPY - This is an HLASM Copy File               *
*                 Provided by SimoTime Technologies                   *
*           (C) Copyright 1987-2019 All Rights Reserved               *
*             Web Site URL:   http://www.simotime.com                 *
*                   e-mail:   helpdesk@simotime.com                   *
***********************************************************************
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
*

Table of Contents Previous Section Next Section Assembler Macro File (MACCPYB1)

The following member (MACCPYB1.mac) is a user-defined Macro File that inserts a comment into the main program.

         MACRO
         MACCPYB1
.**********************************************************************
.*              MACCPYB1.MAC - This is an HLASM Macro                 *
.*                 Provided by SimoTime Technologies                  *
.*           (C) Copyright 1987-2019 All Rights Reserved              *
.*             Web Site URL:   http://www.simotime.com                *
.*                   e-mail:   helpdesk@simotime.com                  *
.**********************************************************************
.*
*
***********************************************************************
* Comment line from ASMTSTB1.MAC, a normal Macro File...
.*
         MEND

Table of Contents Previous Section Next Section Assembler Macro File (MACCPYB2)

The following member (MACCPYB2.cpy) is a user-defined Macro File that inserts a comment into the main program.

         MACRO
         MACCPYB2
.**********************************************************************
.*              MACCPYB2.cpy - This is an HLASM Macro                 *
.*                 Provided by SimoTime Technologies                  *
.*           (C) Copyright 1987-2019 All Rights Reserved              *
.*             Web Site URL:   http://www.simotime.com                *
.*                   e-mail:   helpdesk@simotime.com                  *
.**********************************************************************
.*
*
***********************************************************************
* Comment line from ASMTSTB2.CPY, a  Macro File saved as a Copy File.
*
* Note: The MF370CHK program (Assembler Compiler for Micro Focus) will
*       need to SET MACROEXT=CPY,MAC in order to process this file as
*       a MACRO file.
.*
         MEND

Note:  The unusual thing about this used-defined Macro File is that it is categorized as a copy file and has a .cpy extension appended to the file name.

Table of Contents Previous Section Next Section Compile the program

Since this example contains a macro file that is categorized as a copy file the Micro Focus environment variable must be set in order for the compiler to look for multiple extensions for macro files (the default is to look for files with a .mac extension). The following statement is an example that may be used to set the environment variable.

SET MACROEXT=CPY,MAC

The environment variable may be set in the MF370CTL.CFG file that is provided by Micro Focus.

The following(ASMMFCTL.cfg) is an example of a MF370CTL.cfg file that is provided by Micro Focus. This example contains some typical "user" modifications. It has been renamed to avoid accidently overlaying the original MF370CTL.cfg file.

* *********************************************************************
*  ASMMFCTL.cfg - a Configuration File is for Micro Focus Assembler   *
*       This CFG Member is provided by SimoTime Technologies          *
*           (C) Copyright 1987-2015 All Rights Reserved               *
*             Web Site URL:   http://www.simotime.com                 *
*                   e-mail:   helpdesk@simotime.com                   *
* *********************************************************************
*
*  A copy of an MF370CTL.cfg Configuration File.
*  The parameters specified with the equal sign (=) may be submitted
*  as environment variables. Anything set as an environment variable
*  will overwrite the setting in this file.
*
*----------------------------------------------------------------------
[GLOBAL]
* GLOBAL-FLAGS:
* Flag-01  Y=32bit and Windows call SVC remapping N=don't call
* Flag-02, Y=Convert draw, graphics, color attributes, N=don't convert
* Flag-03, Y=use old MAC370, SYSPARM, OBJ370, WRK370 variables
*          N=use new Global section SYSIN, SYSOUT, SYSLIST etc
* Flag-04, Y=use Advanced emulator version of MFASM
* Flag-05, Y=user offered choice of continue/cancel job on user abends
*          N=job cancelled on user abends
GLOBAL-FLAGS N1NYNNNNNN
*         HORZ   ;WE-S   ;WE-N   ;VERT   ;SE     ;SW     ;NE     ;NW     ;NS-E   ;NS-W   ;PLUS
DRAW370-1 196=045;194=045;193=045;179=124;218=047;191=092;192=092;217=047;195=124;180=124;197=043
*
*----------------------------------------------------------------------
* The following environment variables take a single directory:
* SYSIN - Macro input .MLC files
SYSIN=.
*
* SYSLIST  - Assemble and Link listing files .MAT .PRN .LST
SYSLIST=.
* SYSWORK  - Assemble, Link and Animator/370 work files .BAL .IDF/.IDX
SYSWORK=.
* SYSPUNCH - Assemble output .PCH files for PUNCH statements
SYSPUNCH=.
* SYSMPC   - Assemble input precompiled macros .MPC
SYSMPC=.
* SYSLIN   - Link input .LIN files and Assemble output .OBJ files
SYSLIN=.
* SYSLMOD  - Link output load-member .390 files
SYSLMOD=.
*
* The following environment variables take multiple directories
* SYSLIB   - Assemble input macro and copy files .MAC .CPY
SYSLIB=.;C:\Program Files (x86)\Micro Focus\Enterprise Developer\include
MAC370=.;C:\Program Files (x86)\Micro Focus\Enterprise Developer\include
* OBJ370   - Link input .OBJ files (must contain SYSLIN)
OBJ370=.;C:\Program Files (x86)\Micro Focus\Studio Enterprise Edition 6.0\base\lib
* STEPLIB  - Loader input load-members .390 files (must contain SYSLMOD)
STEPLIB=.;C:\Program Files (x86)\Micro Focus\Studio Enterprise Edition 6.0\base\bin
*
* The following environment variable takes a single parameter
* SYSPARM  - Macro input SYSPARM value
SYSPARM=MF370
*
* The following environment variable allows the use of additional
* extensions for MACRO filename.ext
MACROEXT=CPY,MAC
*
*----------------------------------------------------------------------
* ANIM-FLAGS:
* Flag-01, Y=reset GO-mode to STEP-mode for each new member, N=No-reset
* Flag-02, 0-9, Default value for Go-Speed
* Flag-03, through Flag-09, reserved for future use
* Flag-10, Micro Focus use only, A=Anim/MVS, N=Noanim/MVS, T=TRanim/MVS
ANIM-FLAGS Y5YYNYNNNN
*
*----------------------------------------------------------------------
* CICS TRANSLATOR VARIABLES
* CICSRUN-FLAGS:
* Flag-01, Y=Null addresses from CICS are =x'FF000000'
*          N=Null addresses from CICS are =x'00000000'
CICSRUN-FLAGS NNNNNNNNNN
MCO-CMD-IN EPILOG PROLOG OPTIONS       ; default CICS Translator params
*
*----------------------------------------------------------------------
* COMPILER VARIABLES
SET-CMD-IN REPLACE ANIMATE OMF(390)    ; default Compiler params
CON370=-L                              ; set screen display off in Linker
*
*----------------------------------------------------------------------
* RUN TIME VARIABLES
MFPM=ON                   ; mainframe pointer manager is on by default
SVC370=MFI                ; set engine to MFI-mode
MEMSIZE=00000000,7FFFFFFF ; set valid address range
*
* THE FOLLOWING RUN TIME VARIABLES ARE OVERRIDDEN BY THE SETTINGS IN
* THE MAINFRAME EXPRESS IDE PROJECT, PROJECT OPTIONS PULLDOWN.
VM370=3000                ; set SQA size to 3Meg
AMODE370=31               ; run in 31-bit mode

Table of Contents Previous Section Next Section Summary

This document focuses on the use of macro and copy files in a High Level Assembler (HLASM) program. For the Micro Focus environment the physical location of the macro and copy files is defined in a configuration file. 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 assembler 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 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 for download. 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
MACRO and COPY Files, Set Return Code to Zero and Return to Caller
Copyright © 1987-2025
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com