Page 5 of 5

Re: Mainframe Assembler Macro

PostPosted: Fri Dec 02, 2011 1:42 pm
by NicC
Just a note - WTO on PC/370 is somewhat different but check the documentation that comes with PC/370. Also note that PC/370 is for PCs and NOT mainframes. A good book for an intro to PC/370 is by Bill Qualls and can be found online.

Re: Mainframe Assembler Macro

PostPosted: Sun Dec 04, 2011 11:51 am
by deathwish73
Define a MOVE Macro that issues a warning when an implicit move is used. Recall that when a positional paramerter is not sepcified, a null condition results.


What I have so far on that:


Define a MOVE Macro that issues a warning when an implicit move is used. Recall that when a positional paramerter is not sepcified, a null condition results.


What I have so far on that:


MACRO

MOVE &FROM, &TO, &LENGTH


*NOTE: IF LENGTH IS NOT SPECIFIED, THEN A NULL VALUE RESULTS


AIF     ('&LENGTH' EQ ' '.NOLENGTH

MVC  &TO,(&LENGTH),&FROM

AGO  .OUT


*IMPLICIT MOVE ROUTINE


.NOLENGTH ANOP
                      MVC &TO,&FROM

.OUT             ANOP

                      MEND



I need help in fixing the rest, I am confused on where to go, and what to edit

Re: Mainframe Assembler Macro

PostPosted: Sun Dec 04, 2011 3:39 pm
by enrico-sorichetti
what about having a look at the manuals ...

V1R6 Programmer's Guide
http://publibz.boulder.ibm.com/cgi-bin/ ... 0714231437
V1R6 Language Reference
http://publibz.boulder.ibm.com/cgi-bin/ ... 0711003624

not the latest ones, but more than enough for PC/370 and z390 assembler simulators

Re: Mainframe Assembler Macro

PostPosted: Sun Dec 04, 2011 3:55 pm
by BillyBoyo
This thread is getting out of hand.

For new questions, please start a new thread. There are at least three in here, and it won't encourage assistance if people have to spend time wondering exactly how the bits hang together, when they actually don't....

Re: Mainframe Assembler Macro

PostPosted: Sun Dec 04, 2011 4:11 pm
by deathwish73
Enrico:

The links do not show any examples of how to define a MOVE Macro or anything really about macros. Can you edit the code which I had above?

Re: Mainframe Assembler Macro

PostPosted: Sun Dec 04, 2011 4:21 pm
by enrico-sorichetti
The links do not show any examples of how to define a MOVE Macro or anything really about macros. Can you edit the code which I had above?


the links given show what You should learn in order to get proficient in assembler.

NO I will not edit nor fix any code for You,
while it might help to win a contest or pass a test, it will not help to learn assembler. :geek:

Re: Mainframe Assembler Macro

PostPosted: Sun Dec 04, 2011 5:31 pm
by steve-myers
The TS keeps thinking we will do his homework for him. So far he has failed in this task. I keep wondering if he will get the message!

Re: Mainframe Assembler Macro

PostPosted: Sun Dec 04, 2011 7:37 pm
by steve-myers
There are multiple syntax errors.

The MACRO statement requires at least 1 blank before MACRO. The usual convention is to put MACRO in column 10.

There is no label on the prototype statement that should appear on the first statement in the expansion. I other words, it should be something like

&LABEL MOVE operands

There are no blanks to separate the operands in the prototype statement.

When testing for a null value in an AIF just specify '' (that's 2 single quotes, not a double quote), not ' '.

The syntax of the MVC instruction is incorrect.

I would use MVCL rather than MVC for this exercise, though the registers it uses would have to be saved and restored. The reason is there is no need to be concerned if a length is greater than 256 bytes.

If the length is not specified, and the implicit length of the target area is greater than the implicit length of the source area, I would specify an explicit fill character rather than the implicit binary 0s when using MVCL.

There are other syntax errors, which I won't bother to mention.

While the idea of AGO .OUT is perfectly OK, most macro writers would use MEXIT.

And that's enough for nuthin!

Re: Mainframe Assembler Macro

PostPosted: Mon Dec 05, 2011 12:50 am
by steve-myers
I'll give you a freebie, but not your MOVE macro. This shows some of the techniques you'll need. The intent of the macro is to store a code into a single byte of storage provided the code is greater than the code already there. The code can be specified directly or in a register.
         MACRO
&NAME    SETCODE &LOC,&RC
         AIF   ('&RC' NE '').TESTLOC
         MNOTE 8,'RETURN CODE REQUIRED!'
         MEXIT
.TESTLOC AIF   ('&LOC' NE '').XPAND
         MNOTE 8,'LOCATION REQUIRED!'
         MEXIT
.XPAND   AIF   ('&RC'(1,1) EQ '(').RFORM
&NAME    CLI   &LOC,&RC
         BNL   *+8
         MVI   &LOC,&RC
         MEXIT
.RFORM   ANOP
&NAME    CLM   &RC(1),B'0001',&LOC
         BNH   *+8
         STC   &RC(1),&LOC
         MEND
In the AIF at .XPAND, '&RC'(1,1) extracts a substring from &RC starting at position 1, for 1 byte. The &RC(1) in the CLM and STC instructions extracts the first element in a string of elements enclosed in parens, so that something like (15) becomes 15 when the macro expands. Just specifying &RC to generate (15) in the expansion is OK, too, but the usual convention is to use the &RC(1) method.

Re: Mainframe Assembler Macro

PostPosted: Mon Dec 05, 2011 11:34 am
by dick scherrer
And i believe the gift from Steve is a good place to stop this topic. . .

d