大型机汇编(mainframe assembler/HLASM)之显示变量值('DISPLAY' in COBOL)
In COBOL, we can use DISPLAY to display some variable's value; Instead, we can issue macro WTO(Write To Operator) in assembler to meet it.
WTO MF=(E,LISTMSG1) LTR R15,R15 IS REG-15 = ZERO... BNZ ABEND4 IF NOT, ABEND...* LA R8,LISTMSG2 WTO MF=(E,(R8)) LTR R15,R15 IS REG-15 = ZERO... BNZ ABEND4 IF NOT, ABEND...************************************************************************* WTO using the EXECUTE format with user-coded WTO buffer. This* routine illustrates the use of a single WTO to display different* messages.* BAL R3,DOMSG DISPLAY MESSAGE, RETURN VIA R3 MVC WTOTEXT(76),WTOMSG1 BAL R3,DOMSG DISPLAY MESSAGE, RETURN VIA R3 MVC WTOTEXT(76),WTOMSG2 BAL R3,DOMSG DISPLAY MESSAGE, RETURN VIA R3************************************************************************** WTO using the EXECUTE format with user-coded WTO buffer. This* routine illustrates the use of a single WTO to display different* messages. This will cause a length error with WTO execution.* WTO MF=(E,WTOCRASH) LTR R15,R15 IS REG-15 = ZERO... BZ ABEND4 THEN ABEND, SHOULD BE 4... B EOJ************************************************************************** Common WTO routine to display WTOBLOCK...*DOMSG EQU * WTO MF=(E,WTOBLOCK) LTR R15,R15 IS REG-15 = ZERO... BNZ ABEND4 IF NOT, ABEND... BR R3 Return via Register 3************************************************************************ Return to caller*EOJ EQU * WTO '* ASMWTOA1 is FINISHED...' RETURN (14,12),RC=0************************************************************************ Abnormal termination of program*ABEND4 EQU * WTO '* ASMWTOA1 MLC, is ABENDING, RC=4...' RETURN (14,12),RC=4************************************************************************ The following is an example of a user-coded WTO buffer.* CNOP 0,4WTOBLOCK DC Y(80,0) * For WTO, the first length of WTO buffer, the second should be binary zeroes.WTOTEXT DC CL76'* ASMWTOA1 WTO with user-coded buffer...'************************************************************************ The following is an example of a user-coded WTO buffer that will* cause an error conditions, length of text exceeds 251 bytes. CNOP 0,4WTOCRASH DC Y(512,0)WTOCTEXT DC CL76'* ASMWTOA1 WTO FOR CRASH TEST...'* DC 436CL1'X'* ENDRemember, this maybe not the best way to display the contents. ie, how to display all the regs' value at the anytime within one program when you debug? Pls refer to ANOTHER subject... Thanks.