View previous topic :: View next topic |
Author |
Message |
Shankarganesh_gopal Beginner
Joined: 24 May 2005 Posts: 36 Topics: 20 Location: chennai
|
Posted: Mon May 28, 2007 1:12 am Post subject: How to get Header while using DSNTIAUL |
|
|
Hi all,
I am using DSNTIAUL program to extract data into File and the Query is as follows.
Code: |
SELECT AA202_TIMESTAMP
, CHAR('#') AS #
, SUBSTR(AA202_TYPE_1_4_5, 0001, 0001) REC_T
, CHAR('#') AS #
, SUBSTR(AA202_TYPE_1_4_5, 0002, 0008) REQ_CODE....
|
But the Output file doesn't have the column name init. It is just displaying only data. Is there any way to get the column name in the result file.
Thanks,
Shankar. |
|
Back to top |
|
|
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 525 Topics: 89 Location: Bangalore India
|
Posted: Mon May 28, 2007 10:13 pm Post subject: |
|
|
Shankar,
Try the following:
1.Create your Header in a dataset with columns
2.Use SORT utility to concate the Header dataset and the Unloaded dataset as SORTIN
3.In the SORTOUT Dataset you can get the desired output with Header and Detail records
Example:
Code: |
//STEP010 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=HEADER DATASET,DISP=SHR
DD DSN=UNLOADED DATASET FROM DB2 TABLE,DISP=SHR
//SORTOUT DD DSN=NEW OUTPUT DATSET
//SYSIN DD *
SORT FIELDS=COPY
/*
NEW OUTPUT DATASET
COL1 COL2 COL3 COL4
---- ---- ---- ----
1 2 3 4
|
_________________ Shekar
Grow Technically |
|
Back to top |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Tue May 29, 2007 3:42 am Post subject: |
|
|
You could use IEB/ICEGENER as well if you go down this route _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12367 Topics: 75 Location: San Jose
|
Posted: Tue May 29, 2007 8:17 am Post subject: |
|
|
Shankarganesh_gopal,
Use DSNTEP2 program to unload the data instead of DSNTIAUL. However with DSNTIAUL your output is limited to 133 bytes only. If your unload exceeds that length then it will wrap around.
Alternatively you can try this also. Select 1 row from sysibm.sysdummy1 as the header values.
Code: |
SELECT CHAR('TIMESTAMP',26)
,CHAR('#')
,CHAR('REC_T')
,CHAR('#')
,CHAR('REQ_CODE')
FROM SYSIBM.SYSDUMMY1
UNION
SELECT AA202_TIMESTAMP
, CHAR('#') AS #
, SUBSTR(AA202_TYPE_1_4_5, 0001, 0001) REC_T
, CHAR('#') AS #
, SUBSTR(AA202_TYPE_1_4_5, 0002, 0008) REQ_CODE....
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Shankarganesh_gopal Beginner
Joined: 24 May 2005 Posts: 36 Topics: 20 Location: chennai
|
Posted: Wed May 30, 2007 12:50 am Post subject: |
|
|
Thanks a lot kolsu.
I worked and i got my problem solved. |
|
Back to top |
|
|
Shankarganesh_gopal Beginner
Joined: 24 May 2005 Posts: 36 Topics: 20 Location: chennai
|
Posted: Tue Jun 05, 2007 1:36 am Post subject: |
|
|
Hi Kolusu,
I have one more issue now.
I am doing a select using DSNTIAUL. If suppose a column is defined as NULL, then it is producing the result with like '..?'. Is there a way to make it space or proper data.
Thanks a ton. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12367 Topics: 75 Location: San Jose
|
Posted: Tue Jun 05, 2007 6:15 am Post subject: |
|
|
Shankarganesh_gopal,
1. Click on "Quick Manuals" link on top of this page
2. Scroll down to DB2 section and click on the manual " DB2 V7 SQL Reference"
3. Click on
4. In the search box type COALESCE and press search
5. Read the first link which will answer your query
Hope this helps...
Cheers
Kolusu _________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
|
|