CSCI 360 | Spring 2014 |
For the final part of program 9, add three macros to the code that has previously been written. The macros will generate the code necessary for:
Once the macros have been written, replace all of the standard entry linkage, standard exit linkage, and calls to external statements with calling statements for the macros.
The first macro will generate the standard entry linkage for an external subroutine.
The prototype statement for the macro should be:
SENTRY &NAME,&SAVE
&NAME is a required positional parameter. It is the name of the external subroutine.
&SAVE is a required positional parameter. It is the name of the 18 fullword save area that will be used by the CSECT for saving the initial register values.
If either of the positional parameters is missing, the macro should cause a meaningful error message (MNOTE) to be generated, an assembly return code of 8 to be set, and no code for standard entry linkage should be generated.
If both positional parameters have been specified, the macro should 1) save the name of the register save area in a global character SET variable so that it can be used in the macro that generates the standard exit linkage and 2) generate the standard entry linkage for an external subroutine using the &NAME and &SAVE in the appropriate locations.
The second macro will generate the standard exit linkage for an external subroutine.
The prototype statement for the macro should be:
&LABEL SEXIT
&LABEL is optional. If the macro is called with a label, that label must appear on the first line of code generated by the macro or on a DS 0H statement that precedes the first line of standard exit linkage.
The macro should 1) generate the standard entry linkage for an external subroutine, including an LTORG statement, and 2) generate the 18 fullword save area.
The third macro will generate the code necessary to call an external subroutine.
The prototype statement for the macro should be:
&LABEL SCALL &RTNNAME,&PLIST
&LABEL is optional. If the macro is called with a label, that label must appear on the first line of code generated by the macro or on a DS 0H statement that precedes the first line of assembly code that is generated.
&RTNNAME is a required positional parameter. It is the name of the external subroutine that will be called.
&PLIST is an optional positional parameter. It is the name of parameter list that will be used by the external subroutine.
If &RTNNAME is missing, the macro should cause a meaningful error message (MNOTE) to be generated, an assembly return code of 8 to be set, and no code for calling an external subroutine should be generated.
If &PLIST is missing, the macro avoid generating the LA instruction that sets up register 1 with the address of the parameter list.
After all of the parameter checking, the macro should generate the assembly statements that are needed to call an external subroutine.
Here is the layout for the job. Note the addition of the PARM='MACRO=F' to the second line of JCL:
//KCidnumA JOB ,'Your Name',MSGCLASS=H //STEP1 EXEC PGM=ASSIST,PARM='MACRO=F' //STEPLIB DD DSN=KC02293.ASSIST.LOADLIB,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSIN DD * MACRO macro prototype statement macro model statement or other conditional assembly statement ... macro model statement or other conditional assembly statement MEND MACRO macro prototype statement macro model statement or other conditional assembly statement ... macro model statement or other conditional assembly statement MEND MACRO macro prototype statement macro model statement or other conditional assembly statement ... macro model statement or other conditional assembly statement MEND * * program 9 code goes here * /* //
Precede the code for each macro with a TITLE instruction that
resembles: TITLE 'Your Name, CSCI 360, Section ?, xxxx Macro'
,
where "Your Name" is replaced with your name, ? is replaced
by your section number, and "xxxx" is replaced by the name
of the macro.
Each macro must have a documentation box and line documentation. The documentation box should resemble:
.********************************************************************** .* Name: .* .* Function: .* .* Prototype: .* .* Symbolic Parameters: .* .* Error Conditions: .* .* Notes: .**********************************************************************
Notice that macro comments are used to create the documentation box. This means that the documentation box MUST be placed after the macro prototype statement.