IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need Help on the understanding of the PUT Macro


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ashim prodhan

New User


Joined: 28 Apr 2013
Posts: 7
Location: india

PostPosted: Mon Feb 17, 2014 7:55 pm
Reply with quote

Hello,

I am learning assembler. Could you please help me to understand how PUT works. I wrote the below program

Code:
BALPOC   CSECT                   
         STM    R14,R12,12(R13)   
         BALR   R12,0             
         USING  *,R12             
         LA     R2,SAVEAREA       
         ST     R2,8(,R13)       
         LR     R2,R13           
         ST     R2,SAVEAREA+4     
                                 
         OPEN (PRINTER,OUTPUT)   
         PUT  PRINTER,PRHEAD     
         PUT  PRINTER,PRTEST1     
         PUT  PRINTER,PRTEST2     
         CLOSE PRINTER           
         L     R13,SAVEAREA+4     
         LM    R14,R12,12(R13)   
         LA    R15,0             
         BR    R14               
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,
               RECFM=FBM,LRECL=80                       
         END   BALPOC



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

HELLO ASHIMHELLO TEST1HELLO TEST2
HELLO TEST1HELLO TEST2
HELLO TEST2

Would like to know why it is writing in the same line. Any help on this would be much appreciated. Thank You!
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Feb 17, 2014 9:15 pm
Reply with quote

A print line is usually 133 characters (1 carriage control and 132 printing characters). The PUT statement is using the 133 bytes.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Mon Feb 17, 2014 10:30 pm
Reply with quote

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.
Back to top
View user's profile Send private message
ashim prodhan

New User


Joined: 28 Apr 2013
Posts: 7
Location: india

PostPosted: Tue Feb 18, 2014 3:25 pm
Reply with quote

Thank You very much for your detailed explanation. Thanks!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts PRINTOUT macro PL/I & Assembler 0
No new posts create rexx edit Macro that edits the... CLIST & REXX 3
No new posts Issues with executing a REXX MACRO th... TSO/ISPF 4
No new posts Facing issue in Run Edit Macro Job CLIST & REXX 9
No new posts outtrap does not capture within an ed... CLIST & REXX 1
Search our Forums:

Back to Top