The UNLOAD command can include up to 90 dbspace names on a maximum of 10 SYSIN lines. In VSE, the REWIND parameter on the OPTIONS line, can be used to specify whether the output tape should be positioned (REWIND=YES) on not (REWIND=NO). In VM, you can use the LEAVE parameter on the FILEDEF for the output file to achieve the same results. Depending on the requirements, you can direct the UNLOAD function in a variety of ways as shown on page UNLOAD.
The UNLOAD command unloads dbspaces to an output file.
You can use an asterisk instead of a dbspace name to unload all the tables as shown in Figure 96.
Figure 96. Unload All Dbspaces in the Database
(1) ---> UNLOAD DBSPACE=(*)
Figure 97 shows how to use the JCL to unload dbspaces in a VSE environment.
Figure 97. JCL to Unload All Dbspaces
// JOB UNLOAD
(1) ---> // LIBDEF *,SEARCH=(PRD2.DB2vrm,PRD2.RCVvrm)
(2) ---> // EXEC PROC=ARIS71DB
(3) ---> // TLBL ARCHIV,'UNLOAD.DB2'
(4) ---> // ASSGN SYS006,180
(5) ---> // MTC REW,SYS006
(6) ---> // EXEC XTS91001,SIZE=AUTO, PARM='DBNAME(dbname)'
(7) ---> OPTIONS DEVICE=TAPE,REWIND=YES/NO
(8) ---> CONTROL DBAPW=XXXXXXXX,DBNAME=dbname
(9) ---> UNLOAD DBSPACE=(*)
/*
Figure 98 shows how to use an EXEC to unload dbspaces in a VM environment.
Figure 98. EXEC to Unload All Dbspaces
/**/
(1) ---> 'FILEDEF ARCHIV TAP1 SL 1 (RECFM VB BLOCK 32760'
(2) ---> 'FILEDEF SYSPRINT DISK UNLOAD SYSPRINT A'
(3) ---> 'FILEDEF SYSIN DISK UNLOAD SYSIN A'
(4) ---> 'XTS91001'
The SYSIN file must contain the following statements:
Figure 99. SYSIN File to Specify Unloading All Dbspaces
(5) ---> CONTROL DBNAME=dbname DBAPW=XXXXXXXX
(6) ---> UNLOAD DBSPACE=(*)
Make sure that when you are executing Data Restore you can access the dbname SQLFDEF file on the database production disk.