Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CL Program calling a QM Query

Posted on 2002-06-08
13
Medium Priority
?
845 Views
Last Modified: 2011-09-20
I am new to the AS/400 platform so I realise that my question may be trivial to some of you. Anyway, I am calling a very simple QM Query (Select statement) from a CL Program which requires 3 parameters even though only two get passed to the query (one of them being a date, defined as TYPE(*CHAR) LEN(26)).
What I do not understand is, each time I call the CL program with valid values for each paramters, it prompts me for a date (even though, I pass a valid value like '2002-06-09-00.27.52.123456').
How do I stop it from happening?

Your help is much appreciated.

0
Comment
Question by:emmle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
13 Comments
 
LVL 2

Expert Comment

by:macbone2
ID: 7065916
emmle, can you give a sample of the CL code which is generating the prompt? I'm not familiar with Query Management queries, but it may just be a CL problem.

Geoff (macbone)
0
 

Author Comment

by:emmle
ID: 7068508
Sure, no prob, here it is:

CL Program
/********************************************************/                
 PGM    PARM(&PAR1 &DATIME &PAR2)                                            
 /********************************************************/ /* DECLARES                                                     */                
 /********************************************************/    
 DCL VAR(&PAR1)       TYPE(*CHAR) LEN(10)                                          
 DCL VAR(&DATIME)  TYPE(*CHAR) LEN(26)                                          
 DCL VAR(&DATIME2)      TYPE(*CHAR) LEN(28)                                          
 DCL VAR(&PAR2)     TYPE(*CHAR) LEN(10)                                          
 DCL VAR(&PAR3)     TYPE(*CHAR) LEN(10)                                          
                                                                                   
 CHGVAR VAR(&PAR3) VALUE('ABC' *CAT %SST(&PAR1 1 3)     *TCAT %SST(&DATIME 6 2) *TCAT %SST(&DATIME 9 2))        
 CHGVAR VAR(&MDATIME2)  VALUE(''' *CAT &DATIME *CAT ''')                            
                                                                                   
 STRQMQRY   QMQRY(MYQRY) OUTPUT(*OUTFILE)OUTFILE(&PAR2/&PAR3) OUTMBR(*FIRST *REPLACE) SETVAR((PAR1 &PAR1)(DATIME2 &DATIME2))                                                
FINAL:  ENDPGM                      

 
0
 
LVL 2

Expert Comment

by:macbone2
ID: 7068542
emmle,
4 questions
1.  did you copy and paste this into the question area. if so what is the variable called &MDATIME2. Its not declared in the CL.
2.  what question is posed when the date is requested
3.  are you sure this CL matches the object program, I can't see how this CL can prompt for a date, unless the prompt is coming from the QMQUERY (use RTVCLSRC into a test library. create a QCLSRC file first in that library.)
4.  have you tried running the program with interactive source debug (STRISDB) to check the values the CL is getting

let me know

Geoff
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:emmle
ID: 7068549
Geoff,

1. My mistake, &mdatime2 should be &datime2
2. I will get back to you on this one.
3. The query is basically a box standard Select statement.
   No prompt there whatsoever.
4. Yes, I have used STRISDB and I am getting the values that I am expecting. Everything works fine. But again, it is prompting for the date.

I hope this helps.
0
 
LVL 2

Expert Comment

by:macbone2
ID: 7069555
Are you sure it's asking for a date, not one of the other params.
What element is the request messsage coming from. Is it QM or CL?

Geoff
0
 

Author Comment

by:emmle
ID: 7071428
OK, having gone through STRISDB, I can tell you that it is when the step STRQMQRY   QMQRY(MYQRY) OUTPUT(*OUTFILE)OUTFILE(&PAR2/&PAR3) OUTMBR(*FIRST *REPLACE) SETVAR((PAR1 &PAR1)(DATIME2 &DATIME2) is executed that the following question is asked:

 Type a value for variable "DATIME2" and press Enter.

 Type reply, press Enter.

   Reply . . .

 F3=Exit   F12=Cancel

In fact, what I have also found is that I can get rid off DATIME2 and use directly DATIME as it does not make one bit of difference.
 



0
 
LVL 2

Expert Comment

by:macbone2
ID: 7072351
Ok emmle, glad it's sorted. If you run this cl again and check the value of DATIME2, you'll find it contains the value ' *CAT &DATIME *CAT ' rather than '2002-06-09-00.27.52.123456' as expected. Quotes are always a bit of a pain in CL.

Nice talking to you

Geoff
0
 

Author Comment

by:emmle
ID: 7073889
Not quite sorted yet. I absolutely agree with you and the value of DATIME2. However, even with just using DATIME, I still don't comprehend as to why it does prompt me for the date. I feel I am going round in circle.
0
 
LVL 2

Accepted Solution

by:
macbone2 earned 400 total points
ID: 7075010
emmle,
I think I've been a bit slow here. Because you are trying to but a single quote at each end of the variable, you need 4 (yes FOUR) quotes in the chgvar statement i.e.

VALUE('''' *CAT &DATIME *CAT '''')

weird huh? That's IBM for you.

Try that

Regards

Geoff
0
 

Author Comment

by:emmle
ID: 7079624
Geoff,

You have finally cracked it. To thank you for your trouble, I have doubled the number of points.

Nice talking to you.
0
 

Author Comment

by:emmle
ID: 7079633
Thanks for your help, it is much appreciated.
0
 
LVL 2

Expert Comment

by:macbone2
ID: 7079779
Thanks, but you needn't have done that. Nice to be able to help.

Geoff
0
 

Expert Comment

by:sireeshamanchala
ID: 9862606
Hi Geoff ,
How do I define LIKE for millier kind of situation.
Thx
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re involved with your company’s wide area network (WAN), you’ve probably heard about SD-WANs. They’re the “boy wonder” of networking, ostensibly allowing companies to replace expensive MPLS lines with low-cost Internet access. But, are they …
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question