Page 1 of 1

GDG and DFSORT

Posted: Fri May 18, 2012 11:17 pm
by its.sudip
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.

Posted: Fri May 18, 2012 11:32 pm
by DikDude
Is there some reason you did not post this in the DFSORT part of the forum?

Posted: Fri May 18, 2012 11:56 pm
by Frank Yaeger
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)
/*

Posted: Sat May 19, 2012 6:06 pm
by its.sudip
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.

Posted: Sat May 19, 2012 6:09 pm
by its.sudip
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.

Posted: Sun May 20, 2012 11:13 am
by NicC
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.