0

I've been trying to read my input and write it to output file but can't find any mistakes in code. The JCL I'm submiting is good, because it was written by my mainframe lecturer, so I know the problem is somewhere in COBOL code... double checked everything, tried to find something with him in class - worthless... Line alignment, spacing, etc. are Ok I believe.

IDENTIFICATION DIVISION.                    
PROGRAM-ID.  NAME.                          
AUTHOR.  MYNAME.                        

ENVIRONMENT DIVISION.                       
INPUT-OUTPUT SECTION.                       
FILE-CONTROL.                               
        SELECT INPUT10 ASSIGN TO INPUTFIL.  
        SELECT OUTPUT10 ASSIGN TO OUTFIL.   


DATA DIVISION.                              
FILE SECTION.                               
FD INPUT10                                  
        BLOCK CONTAINS 0 RECORDS            
        RECORDING MODE IS F                 
        RECORD CONTAINS 80 CHARACTERS.      
01 PLAYER-DETAILS.                          
   03  PLAYER-ID       PIC 9(07).           
   03  PLAYER-NAME.                         
       05  NAME        PIC X(08).           
       05  INITIALS    PIC A(02).           
   03  PLAYER-BDAY     PIC 9(08).           
   03  PLAYER-NR       PIC 9(02).           

FD OUTPUT10                                 
        BLOCK CONTAINS 0 RECORDS            
        RECORDING MODE IS F                 
        RECORD CONTAINS 80 CHARACTERS.      
01 OUTPUT-DETAILS.                          
   03  OUTPUT-ID       PIC 9(07).           
   03  OUTPUT-NAME.                         
       05  O-NAME      PIC X(08).           
       05  O-INITIALS  PIC A(02).           
   03  OUTPUT-BDAY     PIC 9(08).               
   03  OUTPUT-NR       PIC 9(02).               
WORKING-STORAGE SECTION.                        
01  WS-INDICATORS.                              
 10  WS-EOF-IND        PIC X(01) VALUE 'N'.     
     88  WS-END-OF-FILE          VALUE 'Y'.     

PROCEDURE DIVISION.                             
MAINFLOW.                                       
    OPEN INPUT INPUT10                          
    OPEN OUTPUT OUTPUT10                        
    READ INPUT10                                
       AT END SET WS-END-OF-FILE TO TRUE        
    END-READ                                    
    PERFORM UNTIL WS-END-OF-FILE                
    MOVE PLAYER-ID TO OUTPUT-ID                 
    MOVE NAME TO O-NAME                         
    MOVE INITIALS TO O-INITIALS                 
    MOVE PLAYER-BDAY TO OUTPUT-BDAY             
    MOVE PLAYER-NR TO OUTPUT-NR                 
    READ INPUT10                                
       AT END SET WS-END-OF-FILE TO TRUE        
    END-READ                                    
    WRITE OUTPUT10                              
    END-WRITE                                   
    END-PERFORM                                 
    CLOSE INPUT10                               
    CLOSE OUTPUT10                              
    STOP RUN.    

here is the code of JCL

//useridX JOB ,                                                    
//         MSGCLASS=H,                                              
//         MSGLEVEL=(1,1),                                          
//         CLASS=A,                                                 
//         REGION=0M,                                               
//         NOTIFY=&SYSUID                                           
//COBOL1 EXEC IGYWCLG,REGION=50M,                                   
// PARM.COBOL='TEST,RENT,APOST,OBJECT,NODYNAM,LIB,SIZE(1048376)'    
//COBOL.STEPLIB DD DSN=IGY420.SIGYCOMP,                             
// DISP=SHR                                                         
//COBOL.SYSIN DD DISP=SHR,DSN=userid.KURS.COBOL(PROG2)             
//GO.INPUTFIL DD DISP=SHR,DSN=userid.KURS.PLAYERS                  
//GO.OUTFIL   DD DISP=SHR,DSN=userid.KURS.REPORT                   

and it works for other students, so I'm pretty sure the cause of maxcc=12 is COBOL's part

Any suggestions? Thanks.

P.S. I cannot check my job logs - something is wrong with my mainframe account or mainframe itself. This is the main cause why I can't find the problem

zilijonas
  • 3,285
  • 3
  • 26
  • 49

2 Answers2

0

OK - I have run this successfully after some code changes. You really need to get your output sorted - are you using the correct MSGCLASS. Check - do not assume.

Program errors: Look at PROGRAM-ID Look at record lengths and compare to what you describe the record lengths of the files Look at what you are writing.

Improvements: Always check your status after any file operation - OPEN READ WRITE CLOSE. Your indentation is not good. If it is on your machine then take more care when posting.

NicC
  • 293
  • 1
  • 6
  • these should really be comments. This doesn't answer OPs question. Nobody can until we have more information because we don't even know which JCL step is getting the 12 – SaggingRufus May 18 '17 at 10:00
  • @SaggingRufus: Actually it answers the question. The question was: "Any suggestions?". I gave 3 suggestions on fixing the problems plus an extra. – NicC May 18 '17 at 21:25
  • How can you even begin to suggest things when you don't even know where or what the error is? Any information you provide at this point is basically send OP on a wild goose chase – SaggingRufus May 19 '17 at 09:51
  • But I do know where the erros are because, as I stated, I have compiled, after fixing the compile errors, and run, after fixing the run-time errors: as I stated. – NicC May 19 '17 at 11:49
0

The input file and output file is declared as Fixed and is of length 80.

But both input and output variables are of length less than 80. They have length of 27.So in player-details and output details add filler variable with length 80 - 27 = 53

Also make sure the input and output file length are 80.