Page 1 of 2

Matches keyword write the

PostPosted: Wed Oct 15, 2014 5:48 pm
by deva_048
Is it possbile to extract output file as mentioned below: I already tried group but can't able to get the exact output. Please help me
i/P File:
AAAA001|2014|ABEND       |10/15|05:00|05:10
AAAA001|2014|COMPLETE    |10/15|05:40|05:50
AAAA002|2014|ABEND       |10/15|06:00|06:10
AAAA002|2014|PURGED      |10/15|06:40|06:50
AAAA003|2014|COMPLETE    |10/15|07:00|07:10



O/P File:

AAAA001|2014|COMPLETE    |10/15|05:00|05:50
AAAA002|2014|PURGED      |10/15|06:00|06:50
AAAA003|2014|COMPLETE    |10/15|07:00|07:10

Re: Matches keyword write the

PostPosted: Wed Oct 15, 2014 9:13 pm
by Thampy
I assume that are you are looking for the last occurrence of the group (Positions 1-7)

//STEP010  EXEC  PGM=SORT                             
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                       
AAAA001|2014|ABEND       |10/15|05:00|05:10           
AAAA001|2014|COMPLETE    |10/15|05:40|05:50           
AAAA002|2014|ABEND       |10/15|06:00|06:10           
AAAA002|2014|PURGED      |10/15|06:40|06:50           
AAAA003|2014|COMPLETE    |10/15|07:00|07:10           
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                       
 SORT FIELDS=COPY                                     
 OUTFIL REMOVECC,NODETAIL,SECTIONS=(1,7,               
 TRAILER3=(1,80))                                     
/*                           

If the key is not sorted, then use SORT FIELDS=(1,7,CH,A)

Re: Matches keyword write the

PostPosted: Wed Oct 15, 2014 9:19 pm
by BillyBoyo
I think what you want is just an INCLUDE FIELDS=(....

Re: Matches keyword write the

PostPosted: Wed Oct 15, 2014 9:23 pm
by deva_048
I am looking for the time fields start time from the abend row and end time from the purge row for each job should be write into a new file

Re: Matches keyword write the

PostPosted: Thu Oct 16, 2014 6:20 pm
by Thampy
Please try the below JCL.
//SYSIN    DD *                                                       
 SORT FIELDS=(1,7,CH,A,81,4,ZD,D)                                     
 INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,4,ZD,RESTART=(1,7))),     
       IFTHEN=(WHEN=GROUP,BEGIN=(81,4,ZD,EQ,1),PUSH=(85:33,5))       
 OUTREC OVERLAY=(81:SEQNUM,4,ZD,RESTART=(1,7),33:85,5)               
 OUTFIL INCLUDE=(81,4,ZD,EQ,1),BUILD=(1,80)                           
/*


The output is coming as

AAAA001|2014|COMPLETE |10/15|05:00|05:50
AAAA002|2014|PURGED |10/15|06:00|06:50
AAAA003|2014|COMPLETE |10/15|07:00|07:10

Re: Matches keyword write the

PostPosted: Fri Oct 17, 2014 12:48 am
by NicC
Thampy

Those are mainly sort control cards - not JCL.

One day we might get people to use the correct words at the correct time!

Re: Matches keyword write the

PostPosted: Fri Oct 17, 2014 1:41 am
by Terry Heinze
One day we might get people to use the correct words at the correct time!

Don't hold your breath, NicC. :)

Re: Matches keyword write the

PostPosted: Fri Oct 17, 2014 1:53 am
by Thampy
My apologies. I wrongly mentioned the sort control cards as JCL.

Re: Matches keyword write the

PostPosted: Sat Oct 18, 2014 3:00 am
by NicC
:lol: :lol:

Re: Matches keyword write the

PostPosted: Fri Oct 24, 2014 9:10 am
by deva_048
Thanks for your timely response. Above code worked perfectly. There is a minor change in our requirement. The complete/purged status will always in first row of each job in the i/p file.
Is it possible to get the below o/p file?

i/p file
AAAA001|2014|COMPLETE    |10/15|05:40|05:50
AAAA001|2014|ABEND       |10/15|05:20|05:30
AAAA001|2014|ABEND       |10/15|05:00|05:10
AAAA002|2014|PURGED      |10/15|06:40|06:50
AAAA002|2014|ABEND       |10/15|06:10|06:20
AAAA003|2014|COMPLETE    |10/15|07:00|07:10


o/p File
AAAA001|2014|COMPLETE    |10/15|05:00|05:50
AAAA002|2014|PURGED      |10/15|06:10|06:50
AAAA003|2014|COMPLETE    |10/15|07:00|07:10