While CL & SQL are not a match made in heaven, I've used the DCLF/RCVF technique in the past.

If you need multiple selects & files concurrently, keep in mind that CL will support up to 5 DCLF's.

If you're talking about a single record result, consider using a command calling an RPG to do the work. I write a lot of "RTV" type commands to return configuration info to my CL programs.

Roger Harman
COMMON Certified Application Developer – ILE RPG on IBM i on Power




-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Steinmetz, Paul via MIDRANGE-L
Sent: Friday, August 16, 2019 7:50 PM
To: 'Jack Woehr'; 'Midrange Systems Technical Discussion'
Cc: Steinmetz, Paul
Subject: RE: Load CL variables from SQL example

Jack,

I will have multiple SQL with selects from multiple PF.

I don’t think I can join them, don’t have a common key.

Paul

From: Jack Woehr <jwoehr@xxxxxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, August 16, 2019 10:44 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Cc: Steinmetz, Paul <PSteinmetz@xxxxxxxxxx>
Subject: Re: Load CL variables from SQL example

You can select into a file MYLIB/MYRESULTS and then RCVF. Let's say your target db file has two columns, STRINGA and STRINGB.

DCLF MYLIB/MYRESULTS
RCVF /* Get one row */
SNDMSG MSG(&STRINGA) TOUSR(*REQUESTER)
SNDMSG MSG(&STRINGB) TOUSR(*REQUESTER)

If you have lots of rows, you can do it in a loop. Each RCVF instances (repetitiously the same) vars named after the columns.

On Fri, Aug 16, 2019 at 7:49 PM Steinmetz, Paul via MIDRANGE-L <midrange-l@xxxxxxxxxxxxxxxxxx<mailto:midrange-l@xxxxxxxxxxxxxxxxxx>> wrote:
I need to load a CL variable using the results of an SQL select.
Anyone have any examples.


--
Jack Woehr
Absolute Performance, Inc.
12303 Airport Way, Suite 100
Broomfield, CO 80021

NON-DISCLOSURE NOTICE: This communication including any and all attachments is for the intended recipient(s) only and may contain confidential and privileged information. If you are not the intended recipient of this communication, any disclosure, copying further distribution or use of this communication is prohibited. If you received this communication in error, please contact the sender and delete/destroy all copies of this communication immediately.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.