Problem as stated included AMODE=31 and reentrancy. Charles
-----Original Message----- From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of Tom Marchant Sent: Thursday, March 17, 2011 6:36 AM To: [email protected] Subject: Re: Why is WTO so much easier to use than better methods? (Was RE: Trouble Reading a Spanned File with an Assembler Program - Working Program) On Wed, 16 Mar 2011 19:29:35 -0700, Charles Mills wrote: >It would be an interesting exercise to write the simplest proper, reentrant, >RMODE=31 assembler program that output "Hello, world" to anything other than >the console. Apparently not so interesting, or you'd do it. >Anyone want to venture a guess on how many lines of code? >Fifty? Thirty? Can anyone do it in twenty? I can easily do it in to if I use the entry and exit macros that I normally use to establish reentrancy and return. Without them it seems to take 28. You could shave that to 27 by dispensing with the save area forward chain. HELLO CSECT STM 14,12,12(13) SAVE CALLER'S REGISTERS LR 11,15 SET OUR BASE REGISTER USING HELLO,11 GETMAIN RU,LV=WORKLEN,LOC=24 ST 13,4(,1) BACK CHAIN ST 1,8(,13) FORWARD CHAIN LR 13,1 LOAD MY SAVE AREA ADDRESS USING WORKAREA,13 MVC OPENLIST(MESSAGE-OLIST_M),OLIST_M OPEN (SYSPRINT,OUTPUT),MF=(E,OPENLIST) PUT SYSPRINT,MESSAGE CLOSE MF=(E,OPENLIST) LR 1,13 COPY MY SAVE AREA ADDRESS L 13,4(,13) POINT TO CALLER'S SAVE AREA FREEMAIN RU,A=(1),LV=WORKLEN LM 14,12,12(13) RESTORE CALLER'S REGISTERS SLR 15,15 BR 14 RETURN TO CALLER OLIST_M OPEN (DCB_M,OUTPUT),MF=L DCB_M DCB DSORG=PS,MACRF=PM,DDNAME=SYSPRINT,RECFM=FB,LRECL=80 MESSAGE DC CL80'STUPID "HELLO WORLD" MESSAGE' WORKAREA DSECT , DS 18F SAVE AREA OPENLIST OPEN (SYSPRINT,OUTPUT),MF=L SYSPRINT DCB DSORG=PS,MACRF=PM,DDNAME=SYSPRINT,RECFM=FB,LRECL=80 WORKLEN EQU *-WORKAREA END HELLO -- Tom Marchant ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html

