Trying to write in the file..but its writing garbage



High Level Assembler(HLASM) for MVS & VM & VSE

Trying to write in the file..but its writing garbage

Postby Pankaj7985 » Tue May 18, 2010 12:43 pm

Hi,
I have taken a simple code and i am trying to write it in file. the cc=0 but its writing garbage the code is as below:
PROGRAM  CSECT                     
*EGIN    STM   14,12,12(13)       
BEGIN    BALR  12,0               
         USING *,12               
         ST    14,SAVEREG         
         L     5,X                 
         S     5,Y                 
         ST    5,Z                 
         OPEN  (PRINTER,(OUTPUT)) 
         L     5,Z                 
         CVD   5,BCD               
         UNPK  SUM,BCD             
         OI    SUM+9,X'F0'         
         PUT   PRINTER,LINE       
         CLOSE (PRINTER)           
*        LA    15,0               
          L     14,SAVEREG                                               
          BR    14                                                       
 X        DC    F'10'                                                   
 Y        DC    F'5'                                                     
 Z        DS    F                                                       
 BCD    DS    D                                                       
 LINE   DS    1CL80                                                   
          DC    CL5''                                                   
          DC    C'THE SUB IS'                                           
          DC    CL5''                                                   
 SUM   DS    CL10                                                     
          DC    CL50''                                                   
 PRINTER  DCB   DSORG=PS,MACRF=(PM),DDNAME=PRINT,RECFM=FB,              X
                LRECL=80                                                 
 SAVE     DS    18F                                                     
 SAVEREG  DS    F                                                       


can someone please tell me where i am making mistake ???
Pankaj7985
 
Posts: 4
Joined: Tue May 18, 2010 12:38 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Trying to write in the file..but its writing garbage

Postby Robert Sample » Tue May 18, 2010 4:20 pm

You never put anything into variable LINE, so it'll have garbage in it when printed.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Trying to write in the file..but its writing garbage

Postby Pankaj7985 » Tue May 18, 2010 5:13 pm

Hi,
first thanks for looking into my problem..i have defined line as
LINE   DS    1CL80
which i believe is the frist level declaration just as 01 in cobol and then defined and
DC      CL5''                                                   
          DC    C'THE SUB IS'                                           
          DC    CL5''                                                   
SUM   DS    CL10                                                     
          DC    CL50'


which is as 05 in cobol
So the entire declaration is a part of the line.
first is my declaration right ??
Pankaj7985
 
Posts: 4
Joined: Tue May 18, 2010 12:38 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Trying to write in the file..but its writing garbage

Postby Pankaj7985 » Tue May 18, 2010 6:14 pm

Hi thanks Robert,

The problem got sloved actually i declared
LINE   DS    1CL80
as
LINE   DS    0CL80
the output came fine. But i have a doubti have seen the declaration can you tell what the diff between
LINE   DS    1CL80
and
LINE   DS    0CL80
,and why there was no output with LINE DS 1CL80
Pankaj7985
 
Posts: 4
Joined: Tue May 18, 2010 12:38 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Trying to write in the file..but its writing garbage

Postby Bill Dennis » Tue May 18, 2010 7:43 pm

The zero in the definition of DS 0CL80 does not reserve any storage but only provides a length reference. The next DC CL5 starts at the same location.

When you say DS 1CL80, the Assembler reserves one unitialized, 80 byte area and the DC CL5 follows that.
Regards,

Bill Dennis

Disclaimer: My comments on this forum are my own and do not represent the opinions or suggestions of any other person or business entity.
Bill Dennis
 
Posts: 278
Joined: Thu May 15, 2008 9:45 pm
Has thanked: 0 time
Been thanked: 0 time


Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post