|
There is no provision in embedded SQL to display the results to the screen.
You would need to code your own User Interface (Subfile?) to display the data
after you retreive it via SQL.
Mike Troxclaire <mike_troxclaire@xxxxxxxxxxx> wrote:
Hello All;
With all your help and input, I am able to run a SQL embedded RPG program
and produce a report. Now, I want the user to be able to go to the green
screen and say CALL MYPROG('CSTNUM') and the results should be displayed on
the screen(not create a report). Right now, I have hardcoded the customer
number. The SQL statement is very complicated one so for simplicity I am
just using a small one over here. I will further improve on it using a DSPF
but for now I just want to call my program and pass the customer number as a
parameter. Here is what I coded till now. Please overlook the coding
inadequacies of a novice programmer. Any help in this matter will be much
appreciated.
******************************************************************************
FQSYSPRT O F 132 PRINTER
D CSTNUM S 10
D CSNAME S 30
D CSADD1 S 30
D COUNT S 7 0
C EXSR PROCESS
C EXSR ENDPGM
C PROCESS BEGSR
C EXSR WORK01
C ENDSR
C WORK01 BEGSR
C/EXEC SQL
C+ DECLARE MYCUR CURSOR FOR SELECT CSTNUM, CSNAME,
C+ CSADD1 FROM LIBRARY1/CSTMST WHERE CSTNUM = ' XXXXXXX'
C/END-EXEC
C/EXEC SQL
C+ OPEN MYCUR
C/END-EXEC
C EXCEPT HEAD1
C EXSR @@FETCH
C DOW SQLCOD = 0
C EXCEPT DET1
C EVAL COUNT = COUNT + 1
C EXSR @@FETCH
C ENDDO
C/EXEC SQL
C+ CLOSE MYCUR
C/END-EXEC
C EXCEPT DET2
C ENDSR
C @@FETCH BEGSR
C/EXEC SQL
C+ FETCH NEXT FROM MYCUR INTO :CSTNUM, :CSNAME, :CSADD1
C/END-EXEC
C ENDSR
C ENDPGM BEGSR
C EVAL *INLR = *ON
C ENDSR
OQSYSPRT E HEAD1 1
O +0 'CSTNUM'
O +1 'CSNAME'
O +1 'CSADD1'
O E DET1 1
O CSTNUM +0
O CSNAME +2
O CSADD1 +2
O E DET2 1
O COUNT 4 +0
******************************************************************************
Cheers,
Mike.
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.