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



That's a single record fetch, right?  There's only 1 customer in your 
CUSTOMER file with that customer number?

Then the following would work.  If, however, you wanted to fetch all 
records where last name sounded like 'Berendt' then let me know.  That 
involves using a cursor and I can whip up a sample like that also.

     H ActGrp(*CALLER)
     H DftActGrp(*NO)

     D Customer      e ds                  EXTNAME(CUSTOMER)
     D OpenStuff       PR              n
     D FetcuStuff      PR              n
     D SampleCust                          like(cnum) inz(12345)

      /free
       *inlr=*on;
       if not OpenStuff();
         // perform error routine to alert the troops
         // ...
       Else;
         If FetchStuff(SampleCust);

           // normal processing here...

         EndIf;
       EndIf;
       return;
      /end-free
      // End of program is right here.


     P OpenStuff       B
     D OpenStuff       PI                  like(ReturnVar)
     D ReturnVar       s               n

     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


      /free
       stmt1='select cnum, lname, fname ' +
             'into :cnum, :lname, :fname ' +
             'from customer where cnum=?';
      /end-free
     C/EXEC SQL
     C+ Prepare S1 from :stmt1
     C/END-EXEC

      /free
       Select;
         When SqlStt='00000';
           return *on;
         Other;
           return *off;
       EndSl;
      /end-free
     P OpenStuff       E

      /eject
     D FetchStuff      PI                  like(ReturnVar)
     D  ThisCust                           like(cnum)
     D ReturnVar       s               n

     C/EXEC SQL
     C+ Execute S1 using :ThisCust
     C/END-EXEC

     P FetchStuff      E 


Rob Berendt

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.