IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

DSNTEP2 : OUTPUT PROBLEM


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Mon Sep 22, 2008 11:04 am
Reply with quote

Hi,

Iam running a SELECT QUERY in JCL program using DSNTEP2. The output comes in the SPOOL in SYSPRINT. But, what i want is ?, i want the output to come in the dataset, which i specify.

Code:
//HXSULLXX JOB (T,TEST),'QUERY EXEC',MSGCLASS=X,CLASS=L,NOTIFY=&SYSUID
//DSNTEP2  EXEC PGM=IKJEFT01,COND=(4,LT),DYNAMNBR=20                   
//SYSTSIN  DD  *                                                       
  DSN SYSTEM(DB2D)                                                     
  RUN PROGRAM(DSNTEP2) PLAN(DSNTEP2) -                                 
  LIB('DB2.POPR.PROD.RUNLIB.LOAD')                                     
   END                                                                 
//SYSTSPRT DD  SYSOUT=*                                               
//SYSPRINT DD  SYSOUT=*                                               
//SYSOUT   DD  DSN=HXSULL.QUERYRES,                                   
//             DISP=(MOD,,DELETE),                                     
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=2400),                   
//             UNIT=SYSDA,SPACE=(TRK,(1,1))                           
//SYSIN    DD  *                                                       
  SELECT ' DEFINE ALIAS (NAME('                                       
     ||LEFT(A.DSNAME,LENGTH(RTRIM(A.DSNAME))-9)                       
     ||'.D'                                                           
     ||'  RELATE ('                                                   
     ||RTRIM(A.DSNAME)                                                 
     ||'))'                                                           
    FROM SYSIBM.SYSCOPY A                                             
    WHERE A.ICTYPE = 'F'                                               
    AND A.TIMESTAMP >= CURRENT TIMESTAMP - 4 HOURS                     
    AND A.JOBNAME LIKE 'PDBC500I'                                     
    AND A.TIMESTAMP = (SELECT MAX(B.TIMESTAMP)                     
   FROM SYSIBM.SYSCOPY B                                           
  WHERE B.DBNAME  = A.DBNAME                                       
    AND B.TSNAME  = A.TSNAME                                       
    AND B.DSNUM   = A.DSNUM                                         
    AND B.JOBNAME = A.JOBNAME                                       
    AND B.ICTYPE  ='F');                                           


All the output, which i get in the SYSPRINT i want it in the SYSOUT.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Sep 22, 2008 11:15 am
Reply with quote

Hello,

Change SYSPRINT to be the dataset.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Sep 22, 2008 12:29 pm
Reply with quote

Hi,

Dick has already suggested a way to do what you want, actually it's same as you route the SYSOUT to some DSN in the shown JCL. But my question is - you are running a "Batch query", aren't you interested in the results of that query instead of contents of SYSPRINT ? I don't see any DD statement for the results of the query executed..
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Sep 22, 2008 12:38 pm
Reply with quote

Hello again,

Reread your question, what does this mean
Quote:
which i get in the SYSPRINT i want it in the SYSOUT.
there ?
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Mon Sep 22, 2008 12:48 pm
Reply with quote

Hi,

Quote:
Dick : Change SYSPRINT to be the dataset.


Is this what you said,
Code:
//SYSPRINT   DD  DSN=HXSULL.QUERYRES,                                   
//                 DISP=(MOD,,DELETE),                                     
//                 DCB=(RECFM=FB,LRECL=80,BLKSIZE=2400),                   
//                 UNIT=SYSDA,SPACE=(TRK,(1,1))                           



Anuj : Not a batch query. Yes, iam interested in the result. But, i want the result in the file as well as the SPOOL.
i.e., When i run this JCL, in SPOOL in SYSPRINT i get the records(results).
All the data present in the SYSPRINT(spool), i want it in a FILE. "HXSULL.QUERYRES"
This file should like the copy of SYSPRINT.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Sep 22, 2008 1:26 pm
Reply with quote

Hi,
sushanth bobby wrote:
Is this what you said,
Probably yes, you have some further question ?

Quote:
iam interested in the result. But, i want the result in the file as well as the SPOOL.
Add an IEBGENER step and copy your SYSOUT data to a dataset.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Mon Sep 22, 2008 2:13 pm
Reply with quote

HI,

