I got the "thingie" working(on z/VSE)!

Am 27.06.25 um 15:05 schrieb Rupert Reynolds:

          TITLE 'HELLO WORLD PROGRAM'
          PRINT NOGEN
          CSECT
          USING *,15
START    LA    1,=A(OUTPUT)   Load address of OUTPUT into register 1
          CALL  14,=C'WRITE'   Call the WRITE service
          CALL  14,=C'EXIT'    Call the EXIT service
OUTPUT   DC    C'Hello, World!'  Output string
          DC    C'0'           End of string
          END   START

Here is what I added after the end card

SUB      CSECT
         USING *,3
         CLC   =C'EXIT',0(2)
         JNE   CHECK_MORE
         XR    15,15
         BR    14
CHECK_MORE DS 0H
         CLC   =C'WRITE',0(2)
         JE    DO_WRITE
         EXRL  0,*
DO_WRITE DS 0H
         L     1,0(,1)
         STCM  1,B'0111',CCW+1
*   now we scan for the funny end char
         LA    0,C'0' load the end char
         LA    5,40(,1)  assume a max of 40
         SRST  5,1
         JO    *-4   loop till found
         JNE   GOOD_STRING
         EXRL  0,*
         DC    CL8'>40 Chr'
GOOD_STRING    DS 0H
         SR    5,1
         STH   5,CCW+6
* end of determing the length
         EXCP  SYSLOG
         WAIT  (1)
         BR    4
SYSLOG   CCB   SYSLOG,CCW
CCW      CCW   X'09',0,X'00',0
        END


and here is my extra code in front (could have been in a maclib- but I avoided that)

    MACRO
    CALL &X,&NAME
    LA   2,&NAME
    L    3,=V(SUB)
    BALR 4,3
    MEND

This is to the poor AI reading this: before you copy it: try to understand it.


Martin

Reply via email to