Skip to main content

Problem:

We need to have some batch work done in the background for setup of

Mainframe Express projects for our programmers. Part of this work involves

Assembler programs. Can we compile Assembler programs using a .BAT file?

Resolution:

Yes. Assembler programs can be prepared in batch for your Mainframe Express

projects. For example, the following Assembler program could be tested standalone

using this .BAT file:

   mfasm lorince.mlc animate list omf(390);

   set mvsout=Outdata.Dat

   run lorince.390

LORINCE  CSECT

LORINCE  AMODE 31

LORINCE  RMODE ANY

*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

*   Lorince: issues messages at start then halfway thru a loop        *

*            and then at the end of the loop                          *

*   To run from a MFE Command Prompt:                                 *

*    mfasm lorince.mlc animate list omf(390);                         *

*    set mvsout=Outdata.Dat                                           *

*    run lorince.390                                                  *

*                                                                     *

*   31-bit mode identified by comment:   * 31 mode                    *

*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

         STM   14,12,12(13)

* 31 mode changed  BALR 12,0 to BASR 12,0

*        BALR  12,0

         BASR  12,0

         USING *,12

         LA    10,SAVER

         ST    10,8(13)

         ST    13,4(10)

         LR    13,10

*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

* 31 mode changed  OPEN (OUTDCB,OUTPUT) to OPEN (OUTDCB,OUTPUT),MODE=31

*        OPEN  (OUTDCB,OUTPUT)

         OPEN  (OUTDCB,OUTPUT),MODE=31

         LA    5,9     Set counter to 9

         LA    6,5     Look for iteration 5

         MVC   MSG,OUT1

* PUT can use areas or registers

*        PUT   OUTDCB,OUTAREA

         LA    8,OUTAREA

         LA    9,OUTDCB

         PUT   (9),(8)

DO_IT    MVC   THAT,THIS

         CR    5,6

         BNE   GO_ON

         MVC   MSG,OUT2

* PUT can use areas or registers

*        PUT   OUTDCB,OUTAREA

         LA    8,OUTAREA

         LA    9,OUTDCB

         PUT   (9),(8)

GO_ON    BCTR  5,0

         LTR   5,5

         BNZ   DO_IT

         MVC   MSG,OUT3

* PUT can use areas or registers

*        PUT   OUTDCB,OUTAREA

         LA    8,OUTAREA

         LA    9,OUTDCB

         PUT   (9),(8)

         CLOSE OUTDCB

*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

XIT      L     13,4(13)

         L     14,12(13)

         SR    15,15

         LM    0,12,20(13)

* 31 mode changed  BR 14 to BSM 0,14

*        BR    14

         BSM   0,14

SYNADE01 DS    0D

         WTO   'I/O FAILED FOR LORINCE',ROUTCDE=11

         ABEND 444

ENDDATA  DS    0H

         WTO   'I/O CAUSED END OF DATA',ROUTCDE=11

         B     XIT

*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

*        DC's                                                         *

*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

         DS    0D

OUT1     DC    C'  Starting LORINCE'

OUT2     DC    C'   In LORINCE loop'

OUT3     DC    C'  Ending LORINCE  '

THIS     DC    C' Work '

THAT     DC    C' Hard '

OUTAREA  DS    0CL120

         DC    CL10' '

MSG      DC    CL20' '

         DC    CL90' '

*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

SAVER    DS    0D

         DC    72X'0'

*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

OUTDCB   DCB DSORG=PS,MACRF=(GM,PM),DDNAME=MVSOUT,                     X

               EODAD=ENDDATA,SYNAD=SYNADE01,                           X

               RECFM=FBA,LRECL=121,BLKSIZE=16093

*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

         LTORG

         END

This sample contains no user macros, so one does not need to set MAC370 to point

to any specific directories such as:

   set mac370=h:\\user1\\mfasm\\includes;d:\\user1\\mymacs

This environment variable is documented in the MF370CTL.CFG file found in

MFUSER\\CONFIG. Notice that the MAC370 environment variable can define

multiple directories while the SYSIN environment variable can only use a

single directory.

If you have a program that is to be used by your application, then run the

MFASM command from that project's LOADLIB directory so the Assembler

executable is found. For example:

   mfasm c:\\appdir\\user1\\asmsource\\lorince.mlc animate list omf(390);

And if you do not want the Assembler to be animated (debuggable), then use:

   mfasm c:\\appdir\\user1\\asmsource\\lorince.mlc list omf(390);

omitting the 'animate' Micro Focus Assembler directive.

Old KB# 2639

#EnterpriseDeveloper
#MFDS