Skip to content

Create the IBM i users yourself

The Add Capture Agent wizard prepares the IBM i for you: as an installing user with *SECOFR authority (or *SECADM and *ALLOBJ), it creates the agent user, the privileged owner and the control library, and restores the Stelo Capture programs (see What the wizard does on the IBM i). If your security policy doesn't allow that, the IBM i administrator prepares the system beforehand, and the wizard then runs with users that have less authority. There are two ways:

What each user does

User (default) What it does Authority it needs
Installing user (QSECOFR) Only while the agent is created, and for Update Host: creates the other users and the control library, and restores the Stelo Capture programs. *SECOFR, or *SECADM and *ALLOBJ. When the users and library already exist (for example created with ADDAGENT), the privileged owner can be the installing user.
Agent user (SQDR, named like the Control Schema) The Capture Agent connects as it. It owns the control library and its contents. Created with INLMNU(*SIGNOFF) and LMTCPB(*YES), so it can't be used for interactive sessions. No special authority. *USE on the QPWFSERVER authorization list if *PUBLIC is excluded (see File server access).
Privileged owner (for example SQDRADM) Owns the programs that read journal entries for the agent, which run with their owner's authority: they add subscriptions, read the journal receivers, and manage receivers through the exit program. Usually *SECADM and *ALLOBJ. With less, the grants in Grant the authorities yourself.
SQDR's user (no default) The Replicator Service connects as it, to create subscriptions and run baselines. *USE on the tables and *EXECUTE on their libraries (see Users and authority).

Roles can be combined: with the CL setup programs, the privileged owner can also be the installing user and, once it has access to the tables, SQDR's user.

Once the agent is created and running, you can set the privileged owner's password to *NONE, unless it's also the installing user or SQDR's user:

CHGUSRPRF USRPRF(SQDRADM) PASSWORD(*NONE)

CL setup programs (SQDRINST)

Stelo supplies CL programs that do the IBM i part of the setup, as an IBM i save file: SQDRINST.SAVF. It holds the save file SQDRP with the SQDR Plus programs, these commands, and their source in the source files QCLSRC and QCMDSRC:

