Try this.

Create table QTEMP.ASPINFO AS
(SELECT * FROM QSYS2.ASP_INFO)
WITH DATA

RTVMBRD FILE(QTEMP/ASPINFO) NBRCURRCD(&ASPQTY)

&ASPQTY should contain the # of ASP's.

I don't think you can perform a RTVMBRD directly on QSYS2.ASP_INFO.

Rob

message: 2
date: Fri, 3 Jun 2022 16:31:09 -0500
from: Steve McKay <samckay1@xxxxxxxxx>
subject: How to retrieve SQL results into CL pgm

How can I run an SQL statement and retrieve the results into a CL pgm?

For example, I want to SELECT COUNT(*) FROM QSYS2.ASP_INFO: but I want to
run it using RUNSQL in a CL program and get the COUNT into a variable in the
CL program.

Something like this:
DCL &COUNT *DEC LEN(1)
RUNSQL SQL( SELECT COUNT(*) FROM QSYS2.ASP_INFO) and get the SQL statement
result in the CL &COUNT field.

Ultimately, I want to do different things depending on whether there is 1
ASP or more than 1 ASP so I'm really after the count of ASPs on the system.
If there is a better way to do this within CL, I'm open to suggestions.

Thanks,

Steve McKay
(205) 585-8424
samckay1@xxxxxxxxx



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.