Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need Help on the understanding of the PUT Macro

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
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    Post subject: Need Help on the understanding of the PUT Macro
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: 8120
Location: East Dubuque, Illinois, USA

PostPosted: Mon Feb 17, 2014 9:15 pm    Post subject:
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: 535
Location: The Universe

PostPosted: Mon Feb 17, 2014 10:30 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts RC 20 for Address ISPEXEC "ISRED... pkmurali CLIST & REXX 3 Sun Apr 16, 2017 11:30 pm
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Need Help in understanding what is th... mainakdalal PL/I & Assembler 9 Mon Oct 03, 2016 8:03 pm
No new posts PCOMM macro to call another PCOMM macro boyti ko All Other Mainframe Topics 4 Tue Jul 12, 2016 4:30 pm
No new posts Send parameter for macro STIMERM from... Daniel Teolotitla PL/I & Assembler 13 Tue Jul 05, 2016 9:23 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us