There are 3 programs here, actually...the first one writes to whatever is designated on the SYSPRINT DD statement in the invoking JCL:
HELLOPRT START 0 IN THE BEGINNING... PRINT NOGEN SPARE US THE MACRO EXPANSIONS BEGIN SAVE (14,12) SAVE INPUT REGISTERS LR 12,15 WHERE ARE WE? USING HELLOPRT,12 RIGHT HERE ST 13,SAVE+4 SAVE OLD SAVE AREA ADDRESS LA 11,SAVE POINT TO NEW SAVE AREA ST 11,8(13) IN OLD SAVE AREA LR 13,11 MOVE SAVE AREA ADDRESS * * WRITE "HELLO, WORLD!" ON WHATEVER HAS BEEN SET UP AS SYSPRINT IN * THE INVOKING JCL (NO, UNIX DOESN'T HAVE A MONOPOLY ON DEVICE- * INDEPENDENT I/O!) * DOPUT EQU * PUT SYSPRINT,HELLOMSG WRITE THE MESSAGE B DOPUT FOREVER... * * THIS CODE WILL NEVER BE REACHED, BUT IS INCLUDED FOR COMPLETENESS * L 13,SAVE+4 GET OLD SAVE AREA BACK RETURN (14,12),RC=0 TO THE OPERATING SYSTEM * * FILE AND WORK AREA DEFINITIONS * SAVE DS 18F LOCAL SAVE AREA HELLOMSG DC C' HELLO, WORLD!' SYSPRINT DCB DSORG=PS,MACRF=PM,DDNAME=SYSPRINT, X RECFM=FA,LRECL=133,BLKSIZE=133 END BEGIN
The next is specifically for TSO, and will write the message to the user's TSO terminal:
HELLOTSO START 0 IN THE BEGINNING... * PRINT NOGEN SPARE US THE MACRO EXPANSIONS BEGIN SAVE (14,12) SAVE INPUT REGISTERS LR 12,15 WHERE ARE WE? USING TYPE,12 RIGHT HERE ST 13,SAVE+4 SAVE OLD SAVE AREA ADDRESS LA 11,SAVE POINT TO NEW SAVE AREA ST 11,8(13) IN OLD SAVE AREA LR 13,11 MOVE SAVE AREA ADDRESS * * WRITE 'HELLO, WORLD!' TO THE TSO SESSION * DOTPUT EQU * TPUT HELLOMSG,L'HELLOMSG,EDIT SEND THE LINE B DOTPUT AND DO IT AGAIN * * THIS CODE WILL NEVER BE REACHED, BUT IS INCLUDED FOR COMPLETENESS * EXIT L 13,SAVE+4 GET OLD SAVE AREA BACK RETURN (14,12),RC=(15) QUIT * * FILE AND WORK AREA DEFINITIONS * SAVE DS 18F LOCAL SAVE AREA HELLOMSG DC C'HELLO, WORLD!' END BEGIN
Finally, a version that will send the greeting to the system console. Do not try this at home, kids, unmodified; flooding the system console is a Bad Idea...
HELLOWTO START 0 IN THE BEGINNING... PRINT NOGEN SPARE US THE MACRO EXPANSIONS BEGIN SAVE (14,12) SAVE INPUT REGISTERS LR 12,15 WHERE ARE WE? USING HELLOWTO,12 RIGHT HERE ST 13,SAVE+4 SAVE OLD SAVE AREA ADDRESS LA 11,SAVE POINT TO NEW SAVE AREA ST 11,8(13) IN OLD SAVE AREA LR 13,11 MOVE SAVE AREA ADDRESS * * NOW, WRITE "HELLO WORLD!" TO THE CONSOLE * DOWTO EQU * WTO 'HELLO, WORLD!' WRITE THE MESSAGE * COMMENT THE NEXT LINE IF YOU DON'T WANT THE OPERATOR TO COME AFTER * YOU WITH AN AXE B DOWTO AND DO IT AGAIN * * WE'RE DONE, EXIT CLEANLY * L 13,SAVE+4 GET OLD SAVE AREA BACK RETURN (14,12),RC=0 TO THE OPERATING SYSTEM * * FILE AND WORK AREA DEFINITIONS * SAVE DS 18F LOCAL SAVE AREA END BEGIN
submitted by: jmaynard@admin5.hsc.uth.tmc.edu (Jay Maynard)