How to do this
Quote:
Add an IEBGENER step and copy your SYSOUT data to a dataset.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Mon Sep 22, 2008 2:17 pm
Reply with quote

This is my code

Code:
//HXSULLXX JOB (T,TEST),'HXSULL',MSGCLASS=X,CLASS=L,NOTIFY=&SYSUID,   
//         REGION=0M                                                   
//DSNTEP2  EXEC PGM=IKJEFT01,COND=(4,LT),DYNAMNBR=20                   
//SYSTSIN  DD  *                                                       
  DSN SYSTEM(DB2D)                                                     
  RUN PROGRAM(DSNTEP2) PLAN(DSNTEP2) -                                 
  LIB('DB2.POPR.PROD.RUNLIB.LOAD')                                     
   END                                                 
//SYSTSPRT DD  SYSOUT=*                               
//*SYSPRINT DD  SYSOUT=*                               
//SYSOUT   DD  *                                       
//SYSPRINT DD  DSN=HXSULL.QUERY,                       
//             DISP=(NEW,KEEP,KEEP),                   
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=2400),   
//             UNIT=SYSDA,SPACE=(TRK,(1,1))           
//SYSIN    DD  *                                       
SELECT * FROM INEDATAT.INET_CASE                       
FETCH FIRST 100 ROWS ONLY;                             


How to do the IEBGENER part
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Mon Sep 22, 2008 6:39 pm
Reply with quote

Hi,

I saw the JCL forums. Someone else is facing same kind of problem.
ibmmainframes.com/viewtopic.php?t=34494

In that topic, Dick Scherrer Said
Quote:
Write the data to the file first and then copy the file to the SYSOUT so it may remain in jhs as long as you need.


I added this code at the END..

Code:
//GENER    EXEC PGM=IEBGENER           
//SYSUT1   DD DSN=HXSULL.QUERY,DISP=SHR
//SYSUT2   DD SYSOUT=*                 
//SYSPRINT DD SYSOUT=*                 
//SYSIN    DD DUMMY                   

The job is abending....

Tell me how to use th IEBGENER correctly.......
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Mon Sep 22, 2008 7:31 pm
Reply with quote

Try this,
Code:
//SYSUT2   DD SYSOUT=*,DCB=(RECFM=FBA,LRECL=133)
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Mon Sep 22, 2008 8:22 pm
Reply with quote

Thank You all & Thank You Srihari......

This is the final CODE
Code:
//HXSULLXX JOB (T,TEST),'HXSULL',MSGCLASS=X,CLASS=L,NOTIFY=&SYSUID,   
//         REGION=0M                                                   
//DSNTEP2  EXEC PGM=IKJEFT01,COND=(4,LT),DYNAMNBR=20                   
//SYSTSIN  DD  *                                                       
  DSN SYSTEM(DB2D)                                                     
  RUN PROGRAM(DSNTEP2) PLAN(DSNTEP2) -                                 
  LIB('DB2.POPR.PROD.RUNLIB.LOAD')                                     
   END                                                                 
//SYSTSPRT DD  SYSOUT=*                                                 
//SYSOUT   DD  *                                                       
//SYSPRINT DD  DSN=HXSULL.QUERY,                                       
//             DISP=(NEW,KEEP,KEEP),                                   
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=2400),                   
//             UNIT=SYSDA,SPACE=(TRK,(1,1))                             
//SYSIN    DD  *                                                       
SELECT * FROM INEDATAT.INET_CASE                                       
FETCH FIRST 100 ROWS ONLY;                                             
END                                                                     
//GENER    EXEC PGM=IEBGENER                                           
//SYSUT1   DD DSN=HXSULL.QUERY,DISP=SHR                                 
//SYSUT2   DD SYSOUT=*,DCB=(RECFM=FBA,LRECL=133)                       
//SYSPRINT DD SYSOUT=*                                                 
//SYSIN    DD DUMMY                                                     


Now the records are in SPOOL(SYSUT2) as well as the DATASET.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Sep 22, 2008 8:43 pm
Reply with quote

Great, finaaly you made it.. icon_smile.gif

- Ad.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts Build a record in output file and rep... DFSORT/ICETOOL 11
No new posts XDC SDSF output to temp dataset CLIST & REXX 4
Search our Forums:

Back to Top