COBOL

COBOL

COBOL

COBOL is responsible for the efficient, reliable, secure, and unseen day-to-day operations of the world's economy.

 View Only
Expand all | Collapse all

Obscure compile time error.

  • 1.  Obscure compile time error.

    Posted Wed September 04, 2024 02:36 AM

    Take the following code:

     >>define bad as parameter                              
                                                            
     identification division.                               
     function-id. CompressSpaces as 'CMPRSSPC' is prototype.
     data division.                                         
     linkage section.                                       
     01  string-in                   pic x(22319).          
     01  string-out                  pic x(140).            
     procedure division using string-in                     
                              returning string-out.         
     end function CompressSpaces.                           
                                                            
     identification division.                               
     program-id. cmprts2.                                   
                                                            
     environment division.                                  
     configuration section.                                 
     repository.                                            
         function CompressSpaces                            
         function all intrinsic.                            
                                                            
     procedure division.                                    
         goback.                                            
                                                            
     id division.                                           
     program-id. subprog1.                    
                                                            
     data division.                                         
     local-storage section.                                 
     01  string-in-short   pic x(1000).                     
     01  string-out        pic x(140).                      
                                                            
     procedure division.                                    
         string '/'                                              
                trim(CompressSpaces(content-of(string-in-short)))
                delimited by size                                
                into string-out                                  
         goback.                                                 
                                                                 
     end program subprog1.                         
                                                                 
     id division.                                                
     program-id. subprog2.                                
                                                                 
     data division.                                              
     local-storage section.                                      
     01  string-in-short             pic x(1000).                
     01  string-out                  pic x(140).                 
     01  long-str                    pic x(22319).               
                                                                 
                                                                 
     procedure division.                                         
     >>if bad defined                                            
         move CompressSpaces(content-of(string-in-short))        
              to string-out                                      
     >>else                                                      
         move string-in-short to long-str                        
         move CompressSpaces(long-str) to string-out             
     >>end-if                                                    
         goback.                                                 
                                                                 
     end program subprog2.                                
                                                                 
     end program cmprts2.                                        
    

    If you set the "bad" compile variable so that the "move CompressSpaces(content-of(string-in-short))  to string-out" statement is compiled, the compiler abends with RC=0016, and the following on SYSOUT:

    Assertion failed at ilgen/WCodeSymbol.cpp:2948: false                                               
     Symbol id_no=310 should have been created with owningIndex 0                                       
    TR_MvsCallStackIterator::TR_MvsCallStackIterator()+0x11c                                            
    TR_Debug::printStackBacktrace()+0x20                                                                
    TR::assertion(const char*,int,const char*,const char*,...)+0x22e                                    
    TR_WCode::findOrCreateSymbol(TR::Compilation*,TR::ResolvedMethodSymbol*,unsigned long)+0xf44        
    TR_WCodeIlGenerator::genIL()+0x18e42                                                                
    IBM::ResolvedMethodSymbol::genIL(TR_FrontEnd*,TR::Compilation*,TR::SymbolReferenceTable*,TR...+0x968
    IBM::Compilation::compile()+0x48c                                                                   
    TR_CompilationInfo::compileWCodeMethod(TR_WCode*,unsigned long,bool*,TR_OptimizationPlan*)+0xb7a    
    TRWC_compileAllSymbols+0x1796                                                                       
    trwc(DDTAB_TYPE*,int,char**)+0x162a                                                                 
    edcw+0xe44                                                                                          
    entry64(int,int,char**)+0xc1c                                                                       
    main+0x3a                                                                                           
    CELQINIT+0x1aca                                                                                     

    Interestingly, if subprog1 is removed then subprog2 compiles just fine.  Weird!



    ------------------------------
    Frank Swarbrick
    ------------------------------


  • 2.  RE: Obscure compile time error.

    Posted Wed September 04, 2024 12:36 PM

    Forgot to mention the compiler version.  It's 6.4.0 P240202.



    ------------------------------
    Frank Swarbrick
    ------------------------------