|
Hey Jake,
Just a code comment from me. For things to be clearer, think about putting
the SQL stuff in their own Subroutines, so that you don't have to switch
back and forth from FREE format.
To answer you question, yes you can create a program to ask for the
warehouse in a display file but it needs to be in a seperate program and
wrap it with a CL program.
Your code rewritten...
/FREE
ExSr SETSQLOPT#;
ExSr DecCursor#; // Declare cursor and open it.
except heading;
ExSr FetchCursor#;
dow SQLSTT = '00000';
except detail;
ExSr FetchCursor#;
enddo;
*inlr = *on;
/END-FREE
C SETSQLOPT# BEGSR
C/EXEC SQL
C+ Set Option
C+ Naming = *Sys,
C+ Commit = *None,
C+ UsrPrf = *User,
C+ DynUsrPrf = *User,
C+ Datfmt = *iso,
C+ CloSqlCsr = *EndMod,
C+ Commit = *NONE
C/END-EXEC
C ENDSR
C DECCURSOR# BEGSR
C/exec sql
C+ declare mainCursor Cursor
C+ for
C+ select icwmwh, icwmsn, icwmbl, icwmbt,
C+ icwmas, icwmdb, icwmal, icwmps, icwmbs
C+ from mylib/icwmap where icwmwh =:warehouse
C/end-exec
C/exec sql
C+ open mainCursor
C/end-exec
C ENDSR
C FETCHCURSOR# BEGSR
C/exec sql
C+ fetch next
C+ from mainCursor
C+ into :myDS
C/end-exec
C ENDSR
C CLOSECURSOR# BEGSR
C/exec sql
C+ fetch next
C+ from mainCursor
C+ into :myDS
C/end-exec
C ENDSR
Michael Schutte
Work 614-492-7419
email michael_schutte@xxxxxxxxxxxx
"Jake M"
<jakeroc@xxxxxxxx
m> To
Sent by: rpg400-l@xxxxxxxxxxxx
rpg400-l-bounces@ cc
midrange.com
Subject
Display File for SQLRPGLE program.
04/04/2006 03:52
PM
Please respond to
RPG programming
on the AS400 /
iSeries
<rpg400-l@midrang
e.com>
Hello Pro's,
I have coded an SQLRPGLE program which takes a parameter and creates a
report. I want this parameter to be supplied using a Display File. Is this
possible? I am still learning RPG so this might be an extremely easy
question so please be gentle. Here is my program.
=============================================================================================
H ActGrp(*CALLER)
H DftActGrp(*NO)
Fqsysprt o f 132 printer
D whchoice PR EXTPGM('WMSPRNT_06')
D warehouse 2
D whchoice PI
D warehouse 2
d myDS ds
D wrhouse 2a
D icwmsn 6a
D icwmbl 14a
D icwmbt 5a
D icwmas 5a
D icwmdb 1a
D icwmal 1a
D icwmps 9s 0
D icwmbs 1a
C/EXEC SQL
C+ Set Option
C+ Naming = *Sys,
C+ Commit = *None,
C+ UsrPrf = *User,
C+ DynUsrPrf = *User,
C+ Datfmt = *iso,
C+ CloSqlCsr = *EndMod,
C+ Commit = *NONE
C/END-EXEC
C/exec sql
C+ declare mainCursor Cursor
C+ for
C+ select icwmwh, icwmsn, icwmbl, icwmbt,
C+ icwmas, icwmdb, icwmal, icwmps, icwmbs
C+ from mylib/icwmap where icwmwh =:warehouse
C/end-exec
C/exec sql
C+ open mainCursor
C/end-exec
C/exec sql
C+ fetch next
C+ from mainCursor
C+ into :myDS
C/end-exec
/FREE
except heading;
dow SQLSTT = '00000';
except detail;
/END-FREE
C/exec sql
C+ fetch next
C+ from mainCursor
C+ into :myDS
C/end-exec
/FREE
enddo;
*inlr = *on;
/END-FREE
Oqsysprt e heading 1
O + 1 'WH'
O + 1 'SEC'
O + 3 'BIN'
O + 1 'TYP'
O + 1 'AVAIL'
O + 1 'DEDBIN'
O + 10 'AVAL4LETDOWN'
O + 12 'SEQ'
O + 18 'STATUS'
Oqsysprt e detail 3
O wrhouse + 1
O icwmsn + 1
O icwmbl + 1
O icwmbt + 1
O icwmas + 1
O icwmdb + 1
O icwmal + 1
O icwmps + 12
O icwmbs + 12
=================================================================================================
Thanks in advance,
Jake.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
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.