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



Hello All;
Once again I am running into some newbie problems. This program is supposed
to kick out a simple report based on the item number given by the user in
the display file. The SQLRPGLE program compiles but it bombs out when I try
and run it. I have a display file and a SQLRPGLE program which calls the
display file. I think I am doing something wrong in the coding part itself.
Should I be using an extra CL program with this? I do not know if this kind
of report generation could be done with only one piece of sqlrpgle code and
a dspf file. If anybody could point me in the right direction, I would
really appreciate it.

ITEMINQSQL.dspf
**************************************************************************************************************************
    A*%%TS  DD  20060921  151811  jakem       REL-V5.0.1  WDSc
    A*%%FD Example: Item Inquiry
    A*%%EC
    A                                      DSPSIZ(24 80 *DS3)
    A                                      REF(*LIBL/ITEM_PF)
    A                                      CA03(03)
    A                                      INDARA
    A          R PROMPT
    A*%%TS  DD  20060921  151811  jakem       REL-V5.0.1  WDSc
    A            PGMNAM        10A  O  3  7
    A                                  3 35'Item Inquiry'
    A                                      COLOR(WHT)
    A                                  3 64DATE
    A                                      EDTCDE(Y)
    A                                  8 20'Item Number . . . . . .:'
    A            ITMNBR    R     D  I  8 45
    A  40                                  ERRMSG('Item not found on file -
pl-
    A                                      ease correct' 40)
    A                                 20  7'Press Enter to continue'
    A                                 21  7'F3=Exit'
    A                                      COLOR(BLU)
    A*%%GP SCREEN1
01
******************************************************************************************************************************

ITEMINQSQL.sqlrpgle
******************************************************************************************************************************
     // Declare Files
    FITEM_PF   IF   E           K DISK    Rename(ITEM_PF:RITEMPF)
    FITEMINQSQLCF   E             WORKSTN IndDS(WkstnInd)
    Fqsysprt   o    f  132        printer



    D itemchoice      PR                  EXTPGM('ITEMINQSQL')
    D  itemnum                      20

    D itemchoice      PI
    D  itemnum                      20




    D WkstnInd        DS
    D NotFound               40     40N
    D Exit                   03     03N
    D Cancel                 12     12N


    D myDS            ds                  LIKEREC(RITEMPF)


     /FREE
      PgmNam = 'ITEMINQSQL';
      Exfmt Prompt;
      Dow NOT Exit;
     /END-FREE

    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 * from testing/item_pf where itmnbr=:itemnum
    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
        If %found(Item_PF); // Item Number valid?
          NotFound = *off;
        Dow NOT Cancel;  // Display details
        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;
            If Exit;
              *InLR = *ON;
              Return;
            Endif;
          Enddo;

        Endif;
        // No Item record found or F12 pressed - display prompt
        Cancel = *Off;
        NotFound = *on;
        Exfmt Prompt;
      Enddo;
      *InLR = *ON;
     /END-FREE



    Oqsysprt   e            heading     1
    O                                        +   1 'ITEM NUMBER'
    O                                        +  20 'ITEM DESCRIPTION'


    Oqsysprt   e            detail      3
    O                       ITMNBR           +   1
    O                       ITMDESCR         +  20
****************************************************************************************************************************************

Thanks in advance,

cheers,

Jake.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.