GDG and DFSORT

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
User avatar
its.sudip
Member
Posts: 19
Joined: Sat Apr 28, 2012 1:55 pm
Location: Bangalore

GDG and DFSORT

Post by its.sudip » Fri May 18, 2012 11:17 pm

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.
Sudip Sen
Assistant Systems Engineer,
Bangalore,
Karnataka - 560037

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Fri May 18, 2012 11:32 pm

Is there some reason you did not post this in the DFSORT part of the forum?
Have a good one

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Fri May 18, 2012 11:56 pm

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)
/*
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

User avatar
its.sudip
Member
Posts: 19
Joined: Sat Apr 28, 2012 1:55 pm
Location: Bangalore

Post by its.sudip » Sat May 19, 2012 6:06 pm

DikDude wrote:Is there some reason you did not post this in the DFSORT part of the forum?
No such reason was there. I thought it would be better if I post it in a new topic. Thanks DikDude for the info.
Sudip Sen
Assistant Systems Engineer,
Bangalore,
Karnataka - 560037

User avatar
its.sudip
Member
Posts: 19
Joined: Sat Apr 28, 2012 1:55 pm
Location: Bangalore

Post by its.sudip » Sat May 19, 2012 6:09 pm

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)
/*
Thanks Frank, I'll try this and let you know the result.
Sudip Sen
Assistant Systems Engineer,
Bangalore,
Karnataka - 560037

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Sun May 20, 2012 11:13 am

its.sudip wrote:
DikDude wrote:Is there some reason you did not post this in the DFSORT part of the forum?
No such reason was there. I thought it would be better if I post it in a new topic. Thanks DikDude for the info.
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.
Regards
Nic

Post Reply

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



Other References
Mainframe Tools and others