Saving and restoring relational database directories
The relational database directory is not an i5/OS® object. Instead, it is made up of files that are opened by the system at initial program load (IPL) time.
Because of this, the Save Object (SAVOBJ) command cannot be used to directly save these files. You can save the relational database directory by creating an output file from the relational database directory data. This output file can then be used to add entries to the directory again if it is damaged.
When entries have been added and you want to save the relational database directory, specify the OUTFILE parameter on the Display Relational Database Directory Entry (DSPRDBDIRE) command to send the results of the command to an output file. The output file can be saved to tape or to a save file and restored to the system. If your relational database directory is damaged or your system needs to be recovered, you can restore the output file that contains relational database entry data using a control language (CL) program. The CL program reads data from the restored output file and creates the CL commands that add entries to a new relational database directory.
For example, the relational database directory for the Spiffy Corporation MP000 system is sent to an output file named RDBDIRM as follows:
DSPRDBDIRE OUTPUT(*OUTFILE) OUTFILE(RDBDIRM)The sample CL program that follows reads the contents of the output file RDBDIRM and recreates the relational database directory using the Add Relational Database Directory Entry (ADDRDBDIRE) command. Note that the old directory entries are removed before the new entries are made.
By using the code examples, you agree to the terms of the Code license and disclaimer information.
/******************************************************************/ /* - Restore RDB Entries from output file created with: - */ /* - DSPRDBDIRE OUTPUT(*OUTFILE) OUTFILE(RDBDIRM) - */ /* - FROM A V4R2 OR LATER LEVEL OF OS/400 or i5/OS - */ /******************************************************************/ PGM PARM(&ACTIVATE) DCL VAR(&ACTIVATE) TYPE(*CHAR) LEN(7) /* Declare Entry Types Variables to Compare with &RWTYPE */ DCL &LOCAL *CHAR 1 DCL &SNA *CHAR 1 DCL &IP *CHAR 1 DCL &ARD *CHAR 1 DCL &ARDSNA *CHAR 1 DCL &ARDIP *CHAR 1 DCL &RWTYPE *CHAR 1 DCL &RWRDB *CHAR 18 DCL &RWRLOC *CHAR 8 DCL &RWTEXT *CHAR 50 DCL &RWDEV *CHAR 10 DCL &RWLLOC *CHAR 8 DCL &RWNTID *CHAR 8 DCL &RWMODE *CHAR 8 DCL &RWTPN *CHAR 8 DCL &RWSLOC *CHAR 254 DCL &RWPORT *CHAR 14 DCL &RWDPGM *CHAR 10 DCL &RWDLIB *CHAR 10 DCLF FILE(RDBSAV/RDBDIRM) /* SEE PROLOG CONCERNING THIS */ IF COND(&ACTIVATE = SAVE) THEN(GOTO CMBLBL(SAVE)) IF COND(&ACTIVATE = RESTORE) THEN(GOTO CMDLBL(RESTORE)) SAVE: CRTLIB RDBSAV DSPRDBDIRE OUTPUT(*OUTFILE) OUTFILE(RDBSAV/RDBDIRM) GOTO CMDLBL(END) RESTORE: /* Initialize Entry Type Variables to Assigned Values */ CHGVAR &LOCAL '0' /* Local RDB (one per system) */ CHGVAR &SNA '1' /* APPC entry (no ARD pgm) */ CHGVAR &IP '2' /* TCP/IP entry (no ARD pgm) */ CHGVAR &ARD '3' /* ARD pgm w/o comm parms */ CHGVAR &ARDSNA '4' /* ARD pgm with APPC parms */ CHGVAR &ARDIP '5' /* ARD pgm with TCP/IP parms */ RMVRDBDIRE RDB(*ALL) /* Clear out directory */ NEXTENT: /* Start of processing loop */ RCVF /* Get a directory entry */ MONMSG MSGID(CPF0864) EXEC(DO) /* End of file processing */ QSYS/RCVMSG PGMQ(*SAME (*)) MSGTYPE(*EXCP) RMV(*YES) MSGQ(*PGMQ) GOTO CMDLBL(LASTENT) ENDDO /* Process entry based on type code */ IF (&RWTYPE = &LOCAL) THEN( + QSYS/ADDRDBDIRE RDB(&RWRDB) RMTLOCNAME(&RWRLOC) TEXT(&RWTEXT) ) ELSE IF (&RWTYPE = &SNA) THEN( + QSYS/ADDRDBDIRE RDB(&RWRDB) RMTLOCNAME(&RWRLOC) TEXT(&RWTEXT) + DEV(&RWDEV) LCLLOCNAME(&RWLLOC) + RMTNETID(&RWNTID) MODE(&RWMODE) TNSPGM(&RWTPN) ) ELSE IF (&RWTYPE = &IP) THEN( + QSYS/ADDRDBDIRE RDB(&RWRDB) RMTLOCNAME(&RWSLOC *IP) + TEXT(&RWTEXT) PORT(&RWPORT) ) ELSE IF (&RWTYPE = &ARD) THEN( + QSYS/ADDRDBDIRE RDB(&RWRDB) RMTLOCNAME(&RWRLOC) TEXT(&RWTEXT) + ARDPGM(&RWDLIB/&RWDPGM) ) ELSE IF (&RWTYPE = &ARDSNA) THEN( + QSYS/ADDRDBDIRE RDB(&RWRDB) RMTLOCNAME(&RWRLOC) TEXT(&RWTEXT) + DEV(&RWDEV) LCLLOCNAME(&RWLLOC) + RMTNETID(&RWNTID) MODE(&RWMODE) TNSPGM(&RWTPN) + ARDPGM(&RWDLIB/&RWDPGM) ) ELSE IF (&RWTYPE = &ARDIP) THEN( + QSYS/ADDRDBDIRE RDB(&RWRDB) RMTLOCNAME(&RWSLOC *IP) + TEXT(&RWTEXT) PORT(&RWPORT) + ARDPGM(&RWDLIB/&RWDPGM) ) GOTO CMDLBL(NEXTENT) LASTENT: RETURN DLTLIB RDBSAV END ENDPGMThere is an alternate method of restoring the directory, for the case when no output file of the type described previously is available. This method is to extract the object from a saved system, restore it to some other library, and then manually enter the entries in it with the Add Relational Database Directory Entry (ADDRDBDIRE) command.
The files that make up the relational database directory are saved when a Save System (SAVSYS) command is run. The physical file that contains the relational database directory can be restored from the save media to your library with the following Restore Object (RSTOBJ) command:
RSTOBJ OBJ(QADBXRDBD) SAVLIB(QSYS) DEV(TAP01) OBJTYPE(*FILE) LABEL(Qpppppppvrmxx0003) RSTLIB(your lib)In this example, the relational database directory is restored from tape. The characters ppppppp in the LABEL parameter represent the product number of i5/OS (for example, 5722SS1 for Version 5 Release 3). The vrm in the LABEL parameter is the version, release, and modification level of i5/OS. The xx in the LABEL parameter refers the last 2 digits of the current system language value. For example, 2924 is for the English language; therefore, the value of xx is 24.
After you restore this file to your library, you can use the information in the file to manually re-create the relational database directory.
Parent topic:
Save and restore processing for a distributed relational database
Related reference
Example: Setting up a relational database directory
Add Relational Database Directory Entry (ADDRDBDIRE) command
Display Relational Database Directory Entry (DSPRDBDIRE) command
Restore Object (RSTOBJ) command
Save Object (SAVOBJ) command
Save System (SAVSYS) command