Command What it does
ADDAGENT Creates the agent user and the privileged owner, the control library and its journal settings, then calls UPDTHOSTC and EXITPGM. Usually run once.
UPDTHOSTC Restores the Stelo Capture programs from SQDRP into the control library, with their owners and grants. The same as Update Host in the SQDR Control Center, without an installing user with *SECOFR.
EXITPGM Registers the exit program that keeps journal receivers until the agent has read them (see Keep the source's journals and logs in check).
SQDRAUTL Creates authorization lists for the agent user and the privileged owner, and grants them the access they need to a library you replicate, its tables, and its journal and receivers.

The save file holds the Stelo Capture programs of a given Stelo Capture release: ask Stelo Support whether it matches your Stelo Capture version.

Requirements. The programs use the RUNSQL command: IBM i 7.2 or later, 7.1 with Db2 PTF group SF99701 level 14, or 6.1 with SF99601 level 25. The save file is in IBM i 7.1 format.

Install the programs

  1. Create an empty save file on the IBM i:

    CRTSAVF QGPL/SQDRINST
    
  2. Transfer SQDRINST.SAVF to it in binary mode, with FTP, IBM i Access Client Solutions or another FTP client (see Transfer files with an FTP client). For example, from a Windows command prompt:

    ftp myibmi
    ftp> cd QGPL
    ftp> bin
    ftp> put SQDRINST.SAVF
    
  3. Restore it to a library SQDRINST, and add the library to your library list:

    RSTLIB SAVLIB(SQDRINST) DEV(*SAVF) SAVF(QGPL/SQDRINST) RSTLIB(SQDRINST) OPTION(*ALL) MBROPT(*ALL) ALWOBJDIF(*ALL)
    ADDLIBLE SQDRINST
    

Set up the IBM i and add the agent

  1. As a user with *SECOFR authority, run ADDAGENT (agent user default SQDR, privileged owner default SQDRADM). If the users already exist, their passwords aren't changed.
  2. Run SQDRAUTL for each library you replicate (authorization lists default SQDRL and SQDRADML; journal default QSQJRN, often in the same library). Errors about authorization lists that already exist can be ignored.
  3. After each command, check the job log for errors: DSPJOBLOG, then F10 (detailed messages) and Page Up.
  4. In the SQDR Control Center, add the agent (see Add the Capture Agent): on step 1, Userid is the privileged owner (SQDRADM) and Control Schema the agent user (SQDR); on step 2, enter the agent user's and the privileged owner's passwords.
  5. Run SQDRAUTL for every library whose tables you replicate before you create their incremental subscriptions.

To update the Stelo Capture programs later, stop the agent in the SQDR Control Center, run UPDTHOSTC and check the job log. If you don't want the exit program, remove it after ADDAGENT (see Remove the Db2 for i exit program).

Grant the authorities yourself

To use a privileged owner without special authorities, an administrator with enough authority grants it access to the objects it needs, before you create incremental subscriptions in the Data Replicator Manager.

  1. Create the privileged owner, and optionally the agent user (needed when the installing user has no *SECOFR authority):

    CRTUSRPRF USRPRF(SQDRADM) PASSWORD(<password>) INLMNU(*SIGNOFF) LMTCPB(*YES) TEXT('SQDR Plus privileged user') PWDEXPITV(*NOMAX)
    CRTUSRPRF USRPRF(SQDR) PASSWORD(<password>) INLMNU(*SIGNOFF) LMTCPB(*YES) TEXT('SQDR Plus agent user') PWDEXPITV(*NOMAX)
    
  2. Grant *USE on the tables and on their library. Generic names (MYTAB*) and *ALL grant several at once:

    GRTOBJAUT OBJ(MYLIB) OBJTYPE(*LIB) USER(SQDRADM) AUT(*USE)
    GRTOBJAUT OBJ(MYLIB/*ALL) OBJTYPE(*FILE) USER(SQDRADM) AUT(*USE)
    
  3. Grant *USE on the journal and its receivers (and their library, if it's another one), and *ADD and *OBJEXIST on the journal:

    GRTOBJAUT OBJ(MYLIB/QSQJRN) OBJTYPE(*JRN) USER(SQDRADM) AUT(*USE)
    GRTOBJAUT OBJ(MYLIB/QSQJRN0001) OBJTYPE(*JRNRCV) USER(SQDRADM) AUT(*USE)
    GRTOBJAUT OBJ(MYLIB/QSQJRN) OBJTYPE(*JRN) USER(SQDRADM) AUT(*ADD *OBJEXIST)
    
  4. Add the agent (see Add the Capture Agent): Userid on step 1 is the installing user, Control Schema the agent user; on step 2, enter the agent user's password and the privileged owner and its password.

  5. Once the agent runs, set the privileged owner's password to *NONE (see What each user does).

If a grant is missing when a subscription is added to a journal, run that subscription's baseline again once the grant is in place. Autojournaling, the exit program and publications may need more authority with a privileged owner without special authorities: ask Stelo Support.

Example: grants through authorization lists

This CL program creates the two users and an authorization list for each, then reads library names from the physical file MYLIB/LIBLIST (column LIBLIST) and grants the lists access to each library, its objects and its QSQJRN journal:

PGM
  DCLF FILE(MYLIB/LIBLIST)
  CRTUSRPRF USRPRF(SQDR) PASSWORD(<password>) INLMNU(*SIGNOFF) LMTCPB(*YES) PWDEXPITV(*NOMAX) TEXT('SQDR Plus agent user')
  CRTUSRPRF USRPRF(SQDRADM) PASSWORD(<password>) INLMNU(*SIGNOFF) LMTCPB(*YES) PWDEXPITV(*NOMAX) TEXT('SQDR Plus privileged user')
  CRTAUTL AUTL(SQDR) AUT(*EXCLUDE)
  ADDAUTLE AUTL(SQDR) USER(SQDR) AUT(*READ *EXECUTE *OBJOPR *ADD *OBJEXIST)
  CRTAUTL AUTL(SQDRADM) AUT(*EXCLUDE)
  ADDAUTLE AUTL(SQDRADM) USER(SQDRADM) AUT(*READ *EXECUTE *OBJOPR *ADD *OBJEXIST)
GETIN:
  RCVF
  MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(ENDPGM))
  GRTOBJAUT OBJ(&LIBLIST/*ALL) OBJTYPE(*ALL) AUTL(SQDR)
  GRTOBJAUT OBJ(*ALL/&LIBLIST) OBJTYPE(*LIB) AUTL(SQDR)
  GRTOBJAUT OBJ(&LIBLIST/QSQJRN) OBJTYPE(*JRN) AUTL(SQDRADM)
  GOTO CMDLBL(GETIN)
ENDPGM:
  ENDPGM

Remove the users and authorization lists

When you no longer replicate from the IBM i, delete the agent (see Delete), remove the exit program (see Remove the Db2 for i exit program), and then delete the control library and the users yourself. To delete the authorization lists that SQDRAUTL created, first revoke their access to each library and its objects, then delete them:

RVKOBJAUT OBJ(MYLIB/*ALL) OBJTYPE(*ALL) AUTL(SQDRL)
RVKOBJAUT OBJ(MYLIB/*ALL) OBJTYPE(*ALL) AUTL(SQDRADML)
RVKOBJAUT OBJ(MYLIB) OBJTYPE(*LIB) AUTL(SQDRL)
DLTAUTL AUTL(SQDRL)
DLTAUTL AUTL(SQDRADML)

Transfer files with an FTP client

Any FTP client can transfer save files to the IBM i in binary mode. FileZilla, for example, needs IBM i naming and listing formats: create the connection in File > Site Manager (plain FTP may be needed instead of TLS), then close FileZilla, edit %APPDATA%\FileZilla\sitemanager.xml and add these lines to the <Server> block of the IBM i:

<PostLoginCommands>
  <Command>SITE NAMEFMT 1</Command>
  <Command>SITE LISTFMT 1</Command>
</PostLoginCommands>