Page 1 of 1

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

PostPosted: Tue May 18, 2010 12:43 pm
by Pankaj7985
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 ???

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

PostPosted: Tue May 18, 2010 4:20 pm
by Robert Sample
You never put anything into variable LINE, so it'll have garbage in it when printed.

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

PostPosted: Tue May 18, 2010 5:13 pm
by Pankaj7985
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 ??

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

PostPosted: Tue May 18, 2010 6:14 pm
by Pankaj7985
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

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

PostPosted: Tue May 18, 2010 7:43 pm
by Bill Dennis
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.