Topic
  • No replies
JLScreen
JLScreen
2 Posts

Pinned topic Not able to use LIKE to define a field to work with iSeries SQL Cobol Pgm.

‏2014-01-16T15:29:32Z |

Hi,

I can't compile a iSeries SQL Cobol Pgm using LIKE to define a field, based on a PF field, to use in a SQL statment.
However there are people in other iSeries that can compile the same pgm.

Can anyone help in that problem?

We are at V6.1.
 

See the example below:

The file TST1PF with the field FLD1:

A          R TST1PFR              
A            FLD1          10A

 

Now the SQLCBLLE pgm:

 identification division.          
 program-id. TST02.                
 data division.                    
 working-storage section.          
                                   
     Exec Sql                      
          Include SQLCA            
     End-Exec.                     
                                   
 01  TR01-REC.                     
     COPY DDS-ALL-FORMATS OF TST1PF.
                                   
 01  TEST-REC.                     
     05 WS-FLD1    like FLD1.      
                                                          
 linkage section.                                         
 procedure division.                                      

 main.                                                    
                                                          
     exec sql                                             
         set :WS-FLD1  = upper("teste")                   
     end-exec                                             
                                                          
     GoBack                                               
     .

 

And this is part of pre-compilation error listing:

Registo *...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+   
35                  set :ws-fld1 = upper("teste")                     
MENSAGENS DE DIAGNÓSTICO         MSG ID  GRAV  REGIST  TEXT                                               
SQL0312  30      35  Position 21 variable WS-FLD1 not defined or not usable.
 

 

 

 

 

 

  • JLScreen
    JLScreen
    2 Posts

    Re: Not able to use LIKE to define a field to work with iSeries SQL Cobol Pgm.

    ‏2014-01-17T11:31:06Z  

    Sorry,

    My confusion.
    I incorrectly interpreted that someone was successful compiling that version of SQL CBL, but he was not.

    So, I assume that it is not possible.