Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

DSNTEP2 : OUTPUT PROBLEM

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Mon Sep 22, 2008 11:04 am    Post subject: DSNTEP2 : OUTPUT PROBLEM
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

Site Director


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

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

Hello,

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

Senior Member


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

PostPosted: Mon Sep 22, 2008 12:29 pm    Post subject:
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

Senior Member


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

PostPosted: Mon Sep 22, 2008 12:38 pm    Post subject:
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: 1013
Location: India

PostPosted: Mon Sep 22, 2008 12:48 pm    Post subject:
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

Senior Member


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

PostPosted: Mon Sep 22, 2008 1:26 pm    Post subject:
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: 1013
Location: India

PostPosted: Mon Sep 22, 2008 2:13 pm    Post subject:
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: 1013
Location: India

PostPosted: Mon Sep 22, 2008 2:17 pm    Post subject:
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: 1013
Location: India

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

Hi,

I saw the JCL forums. Someone else is facing same kind of problem.
http://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    Post subject:
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: 1013
Location: India

PostPosted: Mon Sep 22, 2008 8:22 pm    Post subject:
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

Senior Member


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

PostPosted: Mon Sep 22, 2008 8:43 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts Strings with double quotes having pro... raja Arumugam All Other Mainframe Topics 11 Thu Mar 30, 2017 10:34 am
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us