Mainframe Assembler Macro



High Level Assembler(HLASM) for MVS & VM & VSE

Re: Mainframe Assembler Macro

Postby NicC » Fri Dec 02, 2011 1:42 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2702
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Re: Mainframe Assembler Macro

 

Re: Mainframe Assembler Macro

Postby deathwish73 » Sun Dec 04, 2011 11:51 am

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
deathwish73
 
Posts: 17
Joined: Fri Nov 18, 2011 2:20 am
Has thanked: 0 time
Been thanked: 0 time

Re: Mainframe Assembler Macro

Postby enrico-sorichetti » Sun Dec 04, 2011 3:39 pm

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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2648
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 132 times

Re: Mainframe Assembler Macro

Postby BillyBoyo » Sun Dec 04, 2011 3:55 pm

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....
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Mainframe Assembler Macro

Postby deathwish73 » Sun Dec 04, 2011 4:11 pm

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?
deathwish73
 
Posts: 17
Joined: Fri Nov 18, 2011 2:20 am
Has thanked: 0 time
Been thanked: 0 time

Re: Mainframe Assembler Macro

Postby enrico-sorichetti » Sun Dec 04, 2011 4:21 pm

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:
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2648
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 132 times

Re: Mainframe Assembler Macro

Postby steve-myers » Sun Dec 04, 2011 5:31 pm

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!
steve-myers
Global moderator
 
Posts: 1887
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 198 times

Re: Mainframe Assembler Macro

Postby steve-myers » Sun Dec 04, 2011 7:37 pm

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!
steve-myers
Global moderator
 
Posts: 1887
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 198 times

Re: Mainframe Assembler Macro

Postby steve-myers » Mon Dec 05, 2011 12:50 am

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.
steve-myers
Global moderator
 
Posts: 1887
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 198 times

Re: Mainframe Assembler Macro

Postby dick scherrer » Mon Dec 05, 2011 11:34 am

And i believe the gift from Steve is a good place to stop this topic. . .

d
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Previous

Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post