× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



First I agree with the suggestion to not use the temporary table.

Second, the SET OPTION statement can be about anywhere.  I think of it as 
SQL's version of the H spec.  It's interpreted by the precompiler and not 
at execution time.  There can only be one SET OPTION in the program.  I 
typically have:

     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/END-EXEC

Rob Berendt
-- 
Group Dekko Services, LLC
Dept 01.073
PO Box 2000
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





fkany@xxxxxxxxxxxxxxxxxx 
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
04/05/2005 03:47 PM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
CN=RPG programming on the AS400/O=iSeries <rpg400-l@xxxxxxxxxxxx>
cc

Subject
RE: SQLRPGLE won't compile...








Program now compiles.  I set the break point in debug after the "INSERT" 
section, queried QTEMP/SQLTABLE and there was no data.  Can anyone see 
why?

Thanks,

Frank

     *
     * GET_TERM_BILLS - Get Freight Bills by Terminal
 **********************************************************************
     P GET_TERM_BILLS  B
     ?*
     ?* Get Numeric Version of Origin Terminal
     C                   IF        #OT1 <> '*ALL'
     C                   EVAL      NUM#OT1 = *ZEROS
     C     #OT1          CHAIN     AAL03002
     C                   IF        %FOUND(AAL03002)
     C                   EVAL      NUM#OT1 = CT1TID
     C                   ENDIF
     C                   ENDIF
     ?*
     ?* Get Numeric Version of Destination Terminal
     C                   IF        #DT1 <> '*ALL'
     C                   EVAL      NUM#ODT = *ZEROS
     C     #DT1          CHAIN     AAL03002
     C                   IF        %FOUND(AAL03002)
     C                   EVAL      NUM#ODT = CT1TID
     C                   ENDIF
     C                   ENDIF
     ?*
     ?* Create SQL table in QTEMP
     C/EXEC SQL
     C+ CREATE TABLE QTEMP/SQLTABLE (XFHDDAT DECIMAL (8 ), XFHOT DECIMAL
     C+ (3 ), XFHPRO DECIMAL (7 ), XFHDT DECIMAL (3 ), XFHPUDT DECIMAL (8
     C+ ), XFHDADT DECIMAL (8 ), XFHSCD CHARACTER (7 ), XFHCCD CHARACTER
     C+ (7 ), XFHCCT CHARACTER (20 ), XFHCST CHARACTER (2 ), XFHCZIP
     C+ CHARACTER (6 ), XFHDTIM DECIMAL (6 ))
     C/END-EXEC
     ?*
     ?* Insert records into SQL table
     C/EXEC SQL
     C+ INSERT INTO QTEMP/SQLTABLE (XFHDDAT, XFHOT, XFHPRO, XFHDT,
     C+ XFHPUDT, XFHSCD, XFHCCD, XFHCCT, XFHCST, XFHCZIP, XFHDTIM) SELECT
     C+ FHDDAT, FHOT, FHPRO, FHDT, FHPUDT, FHDADT, FHSCD,FHCCD, FHCCT,
     C+ FHCST, FHCZIP, FHDTIM FROM FRL00144 WHERE FHDDAT >= FDATE AND
     C+ FHDDAT <= TDATE ORDER BY FHOT, FHDT
     C/END-EXEC
     ?*
     ?* Declare SQL Cursor
     C/EXEC SQL
     C+ DECLARE SQLTBLCSR CURSOR FOR SELECT * FROM QTEMP/SQLTABLE
     C/END-EXEC
     ?*
     ?* Open SQL Cursor
     C/EXEC SQL
     C+ OPEN SQLTBLCSR
     C/END-EXEC
     '*
     '* Process Entire SQL Table File
     '* -----------------------------
     C                   DOU       SQLCOD <> 0
     ?*
     ?* Get SQLTABLE file record
     C/EXEC SQL
     C+ FETCH NEXT FROM SQLTBLCSR
     C/END-EXEC
     ?*
     ?* EOF; Exit Loop
     C                   IF        SQLCOD <> 0
     C                   LEAVE
     C                   ENDIF
     ?*
     ?* Validate Freight Bills
     C                   EVAL      BADDATE = 'N'
     C                   EVAL      NEXTFLG = 'N'
     C                   CALLP     CHK_TERM_BILLS
     ?*
     ?* Invalid Date Range
     C                   IF        BADDATE = 'Y'
     C                   LEAVE
     C                   ENDIF
     ?*
     ?* Invalid Freight Bill; Get Next Record
     C                   IF        NEXTFLG = 'Y'
     C                   ITER
     C                   ENDIF
     ?*
     ?* Check Service Quality
     C                   CALLP     CHK_SVC_QLTY
     ?*
     ?* Populate Work File(FR47P457) fields
     C                   CALLP     POP_WORKF
     ?*
     ?* Write Record to Work File(FR47P457)
     C                   WRITE     FREC457
     ?*
     C                   ENDDO
     ?* DOU SQLCOD <> 0
     ?*
     ?* Close SQL Cursor
     C/EXEC SQL
     C+ CLOSE SQLTBLCSR
     C/END-EXEC
     ?*
     P GET_TERM_BILLS  E



-- 
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 thread ...

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.