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



Thanks Scott, that is exactly what we needed.  We implemented it last
night works great.

Lyle J. Hart Jr.
Manager Computer Operations
Nuvell Financial Services Corp.
501.821.8275

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Friday, June 23, 2006 4:17 PM
To: Midrange Systems Technical Discussion
Subject: Re: QgldExportLdif API and QgldImportLdif API 


I'm looking for an RPG example of using the QgldExportLdif API.  This
API creates a .LDIF file of your entire LDAP on the iSeries so it can
be
exported to another iSeries LDAP.

Okay, here's an example that I wrote up real quick:

      H DFTACTGRP(*NO)

      D QgldExportLdif  PR                  Extproc('QgldExportLdif')
      D    InputData               32767A   const options(*varsize)
      D    InputLen                   10I 0 value
      D    Format                      8A   const
      D    ErrorCode               32767A   options(*varsize)

      D LDIF0100        DS
      D   File_off                    10I 0
      D   File_len                    10I 0
      D   AdminDN_off                 10I 0
      D   AdminDN_len                 10I 0
      D   AdminPW_off                 10I 0
      D   AdminPW_len                 10I 0
      D   Subtree_off                 10I 0
      D   Subtree_len                 10I 0
      D   File                       200C   CCSID(13488)
      D   AdminDN                    200C   CCSID(13488)
      D   AdminPW                    200C   CCSID(13488)
      D   Subtree                    200C   CCSID(13488)

      D ErrorCode       ds
      D    BytesProv                  10I 0 inz(0)
      D    BytesAvail                 10I 0 inz(0)

       /free

           // Set parameters
           //  FIXME:  Change these to appropriate values!!

           File    = %ucs2('/tmp/dirsrv_output.ldif');
           AdminDN = %ucs2('cn=Administrator');
           AdminPW = %ucs2('mySecretPassword');
           Subtree = *blanks;

           // Calculate offsets

           File_off    = %addr(file)    - %addr(LDIF0100);
           AdminDN_off = %addr(AdminDN) - %addr(LDIF0100);
           AdminPW_off = %addr(AdminPW) - %addr(LDIF0100);
           Subtree_off = %addr(Subtree) - %addr(LDIF0100);

           // Calculate lengths

           File_len    = %len(%trimr(file));
           AdminDN_len = %len(%trimr(AdminDN));
           AdminPW_len = %len(%trimr(AdminPW));
           Subtree_len = 0;

           // Call API

           QgldExportLdif( LDIF0100
                         : %size(LDIF0100)
                         : 'LDIF0100'
                         : ErrorCode );

           *inlr = *on;
       /end-free

In this example, it dumps the whole directory server (since I set the 
subtree length to zero, it won't do a subtree, it'll do everything) to a

file named /tmp/dirsrv_output.ldif in the IFS.

Obviously, you'll have to chagne the userid, password and maybe the IFS 
filename to be something appropriate for your system.

Also, if anyone has an RPG example of the QgldImportLdif API that will

load the .LDIF file into the destination iSeries.

I haven't used QgldImportLdif.  (I export it for import into an
OpenLDAP2 
server, not for another iSeries) but I took a quick peek at the docs,
and 
they appear to be just about identical to those for QgldExportLdif, so
you 
might be able to use the same program, just change the prototype name
(and 
the EXTPROC keyword) from Export to Import.

Note that the contents of the ExtProc() keyword are case-sensitive.
Make 
sure you capitalize it the same way I did.

Note also that the 2nd parameter to QgldExportLdif is passed by VALUE...

this one was tricky at first, since it doesn't say anything about this
in 
the IBM docs (unless they've changed them since I wrote this?)  You have

to look at the C prototype to know this :)

I realize that the export and import can be done via iSeries
Navigator, 
but I want to do the export and import as scheduled jobs that will run

unattended during the middle of the night. Any help is greatly 
appreciated.

It's probably also possible from QShell using ldapsearch, but i haven't 
tried it.  This API seems simpler, actually :)


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.