I am learning assembler. Could you please help me to understand how PUT works. I wrote the below program
SAVEAREA DS 18F
PRHEAD DC CL11'HELLO ASHIM'
PRTEST1 DC CL11'HELLO TEST1'
PRTEST2 DC CL11'HELLO TEST2'
PRINTER DCB DSORG=PS,MACRF=(PM),DEVD=DA,DDNAME=DDOUT,
When I am running this program the control is not returning back to OS. But if I just comment out the PUT instructions the control is coming back to OS. With the above code I am getting the below o/p from the run
Joined: 30 Nov 2013 Posts: 753 Location: The Universe
The PUT macro expects register 13 to point to the new save area your program has established. Your program does not set register 13 correctly so the PUT macro is destroying the save area initially provided by the system. That is why your program is failing.
Mr. Sample's comments about record length are absolutely correct.
You specify RECFM=FBM in your DCB macro, but you are not providing any carriage control. Just as a comment: "machine" carriage control is very tricky. "Machine" in this case refers to the CCW operation codes used in CCW instructions to print lines on line printers used in the 1960s and 1970s. Finding the codes any more is quite difficult. They are rarely used even by advanced Assembler programmers, even though their proper use can slightly improve printer performance compared to using ASA carriage control. Which brings to mind a war story from the 1980s where JES2 was doing some very funky things converting ASA carriage control to machine carriage control. Technically JES2 was 100% correct, but it was "printing" to a non IBM page printer whose vendor claimed correctly responded to 1403/3211 (those are printer models) commands. Well, the vendor lied, and they refused to correct the problem in their printer. While there are a couple of dozen CCW commands, most are never used.
Regardless, specify RECFM=FBA and supply correct ASA carriage control characters, or just specify RECFM=FB. In addition, as Mr. Sample mentioned, correct your line definitions. One other point; most of the 1960 era line printers printed a maximum line length of 132 characters, the carriage control character added an extra non printed character so LRECL=133 was common. You frequently see LRECL=121; some 1403 models only printed 120 character lines, so defensively coded programs just used this standard.
The topic "How do I coding assembly code for hex data calculate" has a complete (and correct) program that does some printing that might serve as a model for you.
If you insist on using "machine" carriage control, use X'09', the code for write and space 1.