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


  • Subject: Library list heartache
  • From: Jim Langston <jimlangston@xxxxxxxxxxxxxxxx>
  • Date: Mon, 15 Jan 2001 11:17:15 -0800
  • Organization: Pacer International

I have a program that processes a customer given file into
our own OS/400 files written in RPG.

In test environment, everything works great, but now that it's
in production I find a problem.

I have a CL calling this same program twice, once to process
records for one of my locations, the second time to process records
for another location.  It adds to the library list for the second
call, and calls the program with another parameter.

Now here's the problem.

I have this program calling some modules that are bound together into
a service program.  One of these modules has a file in the F-Specs, which
it searches to see if the record exists.  What I find is happening is
when the module is first called the library list is pointing to a certain
file which it opens.  After that program is done, it gets called again,
but it still has the previous file open, so it is looking at the wrong
records (pain in the neck to track down that bug).

I do not want to hard code library names in the program, so I guess my 
question is: If I define this file as USROPN, and close it and immediately
reopen it, will it switch to the file pointed to in the Library List, or will
it just reopen the same file again?

Snippet from the CL:
                                                              
    /*** REMOVE THE LIBRARY SO WE KNOW IT IS *FIRST ***/      
    RMVLIBLE   LIB(CARTCNX)                                   
    MONMSG     MSGID(CPF0000)                                 
    ADDLIBLE   LIB(CARTCNX)                                   
    CALL       PGM(BSTORDADD) PARM('CNX')                     
                                                              
    /*** REMOVE THE LIBRARY SO WE KNOW IT IS *FIRST ***/      
    RMVLIBLE   LIB(CARTSEA)                                   
    MONMSG     MSGID(CPF0000)                                 
    ADDLIBLE   LIB(CARTSEA)                                   
    CALL       PGM(BSTORDADD) PARM('SEA')                     

Snippet from the RPG:

 C                   Eval      FilePrefix = OHICFP                    
 C                   Eval      FileSuffix = GetNextSuffix(FilePrefix) 

Snippet from the RPG Module:

 FCCOHD     UF   E           K DISK  
 ...
 C     CCOHD_Key     KList                               
 C                   KFld                    GNS_Prefix  
                                                        
 C                   Eval      FileSuffix = -1           
                                                        
 C     CCOHD_Key     SetLL     OHdRc                     
 C     CCOHD_Key     Reade(N)  OHdRc                     
 C                   DoW       Not %Eof(CCOHD)           

That is where it is giving me problems.  On the second call to the RPG it still 
has
CARTCNX/CCOHD open instead of CARTSEA/CCOHD.

Regards,

Jim Langston
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.