大型机汇编(mainframe assembler/HLASM)之显示变量值('DISPLAY' in COBOL)

来源:互联网 发布:知春大厦兼职是真的吗 编辑:程序博客网 时间:2024/04/19 06:19
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.
MAIN     CSECT                           USING *,12                      STM   14,12,12(13)              LR    12,15                     ST    13,SAVE+4                 LA    13,SAVE          START    EQU   *                         WTO   MF=(E,WTOBLOCK)  EXIT     EQU   *                         L     13,SAVE+4                 LM    14,12,12(13)              LA    15,0                      BR    14               WTOBLOCK DC    Y(L'DEF+4,0)     DEF      DC    C'HELLO WORLD'   SAVE     DS    18F                       END   MAIN            
please remember the contents will be displayed in the JESYSMSG data set.
有疑问请联系QQ349106216

原创粉丝点击