I haven't found a COBOL listserv so I'm posting this here.  
I have Enterprise COBOL for z/OS 4.2.0.  I wrote a simple program to open a 
sequential output file, write a record to it, and then close the file.  The 
program compiles cleanly and when I run it I allocate the output dataset in the 
step the program runs in.  When the job completes the file is present but there 
aren't any records in it.  

Here's my code:
SELECT DPGM-FILE              ASSIGN TO DMGPFILE  
                     FILE STATUS IS DPGM-STATUS.  


FD  DPGM-FILE                   
    BLOCK CONTAINS 0            
    RECORDING MODE F            
    LABEL RECORDS STANDARD.     
01  DPGM-RECORD    PIC X(80).   

OPEN OUTPUT DPGM-FILE, EPGM-FILE.           
IF DPGM-STATUS EQUAL '00'                   
   NEXT SENTENCE                            
ELSE                                        
   DISPLAY 'DPGM-STATUS=' DPGM-STATUS       
   STOP RUN                                 
END-IF.                                     
MOVE SPACES TO DPGM-RECORD.    
WRITE DPGM-RECORD.                          
 IF DPGM-STATUS EQUAL '00'                      
    NEXT SENTENCE                               
 ELSE                                           
    DISPLAY 'DPGM-STATUS=' DPGM-STATUS          
    STOP RUN                                    
 END-IF.                                        
 CLOSE DPGM-FILE.                    
GOBACK.

It's so simple I'm sure I'm missing something but I can't figure out what.  Any 
suggestions?

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to