IC SunsetThe developerWorks Connections platform will be sunset on December 31, 2019. On January 1, 2020, this community and its apps will no longer be available. More details available on our FAQ.
Topic
  • 4 replies
  • Latest Post - ‏2019-07-12T09:57:07Z by Andreas Bott
JPanzenhagen
JPanzenhagen
9 Posts

Pinned topic **FREE SQLRPGLE and /COPY

‏2017-10-23T19:20:20Z | **free sqlrpgle

I have read other threads regarding this topic but can't seem to get the issue fixed. I have SQLRPGLE code in **FREE mode using conditional copybooks. Whenever the first copy is executed, the SQL precompiler adds the SQL definitions to the code. In doing so it specifies **END-FREE. I would expect it to return back to **FREE when it goes to import the copybook but it does not. It is being compiled with RPGPPOPT(*LVL2). I checked PTFs for fully free and some that were documented about this type of problem and they are installed. 

I'd appreciate any help.

This is the first portion of the code. Everything after it breaks. 

**free                                     
      /DEFINE Definitions                  
      /COPY ENVANL/QRPGSRC,CMPPGMCPY       
      /Undefine Definitions                
    dcl-ds Data_Rec   extname('DTAMSELOC');
    end-ds;                           

This is the first portion of the copy book.

       /If Defined(Definitions)                                       
     ctl-opt dftactgrp(*no)                                           
             OPTION(*SRCSTMT);                                        
                                                                      
     dcl-f CMPPRINT PRINTER;                                          
                                                                      
 //-------------------------------------------------------------------
 // Data definitions                                                  
 //-------------------------------------------------------------------
                                                                      
       /ElseIf Defined(Mainline)                                      
                                                                      
     dcl-ds WorkFields;                                               
         EOF        ind;                                              
     end-ds;                                                          
                                                                     

This is the combined source generated by the compiler.

**free                                                                               
//       /DEFINE Definitions                                                         
//       /COPY ENVANL/QRPGSRC,CMPPGMCPY                                              
**END-FREE                                                                           
      * /If Defined(Definitions)                                                     
       /SET CCSID(*CHAR:*JOBRUNMIX)                                                  
       // SQL COMMUNICATION AREA                                                //SQL
       DCL-DS SQLCA;                                                            //SQL
         SQLCAID CHAR(8) INZ(X'0000000000000000');                              //SQL
          SQLAID CHAR(8) OVERLAY(SQLCAID);                                      //SQL
         SQLCABC INT(10);                                                       //SQL
          SQLABC BINDEC(9) OVERLAY(SQLCABC);                                    //SQL
         SQLCODE INT(10);                                                       //SQL
          SQLCOD BINDEC(9) OVERLAY(SQLCODE);                                    //SQL
         SQLERRML INT(5);                                                       //SQL
          SQLERL BINDEC(4) OVERLAY(SQLERRML);                                   //SQL
         SQLERRMC CHAR(70);                                                     //SQL
         
              D  SQL_00049            128    128A   CCSID(*JOBRUNMIX)                   
            OPTION(*SRCSTMT);                                                  
                                                                               
    dcl-f CMPPRINT PRINTER;                                                    
                                                                               
//-----------------------------------------------------------------------------
// Data definitions                                                            
//-----------------------------------------------------------------------------
                                                                               
      * /ElseIf Defined(Mainline)                                              
      * /ElseIf Defined(FetchNext)                                             
                                                                              

The following is a portion of the source listing. 

     1 **free                                                                           
     2 //       /DEFINE Definitions                                                     
     3 //       /COPY ENVANL/QRPGSRC,CMPPGMCPY                                          
     4 **END-FREE                                                                       
Line   <---------------------- Source Specifications ----------------------------><---- 
Number ....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+.
     5  * /If Defined(Definitions)                                                      
     6   /SET CCSID(*CHAR:*JOBRUNMIX)                                                   
     7   // SQL COMMUNICATION AREA                                                //SQL 
     8   DCL-DS SQLCA;                                                            //SQL 
     9     SQLCAID CHAR(8) INZ(X'0000000000000000');                              //SQL 
    10      SQLAID CHAR(8) OVERLAY(SQLCAID);                                      //SQL 
    
   119 D  SQL_00045              3      4B 0 INZ(7)                               statement number     
   120 D  SQL_00046              5      8B 0 INZ(0)                               invocation mark      
   121 D  SQL_00047              9      9A   INZ('0') CCSID(*JOBRUNMIX)           data is okay         
   122 D  SQL_00048             10    127A   CCSID(*JOBRUNMIX)                    end of header        
   123 D  SQL_00049            128    128A   CCSID(*JOBRUNMIX)                    end of header        
   124        OPTION(*SRCSTMT);                                                                        
   125                                                                                                 
   126 cl-f CMPPRINT PRINTER;                                                                          
