Previous Topic Next topic Print topic


SQLUTB UNLOAD

SQLUTB UNLOAD unloads data from a table in a DBMS, and places it into an output data set file. You can use SQLUTB UNLOAD to unload all rows from a table, or unload only those rows that meet certain criteria, such as those selected from a provided field specification list. Output data sets are compatible with z/OS DB2 in both encoding and formatting, and can be used as input to SQLUTB LOAD.

Executing SQLUTB UNLOAD

SQLUTB UNLOAD is similar to DSNUTILB LOAD. Include an SQLUTB UNLOAD card in your JCL, and execute it from an Enterprise Developer JCL project or by submitting the JCL directly using the JES CONTROL feature in Enterprise Server. The JCL syntax must be z/OS DB2 compatible.

The following is an example of JCL using a UNLOAD card:

//ULEMP001  JOB CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID,REGION=0M
//DELETE  EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  DELETE MCS.UNLOAD.ULEMP001
  SET    MAXCC=0
//DSNUTILB EXEC PGM=HCOUTILB,PARM='HCOD,ULEMP001'
//SYSUT1   DD UNIT=SYSDA,SPACE=(CYL,(10,10))
//SORTOUT  DD UNIT=SYSDA,SPACE=(CYL,(10,10))
//SYSPRINT DD SYSOUT=*
//UTPRINT  DD SYSOUT=*
//SYSPUNCH DD SYSOUT=*
//SYSREC   DD DSN=MCS.UNLOAD.ULEMP001,DISP=(MOD,CATLG),
//            UNIT=SYSDA,SPACE=(CYL,(1,1)),
//            DCB=(RECFM=VB,LRECL=107,BLKSIZE=6500)
//SYSIN    DD *
   UNLOAD DATA FROM TABLE [DSN8910].[EMP] EBCDIC
/*                                                                      
//
//         PARM='&SYSTEM,&UID,&UTPROC' 
//*STEPLIB  DD   DSN=&LIB,DISP=SHR    
//* 
//SYSPRINT DD   SYSOUT=* 
//UTPRINT  DD   SYSOUT=* 
//SYSUDUMP DD   SYSOUT=*

Where HCOD is the ODBC XAR ID for your database connection, SQLUTB has been established as an alias for program HCOUTILB, and MCS.UNLOAD.ULEMP001 is the cataloged output data file.

In contrast to DB2 for z/OS DSNUTILB UNLOAD, the default code set for the output of SQLUTB UNLOAD is ASCII instead of EBCDIC. Also, the default record format, RECFM, is FB. You can override the RECFM default with DCB in the SYSREC definition.

UNLOAD Options

Supported Specifications and Options
  • TABLESPACE – does not apply to SQL Server
  • PUNCHDDN
  • UNLDDN
  • EDCDIC – to override the default ASCII if needed
  • ASCII – default code set
  • NOSUBS
  • NOPAD
  • MAXERR
  • PART (for DB2 LUW only)
Unsupported Specifications and Options
  • PART (for all DBMSs except DB2 LUW)
  • FROMCOPY
  • FROMCOPYDDN
  • LIST
  • UNICODE – code set
  • CCSID
  • FORMAT INTERNAL
  • DELIMITED
  • COLDEL
  • CHARDEL
  • DECPT
  • FLOAT S390
  • FLOAT IEEE
  • SHRLEVEL
  • DECFLOAT_ROUNDMODE
Supported FROM TABLE Options
  • HEADER
  • POSITION
  • FIELD SPECIFICATION
  • STRIP
  • TRUNCATE
  • WHEN
Unsupported FROM TABLE Options
  • SAMPLE
  • LIMIT
Supported TABLE FIELD TYPES
  • CHAR
  • VARCHAR
  • SMALLINT
  • INTEGER
  • BIGINT
  • INTEGER EXTERNAL
  • DECIMAL (PACKED)
  • DECIMAL EXTERNAL
  • FLOAT
  • FLOAT EXTERNAL
  • DOUBLE
  • REAL
  • DATE EXTERNAL
  • TIME EXTERNAL
  • TIMESTAMP EXTERNAL
  • CINSTANT
  • BINARY
  • VARBINARY
Unsupported TABLE FIELD TYPES
  • GRAPHIC
  • GRAPHIC EXTERNAL
  • VARGRAPHIC
  • ROWID
  • BLOB
  • CLOB
  • DBCLOB
Note: To ensure proper parsing of SYSIN, do not include the tab character (ASCII decimal character code 9; EBCDIC decimal character code 5) in its contents. When parsed, the tab character could cause spurious, unintended errors.
Previous Topic Next topic Print topic