|
View previous topic :: View next topic
|
| Author |
Message |
sushanth bobby
Senior Member

Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Change SYSPRINT to be the dataset. |
|
| Back to top |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
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 |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
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 |
|
 |
sushanth bobby
Senior Member

Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
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 |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
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 |
|
 |
sushanth bobby
Senior Member

Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
HI,
How to do this
| Quote: |
| Add an IEBGENER step and copy your SYSOUT data to a dataset. |
|
|
| Back to top |
|
 |
sushanth bobby
Senior Member

Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
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 |
|
 |
sushanth bobby
Senior Member

Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
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 |
|
 |
Srihari Gonugunta
Active User

Joined: 14 Sep 2007 Posts: 295 Location: Singapore
|
|
|
|
Try this,
| Code: |
| //SYSUT2 DD SYSOUT=*,DCB=(RECFM=FBA,LRECL=133) |
|
|
| Back to top |
|
 |
sushanth bobby
Senior Member

Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
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 |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Great, finaaly you made it..
- Ad. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|