======> aa                 bb                                                                          
*RNF5001 20 a      000500  Control-Level entry is not valid; defaults to previous                      
                           control level.                                                              
*RNF5014 30 b      000500  Operation code is not valid; specification is ignored.                      
   127                                                                                                 
   128 --------------------------------------------------------------------------------------------    
======>a                                                                                               
*RNF0257 30 a      000700  Form-Type entry for main procedure not valid or out of                          
    

 

Updated on 2017-10-23T19:24:05Z at 2017-10-23T19:24:05Z by JPanzenhagen
  • barbara_morris
    barbara_morris
    605 Posts
    ACCEPTED ANSWER

    Re: **FREE SQLRPGLE and /COPY

    ‏2017-10-23T19:51:06Z  

    The copy file needs its own **FREE in line 1. **FREE only applies to the source member it is coded in.
     

  • barbara_morris
    barbara_morris
    605 Posts

    Re: **FREE SQLRPGLE and /COPY

    ‏2017-10-23T19:51:06Z  

    The copy file needs its own **FREE in line 1. **FREE only applies to the source member it is coded in.
     

  • JPanzenhagen
    JPanzenhagen
    9 Posts

    Re: **FREE SQLRPGLE and /COPY

    ‏2017-10-23T19:56:50Z  

    The copy file needs its own **FREE in line 1. **FREE only applies to the source member it is coded in.
     

    I knew it had to be something simple that I was missing but I couldn't see it. Thank you for your help!

  • prsBRC
    prsBRC
    1 Post

    Re: **FREE SQLRPGLE and /COPY

    ‏2019-07-11T08:00:39Z  

    Hallo everybody.

    I have the same problem with a sqlrpgle but my copysource (the declare-ds statement had its own **FREE on the first line)

    The compiler sets the SQLCA-definition directly in a DCL-DS statement:
     

    0100.00 DCL-DS Parameter_Set1_Template TEMPLATE QUALIFIED;                                                       000000
    0101.00   DCL-DS InParameter LIKEDS(InParameters_Set1_Template);                                                 000000
    0102.00 **END-FREE                                                                                               000000
    0103.00        /SET CCSID(*CHAR:*JOBRUNMIX)                                             SQL                      000000
    0104.00      D*      SQL COMMUNICATION AREA                                             SQL                      000000
    0105.00      D SQLCA           DS                                                       SQL                      000000
    0106.00      D  SQLCAID                       8A   INZ(X'0000000000000000')             SQL                      000000
    0107.00      D  SQLAID                        8A   OVERLAY(SQLCAID)                     SQL                      000000
    0108.00      D  SQLCABC                      10I 0                                      SQL                      000000
    ...
    0150.00      D  SQFAPP         C                   CONST(32)                            SQL                      000000
    0151.00 **FREE                                                                                                   000000
    0152.00   OutParameter CHAR(130) DIM(27);                                                                        000000
    0153.00 END-DS;                                                                                                  000000
    

    Does any one has a solution to this "bug" ?

    OS 7.2

     

    Thanks und greets

  • Andreas Bott
    Andreas Bott
    20 Posts

    Re: **FREE SQLRPGLE and /COPY

    ‏2019-07-12T09:57:07Z  
    • prsBRC
    • ‏2019-07-11T08:00:39Z

    Hallo everybody.

    I have the same problem with a sqlrpgle but my copysource (the declare-ds statement had its own **FREE on the first line)

    The compiler sets the SQLCA-definition directly in a DCL-DS statement:
     

    <pre class="javascript dw" dir="ltr">0100.00 DCL-DS Parameter_Set1_Template TEMPLATE QUALIFIED; 000000 0101.00 DCL-DS InParameter LIKEDS(InParameters_Set1_Template); 000000 0102.00 **END-FREE 000000 0103.00 /SET CCSID(*CHAR:*JOBRUNMIX) SQL 000000 0104.00 D* SQL COMMUNICATION AREA SQL 000000 0105.00 D SQLCA DS SQL 000000 0106.00 D SQLCAID 8A INZ(X'0000000000000000') SQL 000000 0107.00 D SQLAID 8A OVERLAY(SQLCAID) SQL 000000 0108.00 D SQLCABC 10I 0 SQL 000000 ... 0150.00 D SQFAPP C CONST(32) SQL 000000 0151.00 **FREE 000000 0152.00 OutParameter CHAR(130) DIM(27); 000000 0153.00 END-DS; 000000 </pre>

    Does any one has a solution to this "bug" ?

    OS 7.2

     

    Thanks und greets

    Hi,

    cann you post the original code additionaly ?

    thx.