Page 1 of 1

Unload table structure to dataset

PostPosted: Mon May 02, 2016 4:24 pm
by jferrerm
Hello,

I need to obtain the structure dataset. Currently we areusing this JCL:

//UXDUMMY JOB ,,NOTIFY=&SYSUID,MSGCLASS=H,CLASS=A                  
//PASO10 EXEC DSNUPROC                                              
//SYSIN DD *                                                        
  UNLOAD TABLESPACE xxxxxxxx.yyyyyyyyy FROM TABLE ZZZZZ.YYYYY        
  SHRLEVEL REFERENCE;                                              
/*                                                                  
//SYSREC   DD DUMMY                                                
//SYSPUNCH DD DSN=SISTEMAS.DB1TLX(YYYYY),DISP=SHR
 

This is a good way to obtain this, but if the tables has a large cardinality, this job takes a long time because unload all the data.

Anybody knows the way to obtain the structure whithout unload the data?

Thanks

Re: Unload table structure to dataset

PostPosted: Mon May 02, 2016 4:28 pm
by jferrerm
We need to obtain a dataset like this:

LOAD DATA INDDN SYSREC   LOG NO  REPLACE NOCOPYPEND ENFORCE NO
 EBCDIC  CCSID(01145,00000,00000)                              
 INTO TABLE "xxxxx"."yyyyy"                                  
 ( "CCVDOC"                                                    
        POSITION(  00003:00042) CHAR(00040)                    
 , "FECHACRE"                                                  
        POSITION(  00043:00068) TIMESTAMP EXTERNAL            
 , "CTIPMOV"                                                  
        POSITION(  00069:00070) SMALLINT                      
 , "CLAVE"                                                    
        POSITION(  00071:00110) CHAR(00040)                    
 , "CIDEN"                                                    
        POSITION(  00111:00125) CHAR(00015)                    
 , "CCAMBIO"                                                  
        POSITION(  00126:00127) SMALLINT                      
 , "XTEXTO"                                                    
        POSITION(  00128:00629) VARCHAR                        
 )

Re: Unload table structure to dataset

PostPosted: Mon May 02, 2016 4:47 pm
by NicC
Please use the code tags when posting data, jcl, control cards, screen "shots" - anything requiring a fixed pitch font. Plenty of examples around of how to do this.

Re: Unload table structure to dataset

PostPosted: Fri May 06, 2016 2:07 pm
by ayesomeone
how about try the control statement using:
select * from table fetch first 1 rows only;
to unload the data, but I can't recall the program's name...

Re: Unload table structure to dataset

PostPosted: Sun May 08, 2016 5:47 pm
by Raja190
@ayesomeone, I guess the same utility used in above thread would work (DSNUPROC).

He just need to give the below query and could get the structure easily.


Select * from table-name
fetch 1 rows only;