|
The macro trace and dump (MHELP) facility is a useful means of
debugging macro definitions. MHELP can be used anywhere in the source
program or in macro definitions. MHELP is processed during macro
generation. It is dynamic; you can branch around the MHELP statements
by using AIF or AGO statements. Therefore, you can control its use
by symbolic parameters and SET symbols. MHELP options remain in effect
until superseded by another MHELP statement.
Figure 1 shows a sample program that
uses five functions of MHELP. The macro dumps and traces in the listing
are highlighted, for example 1A . Most
dumps refer to statement numbers. When you call a library macro, the
macro name is used instead of the statement number in the identification-sequence
field. To get the statement numbers, use the LIBMAC assembler option
or the COPY statement to copy the library definition into the source
program before the macro call.
- MHELP 1, Macro Call Trace
- Item 1A in Figure 1 shows
an outer macro call, 1B in Figure 1 an inner one. In each case, the amount
of information given is short. This trace is given after successful
entry into the macro; no dump is given if error conditions prevent
an entry.
- MHELP 2, Macro Branch Trace
- This trace provides a one-line trace for each AGO and true AIF
branch within a programmer macro. In any such branch, the "branched
from" statement number, the "branched to" statement number,
and the macro name are included, see example 2A in Figure 1. The branch trace facility is suspended
when library macros are expanded and MHELP 2 is in effect. To obtain
a macro branch trace for such a macro, use the LIBMAC assembler option
or insert a COPY "macro-name" statement in the source file at
some point before the MHELP 2 statement of interest.
- MHELP 4, Macro AIF Dump
- Items 4A , 4B , 1A , 4D ,
and 4E in Figure 1 are
examples of these dumps. Each dump includes a complete set of unsubscripted
SET symbols with values. This list covers all unsubscripted variable
symbols that appear in the same field of a SET statement in the macro
definition. Values of elements of dimensioned SET symbols are not
displayed.
- MHELP 8, Macro Exit Dump
- Items 8A and 8B in Figure 1 are examples of these dumps. This
option provides a dump of the same group of SET symbols as are included
in the macro AIF dump when an MEXIT or MEND is encountered.
Local
and global variable symbols are not displayed at any point unless
they appear in the current macro explicitly as SET symbols.
- MHELP 16, Macro Entry Dump
- This option provides a dump of the values of system variable symbols
and symbolic parameters at the time the macro is called.
If
there are k keyword parameters, they are
listed as KPARM0001 through KPARM000k in
order of appearance on the prototype statement.
If there are p positional
parameters, they are listed as PPARM0001 through PPARM000p in
order of appearance in the macro instruction.
Item 16A in Figure 1 has one keyword parameter (&OFFSET)
and one positional parameter. In both the prototype (statement 4)
and the macro instruction (statement 55), the positional parameter
appears in the first operand field, the keyword in the second. A
length appears between the NAME and VALUE fields. A length of NUL
indicates the corresponding item is empty.
Item 16B in Figure 1 shows an inner call containing zero
keywords and two positional parameters.
- MHELP 64, Macro Hex Dump
- This option, when used with the Macro AIF dump, the Macro Exit
dump, or the Macro Entry dump, dumps the parameter and SETC symbol
values in EBCDIC and hexadecimal formats.
The hexadecimal dump
precedes the EBCDIC dump, and dumps the full value of the symbol.
System parameters are not dumped in hexadecimal.
- MHELP 128, MHELP Suppression
- This option suppresses all the MHELP options that are active at
the time.
- MHELP Control on &SYSNDX
- The
maximum value of the &SYSNDX system variable can be controlled
by the MHELP instruction. The limit is set by specifying a number
in the operand of the MHELP instruction, that is not one of the MHELP
codes defined above, and is in the following number ranges:
- 256 to 65535
- Most numbers in the range 65792 to 9999999. Details for this
number range are described in the HLASM Language Reference.
When the &SYSNDX limit is reached,
message ASMA013S ACTR counter exceeded is issued,
and the assembler, in effect, ignores all further macro calls. Refer
to the HLASM Language Reference for
further information. Figure 1. Sample program using MHELP (part 1
of 8) PAGE 3
Active Usings: None
Loc Object Code Addr1 Addr2 Stmt Source Statement HLASM R6.0 2008/07/11 17.48
000000 00000 00000 1 csect 00246000
2 * copy lnsrch 00247000
3 macro 00248000
4 &name lnsrch &arg,&offset=stnumb-stchain 00249000
5 lclc &label 00250000
6 &label setc 'A&sysndx' Generate symbol 00251000
7 aif (t'&name eq 'O').skip 00252000
8 &label setc '&name' If MACRO call has label, use it 00253000
9 .skip anop instead of generated symbol 00254000
10 &label la 0,&offset Load reg. 0 00255000
11 schi &arg,0(1) Search 00256000
12 bc 1,&label If max reached, continue 00257000
13 mend 00258000
Figure 2. Sample program using MHELP (part 2 of 8) Page 4
Active Usings: None
Loc Object Code Addr1 Addr2 Stmt Source Statement HLASM R6.0 2008/07/11 17.48
15 * copy schi 00260000
16 macro 00261000
17 &nm schi &comp,&list 00262000
18 lcla &cnt 00263000
19 lclc &cmpadr 00264000
20 &cnt seta 1 00265000
21 &nm stm 1,15,4(13) 00266000
22 .test anop 00267000
23 &cmpadr setc '&cmpadr'.'&comp'(&cnt,1) 00268000
24 aif ('&comp'(&cnt,1) eq '(').lpar 00269000
25 &cnt seta &cnt+1 00270000
26 aif (&cnt lt k'&comp).test 00271000
27 .nolnth anop 00272000
28 la 3,&comp Comparand 00273000
29 ago .contin 00274000
30 .lpar aif ('&comp'(&cnt+1,1) eq ',').finish 00275000
31 &cnt seta &cnt+1 00276000
32 aif (&cnt lt k'&comp).lpar 00277000
33 ago .nolnth 00278000
34 .finish anop 00279000
35 &cmpadr setc '&cmpadr'.'&comp'(&cnt+2,k'&comp-&cnt) 00280000
36 la 3,&cmpadr Comparand sans length 00281000
37 .contin anop 00282000
38 la 1,&list List header 00283000
39 mvc &comp,0(0) Dummy move to get comp length 00284000
40 org *-6 Change MVC to MVI 00285000
41 dc x'92' MVI Opcode 00286000
42 org *+1 Preserve length as immed opnd 00287000
43 dc x'd000' Result is MVI 0(13),L 00288000
44 l 15,=v(schi) 00289000
45 balr 14,15 00290000
46 lm 1,15,4(13) 00291000
47 mexit 00292000
48 mend 00293000
Figure 3. Sample program using MHELP (part 3 of 8) Active Usings: None
Page 5
Loc Object Code Addr1 Addr2 Stmt Source Statement HLASM R6.0 2008/07/11 17.48
000000 00000 00048 50 test csect 00295000
000000 05C0 51 balr 12,0 00296000
R 00002 52 using *,12 00297000
54 mhelp b'11111' 00299000
55 lnsrch listline,offset=listline-listnext 00300000
1A ++//MHELP CALL TO MACRO LNSRCH DEPTH=001 SYSNDX=0000001 STMT=00055
16A //MHELP ENTRY TO LNSRCH MODEL STMT=00000 DEPTH=001 SYSNDX=0000001 KWCNT=001
////SYSTEM PARAMETERS:
//SYSVAR NAME LNTH VALUE (56 CHARS/LINE)
//SYSNDX 004 0001
//SYSECT 004 test
//SYSLOC 004 test
//SYSTIME 005 17.48
//SYSDATE 008 07/11/08
//SYSASM 020 HIGH LEVEL ASSEMBLER
//SYSVER 005 1.6.0
//SYSDATC 008 20080711
//SYSJOB 007 (NOJOB)
//SYSSTEP 008 (NOSTEP)
//SYSSTYP 005 CSECT
//SYSSTMT 008 00000056
//SYSCLOCK 026 2008-07-11 17:48:42.914829
//SYSNEST 001 1
//SYSSEQF 008 00300000
//SYSOPT_DBCS 001 0
//SYSOPT_OPTABLE 003 UNI
//SYSOPT_RENT 001 0
//SYSOPT_XOBJECT 001 0
//SYSTEM_ID 006 CMS 13
//SYSIN_DSN 020 ASMASAMP ASSEMBLE A1
//SYSIN_MEMBER NUL
//SYSIN_VOLUME 005 ADISK
//SYSLIB_DSN 020 ASMASAMP ASSEMBLE A1
//SYSLIB_MEMBER NUL
//SYSLIB_VOLUME 005 ADISK
//SYSPRINT_DSN 020 ASMASAMP LISTING A1
//SYSPRINT_MEMBER NUL
//SYSPRINT_VOLUME 005 ADISK
//SYSTERM_DSN NUL
//SYSTERM_MEMBER NUL
//SYSTERM_VOLUME NUL
//SYSPUNCH_DSN NUL
//SYSPUNCH_MEMBER NUL
//SYSPUNCH_VOLUME NUL
//SYSLIN_DSN 020 ASMASAMP TEXT A1
//SYSLIN_MEMBER NUL
//SYSLIN_VOLUME 005 ADISK
//SYSADATA_DSN NUL
//SYSADATA_MEMBER NUL
Figure 4. Sample program using MHELP (part 4 of 8) ++//MHELP BRANCH FROM STMT 00007 TO STMT 00009 IN MACRO LNSRCH
Active Usings: test+X'2',R12
Page 6
Loc Object Code Addr1 Addr2 Stmt Source Statement HLASM R6.0 2008/07/11 17.48
//SYSADATA_VOLUME NUL
//SYSPARM NUL
//SYSM_SEV 003 000
//SYSM_HSEV 003 000
////NAME; KEYWORD PARAMETERS; POSITIONAL PARAMETERS:
//PARAMETER LNTH VALUE (54 CHARS/LINE)
//NAME NUL
//KPARM0001 017 listline-listnext
//PPARM0001 008 listline
4A //MHELP AIF IN LNSRCH MODEL STMT=00007 DEPTH=001 SYSNDX=0000001 KWCNT=001
////SET SYMBOLS (SKIPPED NUMBERS MAY BE SEQUENCE SYMBOLS).//
//0001 LCLC LABEL LNTH= 005
// VAL=A0001
2A ++//MHELP BRANCH FROM STMT 00007 TO STMT 00009 IN MACRO LNSRCH
000002 4100 0002 00002 56+A0001 la 0,listline-listnext Load reg. 0 01-00010
1B ++//MHELP CALL TO MACRO SCHI DEPTH=002 SYSNDX=0000002 STMT=00011
16B //MHELP ENTRY TO SCHI MODEL STMT=00000 DEPTH=002 SYSNDX=0000002 KWCNT=000
////SYSTEM PARAMETERS:
//SYSVAR NAME LNTH VALUE (56 CHARS/LINE)
//SYSNDX 004 0002
//SYSECT 004 test
//SYSLOC 004 test
//SYSTIME 005 06.48
//SYSDATE 008 02/02/00
//SYSASM 020 HIGH LEVEL ASSEMBLER
//SYSVER 005 1.4.0
//SYSDATC 008 20000202
//SYSJOB 007 (NOJOB)
//SYSSTEP 008 (NOSTEP)
//SYSSTYP 005 CSECT
//SYSSTMT 008 00000058
//SYSCLOCK 026 2000-02-02 06:48:42.915979
//SYSNEST 001 2
//SYSSEQF 008 00300000
//SYSOPT_DBCS 001 0
//SYSOPT_OPTABLE 003 UNI
//SYSOPT_RENT 001 0
//SYSOPT_XOBJECT 001 0
//SYSTEM_ID 006 CMS 13
//SYSIN_DSN 020 ASMASAMP ASSEMBLE A1
//SYSIN_MEMBER NUL
//SYSIN_VOLUME 005 ADISK
//SYSLIB_DSN 020 ASMASAMP ASSEMBLE A1
//SYSLIB_MEMBER NUL
//SYSLIB_VOLUME 005 ADISK
//SYSPRINT_DSN 020 ASMASAMP LISTING A1
//SYSPRINT_MEMBER NUL
Figure 5. Sample program using MHELP (part 5 of 8) Active Usings: test+X'2',R12
Page 7
Loc Object Code Addr1 Addr2 Stmt Source Statement HLASM R6.0 2008/07/11 17.48
//SYSPRINT_VOLUME 005 ADISK
//SYSTERM_DSN NUL
//SYSTERM_MEMBER NUL
//SYSTERM_VOLUME NUL
//SYSPUNCH_DSN NUL
//SYSPUNCH_MEMBER NUL
//SYSPUNCH_VOLUME NUL
//SYSLIN_DSN 020 ASMASAMP TEXT A1
//SYSLIN_MEMBER NUL
//SYSLIN_VOLUME 005 ADISK
//SYSADATA_DSN NUL
//SYSADATA_MEMBER NUL
//SYSADATA_VOLUME NUL
//SYSPARM NUL
//SYSM_SEV 003 000
//SYSM_HSEV 003 000
////NAME; KEYWORD PARAMETERS; POSITIONAL PARAMETERS:
//PARAMETER LNTH VALUE (54 CHARS/LINE)
//NAME NUL
//PPARM0001 008 listline
//PPARM0002 004 0(1)
000006 901F D004 00004 58+ stm 1,15,4(13) 02-00021
4B //MHELP AIF IN SCHI MODEL STMT=00024 DEPTH=002 SYSNDX=0000002 KWCNT=000
////SET SYMBOLS (SKIPPED NUMBERS MAY BE SEQUENCE SYMBOLS).//
//0001 LCLA CNT VAL= 0000000001
//0002 LCLC CMPADR LNTH= 001
// VAL=l
4C //MHELP AIF IN SCHI MODEL STMT=00026 DEPTH=002 SYSNDX=0000002 KWCNT=000
////SET SYMBOLS (SKIPPED NUMBERS MAY BE SEQUENCE SYMBOLS).//
//0001 LCLA CNT VAL= 0000000002
//0002 LCLC CMPADR LNTH= 001
// VAL=l
++//MHELP BRANCH FROM STMT 00026 TO STMT 00022 IN MACRO SCHI
4E //MHELP AIF IN SCHI MODEL STMT=00024 DEPTH=002 SYSNDX=0000002 KWCNT=000
////SET SYMBOLS (SKIPPED NUMBERS MAY BE SEQUENCE SYMBOLS).//
//0001 LCLA CNT VAL= 0000000002
//0002 LCLC CMPADR LNTH= 002
// VAL=li
4E //MHELP AIF IN SCHI MODEL STMT=00026 DEPTH=002 SYSNDX=0000002 KWCNT=000
////SET SYMBOLS (SKIPPED NUMBERS MAY BE SEQUENCE SYMBOLS).//
//0001 LCLA CNT VAL= 0000000003
//0002 LCLC CMPADR LNTH= 002
// VAL=li
Figure 6. Sample program using MHELP (part 6 of 8) Page 8
Active Usings: test+X'2',R12
Loc Object Code Addr1 Addr2 Stmt Source Statement HLASM R6.0 2008/07/11 17.48
++//MHELP BRANCH FROM STMT 00026 TO STMT 00022 IN MACRO SCHI
//MHELP AIF IN SCHI MODEL STMT=00024 DEPTH=002 SYSNDX=0000002 KWCNT=000
////SET SYMBOLS (SKIPPED NUMBERS MAY BE SEQUENCE SYMBOLS).//
//0001 LCLA CNT VAL= 0000000003
//0002 LCLC CMPADR LNTH= 003
// VAL=lis
//MHELP AIF IN SCHI MODEL STMT=00026 DEPTH=002 SYSNDX=0000002 KWCNT=000
////SET SYMBOLS (SKIPPED NUMBERS MAY BE SEQUENCE SYMBOLS).//
//0001 LCLA CNT VAL= 0000000004
//0002 LCLC CMPADR LNTH= 003
// VAL=lis
++//MHELP BRANCH FROM STMT 00026 TO STMT 00022 IN MACRO SCHI
//MHELP AIF IN SCHI MODEL STMT=00024 DEPTH=002 SYSNDX=0000002 KWCNT=000
////SET SYMBOLS (SKIPPED NUMBERS MAY BE SEQUENCE SYMBOLS).//
//0001 LCLA CNT VAL= 0000000004
//0002 LCLC CMPADR LNTH= 004
// VAL=list
//MHELP AIF IN SCHI MODEL STMT=00026 DEPTH=002 SYSNDX=0000002 KWCNT=000
////SET SYMBOLS (SKIPPED NUMBERS MAY BE SEQUENCE SYMBOLS).//
//0001 LCLA CNT VAL= 0000000005
//0002 LCLC CMPADR LNTH= 004
// VAL=list
++//MHELP BRANCH FROM STMT 00026 TO STMT 00022 IN MACRO SCHI
//MHELP AIF IN SCHI MODEL STMT=00024 DEPTH=002 SYSNDX=0000002 KWCNT=000
////SET SYMBOLS (SKIPPED NUMBERS MAY BE SEQUENCE SYMBOLS).//
//0001 LCLA CNT VAL= 0000000005
//0002 LCLC CMPADR LNTH= 005
// VAL=listl
//MHELP AIF IN SCHI MODEL STMT=00026 DEPTH=002 SYSNDX=0000002 KWCNT=000
////SET SYMBOLS (SKIPPED NUMBERS MAY BE SEQUENCE SYMBOLS).//
//0001 LCLA CNT VAL= 0000000006
//0002 LCLC CMPADR LNTH= 005
// VAL=listl
++//MHELP BRANCH FROM STMT 00026 TO STMT 00022 IN MACRO SCHI
//MHELP AIF IN SCHI MODEL STMT=00024 DEPTH=002 SYSNDX=0000002 KWCNT=000
Figure 7. Sample program using MHELP (part 7 of 8) Page 9
Active Usings: test+X'2',R12
Loc Object Code Addr1 Addr2 Stmt Source Statement HLASM R6.0 2008/07/11 17.48
////SET SYMBOLS (SKIPPED NUMBERS MAY BE SEQUENCE SYMBOLS).//
//0001 LCLA CNT VAL= 0000000006
//0002 LCLC CMPADR LNTH= 006
// VAL=listli
//MHELP AIF IN SCHI MODEL STMT=00026 DEPTH=002 SYSNDX=0000002 KWCNT=000
////SET SYMBOLS (SKIPPED NUMBERS MAY BE SEQUENCE SYMBOLS).//
//0001 LCLA CNT VAL= 0000000007
//0002 LCLC CMPADR LNTH= 006
// VAL=listli
++//MHELP BRANCH FROM STMT 00026 TO STMT 00022 IN MACRO SCHI
//MHELP AIF IN SCHI MODEL STMT=00024 DEPTH=002 SYSNDX=0000002 KWCNT=000
////SET SYMBOLS (SKIPPED NUMBERS MAY BE SEQUENCE SYMBOLS).//
//0001 LCLA CNT VAL= 0000000007
//0002 LCLC CMPADR LNTH= 007
// VAL=listlin
//MHELP AIF IN SCHI MODEL STMT=00026 DEPTH=002 SYSNDX=0000002 KWCNT=000
////SET SYMBOLS (SKIPPED NUMBERS MAY BE SEQUENCE SYMBOLS).//
//0001 LCLA CNT VAL= 0000000008
//0002 LCLC CMPADR LNTH= 007
// VAL=listlin
00000A 4130 C024 00026 59+ la 3,listline Comparand 02-00028
++//MHELP BRANCH FROM STMT 00029 TO STMT 00037 IN MACRO SCHI
00000E 4111 0000 00000 60+ la 1,0(1) List header 02-00038
000012 D202 C024 0000 00026 00000 61+ mvc listline,0(0) Dummy move to get comp length 02-00039
000018 00018 00012 62+ org *-6 Change MVC to MVI 02-00040
000012 92 63+ dc x'92' MVI Opcode 02-00041
000013 00013 00014 64+ org *+1 Preserve length as immed opnd 02-00042
000014 D000 65+ dc x'd000' Result is MVI 0(13),L 02-00043
000016 58F0 C02E 00030 66+ l 15,=v(schi) 02-00044
00001A 05EF 67+ balr 14,15 02-00045
00001C 981F D004 00004 68+ lm 1,15,4(13) 02-00046
8A //MHELP EXIT FROM SCHI MODEL STMT=00047 DEPTH=002 SYSNDX=0000002 KWCNT=000
////SET SYMBOLS (SKIPPED NUMBERS MAY BE SEQUENCE SYMBOLS).//
//0001 LCLA CNT VAL= 0000000008
//0002 LCLC CMPADR LNTH= 007
// VAL=listlin
000020 4710 C000 00002 69+ bc 1,A0001 If max reached, continue 01-00012
8B //MHELP EXIT FROM LNSRCH MODEL STMT=00013 DEPTH=001 SYSNDX=0000001 KWCNT=001
////SET SYMBOLS (SKIPPED NUMBERS MAY BE SEQUENCE SYMBOLS).//
//0001 LCLC LABEL LNTH= 005
// VAL=A0001
⋮
Page 10
Active Usings: test+X'2',R12
Loc Object Code Addr1 Addr2 Stmt Source Statement HLASM R6.0 2008/07/11 17.48
000024 70 listnext ds h 00301000
000026 71 listline ds fl3'0' 00302000
000030 72 ltorg 00303000
000030 00000000 73 =v(schi)
⋮
Figure 8. Sample program using MHELP (part 8 of 8) New Floating-point Constants included for Verification Page 11
Active Usings: test+X'2',R12
Loc Object Code Addr1 Addr2 Stmt Source Statement HLASM R6.0 2008/07/11 17.48
75 ********************************************************************** 00305000
76 * New FP definitions included to verify correct release of HLASM * 00306000
77 ********************************************************************** 00307000
000034 00000000
000038 4093480000000000 78 BFP1 DC DB'1234' 00308000
000040 434D200000000000 79 HFP1 DC DH'1234' 00309000
000000 80 end test 00310000
|