QMQRY in AS/400

895 pts.
Tags:
AS400 iseries
Hi,
I am trying to fetch few values using QMQRY from SYSTABLES. My PGM is:
0001.00 PGM                                                           
0002.00              DCL        VAR(&SELECT_Q) TYPE(*CHAR) +          
0003.00                           LEN(10) VALUE('SELECT')             
0004.00              DCL        VAR(&FIELDS_Q) TYPE(*CHAR) +          
0005.00                           LEN(5000) VALUE('COLUMN_NAME, +     
0006.00                           TABLE_NAME, TABLE_OWNER, +          
0007.00                           DATA_TYPE, LENGTH, +                
0008.00                           NUMERIC_SCALE, COLUMN_HEADING, +    
0009.00                           TABLE_SCHEMA , COLUMN_TEXT')        
0010.00              DCL        VAR(&FROM_Q) TYPE(*CHAR) LEN(8) +     
0011.00                           VALUE('FROM')                       
0012.00              DCL        VAR(&TABLE_Q) TYPE(*CHAR) LEN(20) +   
0013.00                           VALUE('SYSCOLUMNS')                 
0014.00              DCL        VAR(&WHERE_Q) TYPE(*CHAR) LEN(10) +   
0015.00                           VALUE('WHERE')                      
0016.00              DCL        VAR(&COMP_Q) TYPE(*CHAR) LEN(16) +    
0017.00                           VALUE('TABLE_NAME=')                
0018.00              DCL        VAR(&VALUE_Q) TYPE(*CHAR) LEN(10) +   
0019.00                           VALUE('FILE1')                      
0020.00              DCL        VAR(&GROUP_BY_Q) TYPE(*CHAR) +     
0021.00                           LEN(5000) VALUE('COLUMN_NAME, +  
0022.00                           TABLE_NAME, TABLE_OWNER, +       
0023.00                           DATA_TYPE, LENGTH, +             
0024.00                           NUMERIC_SCALE, COLUMN_HEADING, + 
0025.00                           TABLE_SCHEMA, COLUMN_TEXT')      
0026.00              DCL        VAR(&HAVING_Q) TYPE(*CHAR) +       
0027.00                           LEN(20) VALUE('HAVING')          
0028.00              DCL        VAR(&COMP1_Q) TYPE(*CHAR) LEN(20) +
0029.00                           VALUE('TABLE_OWNER=')            
0030.00              DCL        VAR(&VALUE1_Q) TYPE(*CHAR) +       
0031.00                           LEN(15) VALUE('MENTIS')          
0032.00              MONMSG     MSGID(CPF0000) EXEC(GOTO +         
0033.00                           CMDLBL(ERROR))                   
0034.00              STRQMQRY   QMQRY(MENTIS2/FILE1QM1) +          
0035.00                           SETVAR((SELECT &SELECT_Q) +      
0036.00                           (FIELDS &FIELDS_Q) (FROM +       
0037.00                           &FROM_Q) (TABLE &TABLE_Q) +      
0038.00                           (WHERE &WHERE_Q) (COMP +         
0039.00                           &COMP_Q) (VALUE &VALUE_Q) +      
0040.00                           (GROUP_BY &GROUP_BY_Q) (COMP1 +  
0041.00                           &COMP1_Q) (VALUE1 &VALUE1_Q))    
0042.00              GOTO       CMDLBL(END)                        
0043.00  ERROR:      SNDUSRMSG  MSG('SOME ERROR IN CALLING THE +   
0044.00                           QMQRY')                          
0045.00  END:                                                      
0046.00  ENDPGM  
Now object got created. when I am calling this program, I am facing the following error:
3400 - STRQMQRY QMQRY(MENTIS2/FILE1QM1) SETVAR((SELECT 'SELECT') (FIELDS 'COLUMN_NAME, TABLE_NAME, TABLE_OWNER, DATA_TYPE, LENGTH, NUMERIC_SCALE,
COLUMN_HEADING, TABLE_SCHEMA , COLUMN_TEXT') (FROM 'FROM') (TABLE       
'SYSCOLUMNS') (WHERE 'WHERE') (COMP 'TABLE_NAME=') (VALUE 'FILE1')      
(GROUP_BY 'COLUMN_NAME, TABLE_NAME, TABLE_OWNER, DATA_TYPE, LENGTH,     
NUMERIC_SCALE, COLUMN_HEADING, TABLE_SCHEMA, COLUMN_TEXT') (COMP1       
'TABLE_OWNER=') (VALUE1 'MENTIS'))                                      
 Value 'COLUMN_NAM' for SETVAR exceeds 55 characters.
 Value 'COLUMN_NAM' for SETVAR exceeds 55 characters.
 Error found on STRQMQRY command.
Kindly let me know what this error is & please let me know the solution too.
                                    


Software/Hardware used:
iseries

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: