MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to get Header while using DSNTIAUL

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
Shankarganesh_gopal
Beginner


Joined: 24 May 2005
Posts: 36
Topics: 20
Location: chennai

PostPosted: Mon May 28, 2007 1:12 am    Post subject: How to get Header while using DSNTIAUL Reply with quote

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
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 525
Topics: 89
Location: Bangalore India

PostPosted: Mon May 28, 2007 10:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Tue May 29, 2007 3:42 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Tue May 29, 2007 8:17 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Shankarganesh_gopal
Beginner


Joined: 24 May 2005
Posts: 36
Topics: 20
Location: chennai

PostPosted: Wed May 30, 2007 12:50 am    Post subject: Reply with quote

Thanks a lot kolsu.

I worked and i got my problem solved.
Back to top
View user's profile Send private message
Shankarganesh_gopal
Beginner


Joined: 24 May 2005
Posts: 36
Topics: 20
Location: chennai

PostPosted: Tue Jun 05, 2007 1:36 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Tue Jun 05, 2007 6:15 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group