I have some problem with DFSORT. I was trying to do it but I am not able to. I'm trying to explain my scenario.
I have one GDG base with 3 generation named
SSR.SUDIPGDG.MY1STGDG.G0000V00
SSR.SUDIPGDG.MY1STGDG.G0010V00
SSR.SUDIPGDG.MY1STGDG.G0020V00
IN ALL CASES (LRECL=133,RECFM=FB,BLKSIZE=27398)
In every Generation, there are some records as:
FOR 1ST GENERATION
1REPORT ID: 0001
CURRENT DATE: 04/21/2012
CURRENT TIME: 21:58:59
blank line
****************************************************
(this line may or may not be blank)
FINAL TRANSACTION AMOUNT : $12234
TOTAL AMOUNT : $123456-
DATE OF LAST TRANSACTION : 05/21/2011
(this line may or may not be blank)
****************************************************
0
***************** END OF RECORD ********************
FOR 2ND GENERATION
1REPORT ID: 0002
CURRENT DATE: 05/18/2012
CURRENT TIME: 22:00:59
blank line
****************************************************
FINAL TRANSACTION AMOUNT : $6767
TOTAL AMOUNT : $12342
DATE OF LAST TRANSACTION : 01/21/2012
(this line may or may not be blank)
****************************************************
0
***************** END OF RECORD ********************
FOR 3RD GENERATION
1REPORT ID: 0003
CURRENT DATE: 04/18/2012
CURRENT TIME: 21:50:59
blank line
****************************************************
(this line may or may not be blank)
FINAL TRANSACTION AMOUNT : $120
TOTAL AMOUNT : $1236-
DATE OF LAST TRANSACTION : 04/02/2012
(this line may or may not be blank)
****************************************************
0
***************** END OF RECORD ********************
Now, what I need is,
I have an output dataset named SSR.TEST.JCL.OUT1 in which I have to copy only those details in which value of "CURRENT DATE" field is equal to system date and the value of "CURRENT TIME" field is greater than or equal to "22:00:00". So the desired output is like
FINAL TRANSACTION AMOUNT : $6767
TOTAL AMOUNT : $12342
DATE OF LAST TRANSACTION : 01/21/2012
i.e. the details part of only 2nd GENERATION... Please let me know if you want to understand any more.
GDG and DFSORT
Moderators: Frank Yaeger, DikDude, Moderator Group
GDG and DFSORT
Sudip Sen
Assistant Systems Engineer,
Bangalore,
Karnataka - 560037
Assistant Systems Engineer,
Bangalore,
Karnataka - 560037
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Sudip,
You can use a DFSORT job like the following to do what you asked for:
You can use a DFSORT job like the following to do what you asked for:
Code: Select all
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/133)
//SORTOUT DD DSN=... output file (FB/133)
//SYSIN DD *
OPTION COPY
INCLUDE COND=(2,13,CH,EQ,C'CURRENT DATE:',OR,
2,13,CH,EQ,C'CURRENT TIME:',OR,
2,25,CH,EQ,C'FINAL TRANSACTION AMOUNT',OR,
2,12,CH,EQ,C'TOTAL AMOUNT',OR,
3,24,CH,EQ,C'DATE OF LAST TRANSACTION')
INREC IFTHEN=(WHEN=GROUP,BEGIN=(2,13,CH,EQ,C'CURRENT DATE:'),
END=(3,24,CH,EQ,C'DATE OF LAST TRANSACTION'),
PUSH=(134:25,4,19,2,22,2)),
IFTHEN=(WHEN=GROUP,BEGIN=(2,13,CH,EQ,C'CURRENT TIME:'),
END=(3,24,CH,EQ,C'DATE OF LAST TRANSACTION'),
PUSH=(144:20,8))
OUTFIL OMIT=(2,13,CH,EQ,C'CURRENT DATE:',OR,
2,13,SS,CH,C'CURRENT TIME:',OR,
134,4,CH,NE,DATE1,OR,
144,8,CH,LT,C'22:00:00'),
BUILD=(1,133)
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Thanks Frank, I'll try this and let you know the result.Frank Yaeger wrote:Sudip,
You can use a DFSORT job like the following to do what you asked for:
Code: Select all
//S1 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD DSN=... input file (FB/133) //SORTOUT DD DSN=... output file (FB/133) //SYSIN DD * OPTION COPY INCLUDE COND=(2,13,CH,EQ,C'CURRENT DATE:',OR, 2,13,CH,EQ,C'CURRENT TIME:',OR, 2,25,CH,EQ,C'FINAL TRANSACTION AMOUNT',OR, 2,12,CH,EQ,C'TOTAL AMOUNT',OR, 3,24,CH,EQ,C'DATE OF LAST TRANSACTION') INREC IFTHEN=(WHEN=GROUP,BEGIN=(2,13,CH,EQ,C'CURRENT DATE:'), END=(3,24,CH,EQ,C'DATE OF LAST TRANSACTION'), PUSH=(134:25,4,19,2,22,2)), IFTHEN=(WHEN=GROUP,BEGIN=(2,13,CH,EQ,C'CURRENT TIME:'), END=(3,24,CH,EQ,C'DATE OF LAST TRANSACTION'), PUSH=(144:20,8)) OUTFIL OMIT=(2,13,CH,EQ,C'CURRENT DATE:',OR, 2,13,SS,CH,C'CURRENT TIME:',OR, 134,4,CH,NE,DATE1,OR, 144,8,CH,LT,C'22:00:00'), BUILD=(1,133) /*
Sudip Sen
Assistant Systems Engineer,
Bangalore,
Karnataka - 560037
Assistant Systems Engineer,
Bangalore,
Karnataka - 560037
Yes, new topic surely. But it would be better if the topic is started in the correct part of the forum: Dfsort not JCL - which is what DikDude was pointing out.its.sudip wrote:No such reason was there. I thought it would be better if I post it in a new topic. Thanks DikDude for the info.DikDude wrote:Is there some reason you did not post this in the DFSORT part of the forum?
Regards
Nic
Nic
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page