DB2 Server for VSE & VM: Data Restore Guide


Using the SELECT Function

Figure 210 shows an example of JCL for using OUTPUT=DASD for a sequential file.

Figure 210. JCL to Extract Data from a Sequential File (VSE)

(1)  ---> // JOB SELECT
(2)  ---> // LIBDEF *,SEARCH=(PRD2.DB2vrm,PRD2.RCVvrm)
(3)  ---> // DLBL DATAUNL,'DATAUNLOAD.DATA',0
(4)  ---> // EXTENT SYS006,DOSRES,1,0,2715,300
(5)  ---> // ASSGN SYS006,DISK,VOL=DOSRES,SHR
(6)  ---> // EXEC PROC=ARIS71DB
(7)  ---> // EXEC XTS91001,SIZE=AUTO
(8)  ---> CONTROL DBAPW=XXXXXXXX
(9)  ---> SELECT CREATOR=SQLDBA TNAME=CUSTOMERS
(10) --->    OUTPUT=DASD
(11) --->    COUNT=500
(12) ---> /*

Statement 1
Specifies the job name.

Statement 2
Specifies the IBM DATABASE 2 Server for VSE & VM library for the SELECT function. You must specify the IBM DATABASE 2 Server for VSE & VM library for the SELECT function.

Statement 3
Defines the output VSAM file.

Statement 4-5
Defines the output file to disk.

Statement 6
Starts an EXEC to access the database files.

Statement 7
Starts the program to process the function.

Statement 8
Specifies the password for SQLDBA.

Statement 9
Indicates the creator name as well as the table name.

Statement 10
Indicates the output source (DASD).

Statement 11
Indicates the number of rows to be selected.

Statement 12
Ends the SYSIN file.

Figure 211 shows an example of JCL for OUTPUT=DASD to a VSAM ESDS file.

Figure 211. JCL to Extract Data from a VSAM File (VSE)

         // JOB SELECT
(1) ---> // LIBDEF *,SEARCH=(PRD2.DB2vrm,PRD2.RCVvrm)
(2) ---> // DLBL DATAUNL,'DATAUNLOAD.DATA',,VSAM,RECORDS=100,RECSIZE=4096
(3) ---> // EXEC PROC=ARIS71DB
(4) ---> // EXEC XTS91001,SIZE=AUTO
(5) ---> CONTROL DBAPW=XXXXXXXX
(6) ---> SELECT CREATOR=SQLDBA TNAME=CUSTOMERS
(7) --->  OUTPUT=DASD
(8) --->  COUNT=500
(9) ---> /*

Statement 1
Specifies the IBM DATABASE 2 Server for VSE & VM Library for the SELECT function. You must specify the IBM DATABASE 2 Server for VSE & VM library.

Statement 2
Defines the output VSAM file.

Statement 3
Uses an EXEC to access the database files.

Statement 4
Starts the program to process the function.

Statement 5
Specifies the password for SQLDBA.

Statement 6
Indicates the creator name and the table name.

Statement 7
Indicates the output device (DASD).

Statement 8
Indicates the number of rows to select.

Statement 9
Ends of SYSIN file.

Figure 212 shows an example of JCL for OUTPUT=TAPE.

Figure 212. JCL to Extract Data from a Tape (VSE)

          // JOB SELECT
(1)  ---> // LIBDEF *,SEARCH=(PRD2.DB2vrm,PRD2.RCVvrm)
(2)  ---> // TLBL DATAUNL,'DATAUNLOAD.DATA'
(3)  ---> // ASSGN SYS006,180
(4)  ---> // MTC REW,SYS006
(5)  ---> // EXEC PROC=ARIS71DB
(6)  ---> // EXEC XTS91001,SIZE=AUTO
(7)  ---> CONTROL DBAPW=XXXXXXXX
(8)  ---> SELECT CREATOR=SQLDBA TNAME=CUSTOMERS
(9)  --->  OUTPUT=TAPE
(10) --->  /*

Statement 1
Specifies the IBM DATABASE 2 Server for VSE & VM library for the SELECT function. You must specify the IBM DATABASE 2 Server for VSE & VM library.

Statement 2-4
Defines the output file to tape.

Statement 5
Uses an EXEC to access database files

Statement 6
Starts the program to process the function.

Statement 7
Specifies the password for SQLDBA.

Statement 8
Indicates the creator name and the Table name.

Statement 9
Indicates the output device (TAPE).

Statement 10
Ends the SYSIN file.

Figure 213 shows an example of an EXEC to extract 100 rows and output them to a file on a tape.

Figure 213. Procedure to Execute a SELECT Function

         /**/
(1) ---> 'FILEDEF DATAUNL TAP1 SL 1 (RECFM VB BLOCK 32760'
(2) ---> 'FILEDEF SYSPRINT DISK SELECT SYSPRINT A'
(3) ---> 'FILEDEF SYSIN DISK SELECT SYSIN A'
(4) ---> 'XEDIT SELECT SYSIN A'
(5) ---> 'XTS91001'

Statement 1
Defines the output file on the tape device.

Statement 2
Designates the SYSPRINT file to contain information about the process.

Statement 3
Calls the SYSIN file.

Statement 4
Initiates an edit of the SYSIN file to allow for any changes before processing.

Statement 5
Starts the program to process the function.

The SYSIN file must contain the following statements:

Figure 214. SYSIN File to Extract Data on Tape

(6) ---> CONTROL DBAPW=XXXXXXXX, DBNAME=dbname
(7) ---> SELECT CREATOR=SQLDBA TNAME=CUSTOMERS
(8) --->  COLUMNS=(01,02,03) OUTPUT=TAPE
(9) --->  COUNT=100

Statement 6
Specifies the password for SQLDBA.

Statement 7
Indicates the creator name and the table name.

Statement 8
Writes the result to tape.

Statement 9
Indicates the number of ROWS to select.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]