IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Grouing Of Records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 161
Location: South Africa

PostPosted: Tue May 28, 2013 2:49 pm
Reply with quote

Hi,

My Input file is LRECL=500, RECFM=FB.
i/p Data Is:
Code:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data
000001  :::DAILY CHECKLIST FOR SYS1 : DATETIME - Wed May 22 20:33:42 2013 ::: 
000002   :::APPLICATION PROCESS FOR SYS1:::                                   
000003  ERROR:  AAAAA_BBBBBBB   IS NOT RUNNING                                 
000004     :::XXX-XX PROCESS FOR SYS1:::                                       
000005  ERROR:   AAAA_BBB_CCC   IS RUNNING                                     
000006    :::XXX FILE BUILDUP:::                                               
000007    :::MEMORY QUEUE BUILDUP:::                                           
000008   :::EVENT TRACE ERROR MESSAGES:::                                     
000009   :::INTERFACE CONNECTION STATUS:::                                     
000010    :::DISK SPACE UTILIZATION:::                                         
****** **************************** Bottom of Data ****************************


My output will be whenever it finds ERROR then it should print the previous line. :

Code:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000001   :::APPLICATION PROCESS FOR SYS1:::                                   
000002  ERROR:  AAAAA_BBBBBBB   IS NOT RUNNING                                 
000003     :::XXX-XX PROCESS FOR SYS1:::                                       
000004  ERROR:   AAAA_BBB_CCC   IS RUNNING                                     
****** **************************** Bottom of Data ****************************
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 161
Location: South Africa

PostPosted: Tue May 28, 2013 3:07 pm
Reply with quote

I missed one more thing i.e. a heading may contain multiple 'ERROR'. Also the heading always starts with ':::' but the position is not defined. And the 'ERROR' always starts at position 2.

Code:
******************************
000001  :::DAILY CHECKLIST FOR SYS1 : DATETIME - Wed May 22 20:33:42 2013 ::: 
000002   :::APPLICATION PROCESS FOR SYS1:::                                   
000003  ERROR:  AAAAA_BBBBBBB   IS NOT RUNNING                                 
000004     :::XXX-XX PROCESS FOR SYS1:::                                       
000005  ERROR:   AAAA_BBB_CCC   IS NOT RUNNING                                     
000006    :::XXX FILE BUILDUP:::                                               
000006  ERROR:  AAAAA_BBBBBBB   IS NOT RUNNING                                 
000007  ERROR:  AAAAA_CCCCCCC   IS NOT RUNNING                                 
000008    :::MEMORY QUEUE BUILDUP:::                                           
000009   :::EVENT TRACE ERROR MESSAGES:::                                     
000010   :::INTERFACE CONNECTION STATUS:::                                     
000011    :::DISK SPACE UTILIZATION:::                                         
****** **************************** Bottom of Data ****************************


output is:
Code:
000002   :::APPLICATION PROCESS FOR SYS1:::                                   
000003  ERROR:  AAAAA_BBBBBBB   IS NOT RUNNING                                 
000004     :::XXX-XX PROCESS FOR SYS1:::                                       
000005  ERROR:   AAAA_BBB_CCC   IS NOT RUNNING                                     
000006    :::XXX FILE BUILDUP:::                                               
000006  ERROR:  AAAAA_BBBBBBBB   IS NOT RUNNING                                 
000007  ERROR:  AAAAA_CCCCCCC   IS NOT RUNNING                                 
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Tue May 28, 2013 8:57 pm
Reply with quote

Code:
  000008    :::MEMORY QUEUE BUILDUP:::                                           
000009   :::EVENT TRACE ERROR MESSAGES:::                                     
000010   :::INTERFACE CONNECTION STATUS:::                                     
000011    :::DISK SPACE UTILIZATION:::                                         


If the above is gonna be standard then you could achieve it with INCLUDE COND itself

Or I am missing something
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 161
Location: South Africa

PostPosted: Tue May 28, 2013 10:04 pm
Reply with quote

No. Actually Each string which contains ":::" is the header and the =n for each header multiple 'ERROR' are there. If a header dont have "ERROR" in the next records then the output should not contain the header record.Please see more more i/p and o/p:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
.:::DAILY CHECKLIST FOR XXXX : DATETIME - Sun May 19 20:33:22 2013 :::    .     
..:::APPLICATION PROCESS FOR.AAAA:::.    .                                     
ERROR:. .EVENT_ADAPTER.. IS NOT RUNNING                                         
... :::AAA-XS PROCESS FOR RCB3:::. .    .                                       
...:::BBB FILE BUILDUP:::. .    .                                               
...:::MEMORY QUEUE BUILDUP::: .    .                                           
..:::XXXXX TRACE ERROR MESSAGES:::. .    .                                     
ERROR:  DATE TIME         : 2013-05-18T00:55:40.497+02:00                       
ERROR:  EVENT TEXT        : Endpoint message delivery failure (SymSrc INTFHI93 S
ERROR:  DATE TIME         : 2013-05-18T01:56:40.499+02:00                       
ERROR:  EVENT TEXT        : Endpoint message delivery failure (SymSrc INTFHI93 S
ERROR:  DATE TIME         : 2013-05-18T02:57:40.500+02:00                       
ERROR:  EVENT TEXT        : Endpoint message delivery failure (SymSrc INTFHI93 S
ERROR:  DATE TIME         : 2013-05-18T03:58:40.502+02:00                       
ERROR:  EVENT TEXT        : Endpoint message delivery failure (SymSrc INTFHI93 S
ERROR:  DATE TIME         : 2013-05-18T04:59:40.503+02:00                       
..:::INTERFACE CONNECTION STATUS::: .    .                                     
...:::DISK SPACE UTILIZATION::: .    .                                         
ERROR::  LAST XXXX REFRESH FAILED, PLEASE CHECK THE LOG                         
******************************** Bottom of Data ********************************

So, o/p will be:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
..:::APPLICATION PROCESS FOR.AAAA:::.    .                                     
ERROR:. .EVENT_ADAPTER.. IS NOT RUNNING   
..:::XXXXX TRACE ERROR MESSAGES:::. .    .                                     
ERROR:  DATE TIME         : 2013-05-18T00:55:40.497+02:00                       
ERROR:  EVENT TEXT        : Endpoint message delivery failure (SymSrc INTFHI93 S
ERROR:  DATE TIME         : 2013-05-18T01:56:40.499+02:00                       
ERROR:  EVENT TEXT        : Endpoint message delivery failure (SymSrc INTFHI93 S
ERROR:  DATE TIME         : 2013-05-18T02:57:40.500+02:00                       
ERROR:  EVENT TEXT        : Endpoint message delivery failure (SymSrc INTFHI93 S
ERROR:  DATE TIME         : 2013-05-18T03:58:40.502+02:00                       
ERROR:  EVENT TEXT        : Endpoint message delivery failure (SymSrc INTFHI93 S
ERROR:  DATE TIME         : 2013-05-18T04:59:40.503+02:00     
...:::DISK SPACE UTILIZATION::: .    .                                         
ERROR::  LAST XXXX REFRESH FAILED, PLEASE CHECK THE LOG                         
******************************** Bottom of Data ********************************   
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue May 28, 2013 11:52 pm
Reply with quote

abhijit.nayak01,

why isn't

...:::MEMORY QUEUE BUILDUP::: . .
..:::XXXXX TRACE ERROR MESSAGES:::.


Not picked when the next line had ERROR in the text?

Either way it is a simple task. Clue is to make all the records you want as dups and pick the dups.
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 161
Location: South Africa

PostPosted: Wed May 29, 2013 1:50 am
Reply with quote

Thanks Skolusu,

I tried the below code as per your hint:
Code:
//TOOLIN    DD *                                             
  SELECT FROM(IN) TO(OUT) ON(501,8,CH) ALLDUPS USING(CTL1)   
//CTL1CNTL DD *                                             
  INREC IFTHEN=(WHEN=INIT,                                   
       OVERLAY=(501:SEQNUM,8,ZD)),                           
        IFTHEN=(WHEN=(1,500,SS,EQ,C':::'),                   
       OVERLAY=(501:+1,ADD,501,8,ZD,M11,LENGTH=8))           
                                                             
  OUTFIL FNAMES=OUT,                                         
  OUTREC=(01,500)                                           
//*                                         


The o/p is:

Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
..:::APPLICATION PROCESS FOR.AAA:::.    .                                     
ERROR:. .EVENT_ADAPTER.. IS NOT RUNNING                                         
..::XXXXXT TRACE ERROR MESSAGES:::. .    .                                     
ERROR:  DATE TIME         : 2013-05-18T00:55:40.497+02:00                       
...:::DISK SPACE UTILIZATION::: .    .                                         
ERROR::  LAST XXXX REFRESH FAILED, PLEASE CHECK THE LOG                         
******************************** Bottom of Data ********************************


Now here the only issue is only one ERROR is detected after XXXXX TRACE ERROR MESSAGES. May be I will move it some other temp dataset for the below records as I have to find out last 20 mins data from the timestamp mentioned in cols 40-47. Could you please give clue to find the records for last 20 mins from the current time.

Code:
..:::XXXXX TRACE ERROR MESSAGES:::. .    .                                     
ERROR:  DATE TIME         : 2013-05-18T00:55:40.497+02:00                       
ERROR:  EVENT TEXT        : Endpoint message delivery failure (SymSrc INTFHI93 S
ERROR:  DATE TIME         : 2013-05-18T01:56:40.499+02:00                       
ERROR:  EVENT TEXT        : Endpoint message delivery failure (SymSrc INTFHI93 S
ERROR:  DATE TIME         : 2013-05-18T02:57:40.500+02:00                       
ERROR:  EVENT TEXT        : Endpoint message delivery failure (SymSrc INTFHI93 S
ERROR:  DATE TIME         : 2013-05-18T03:58:40.502+02:00                       
ERROR:  EVENT TEXT        : Endpoint message delivery failure (SymSrc INTFHI93 S
ERROR:  DATE TIME         : 2013-05-18T04:59:40.503+02:00     
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed May 29, 2013 9:53 pm
Reply with quote

abhijit.nayak01 wrote:

Now here the only issue is only one ERROR is detected after XXXXX TRACE ERROR MESSAGES.


Well you need to think of a way to get ALL the error records. Use WHEN=GROUP with SEQ and make all the error records as dups.

abhijit.nayak01 wrote:
I have to find out last 20 mins data from the timestamp mentioned in cols 40-47. Could you please give clue to find the records for last 20 mins from the current time.


Last 20 mins? The first thing you need to think of is what happens if I run the job at midnight between 12:00 AM - 12:19 AM? You need to get the records with prior date. so code an 3 IFTHEN statements to validate the time field and generate an INCLUDE cond or a flag that you can use.
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 161
Location: South Africa

PostPosted: Wed May 29, 2013 10:17 pm
Reply with quote

well I found the solution to get the error with 20 min and the i/p file always contains today's record and by no way the date will change.

Code:
//SYSIN    DD   *                                 
 OPTION COPY                                       
 INREC   BUILD=(1:1,500,DATE4)                     
 OUTREC  IFTHEN=(WHEN=INIT,                       
             OVERLAY=(530:(40,2,ZD,MUL,+3600,ADD, 
                       43,2,ZD,MUL,+60,ADD,       
                       46,2,ZD),SUB,               
                     (512,2,ZD,MUL,+3600,ADD,     
                      515,2,ZD,MUL,+60,ADD,       
                      518,2,ZD),                   
                       M11,LENGTH=8))             
        OUTFIL INCLUDE(530,8,ZD,LE,1200)           
/*                                                 



now only problem I am facing is with the GROUP of the records as I need to print both the line i.e.

ERROR: DATE TIME : 2013-05-18T00:55:40.497+02:00
ERROR: EVENT TEXT : Endpoint message delivery failure (SymSrc INTFHI93 S

But I am getting only the first line.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed May 29, 2013 10:38 pm
Reply with quote

abhijit.nayak01 wrote:
well I found the solution to get the error with 20 min and the i/p file always contains today's record and by no way the date will change.


You sure you got the right results? You are subtracting the file time from current time and you ignore the sign from the result of the subtraction. What happens if your file has records with time greater than current time?


abhijit.nayak01 wrote:
now only problem I am facing is with the GROUP of the records as I need to print both the line i.e.

ERROR: DATE TIME : 2013-05-18T00:55:40.497+02:00
ERROR: EVENT TEXT : Endpoint message delivery failure (SymSrc INTFHI93 S

But I am getting only the first line.


As I mentioned earlier you need to use WHEN=GROUP and your earlier control cards aren't going to get the results you want.
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 161
Location: South Africa

PostPosted: Thu May 30, 2013 1:23 am
Reply with quote

Hi Skolusu,

The current time will be always greater than the file time.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu May 30, 2013 1:40 am
Reply with quote

abhijit.nayak01 wrote:
Hi Skolusu,

The current time will be always greater than the file time.


How about the Day light savings ? What happens when you ran your file creation job on Sunday, November 3, 2013 at 1:52:00 AM and created the file time as 1:52:00 AM and when the time is Sunday, November 3, 2013 at 2:00:00 AM clocks are turned backward 1 hour to Sunday, November 3, 2013 at 1:00:00 AM local standard time instead.

Is your current time still greater than your file time?

As I said you need to consider ALL the possible scenarios and code your job accordingly instead of assuming.
Back to top
View user's profile Send private message
abhijit.nayak01

Active User


Joined: 22 Mar 2009
Posts: 161
Location: South Africa

PostPosted: Thu May 30, 2013 2:53 am
Reply with quote

Hi Skolusu,
I will consider the scenarios which you mentioned. Could you please assist on the suggestion to find the best 20 min solution.
Meanwhile I managed to get the records as per expectation. Please see below and kindly assist if I can achieve in better way.

Code:
//SYSIN    DD   *                                                       
 OPTION COPY                                                           
  INREC   IFTHEN=(WHEN=INIT,                                           
          BUILD=(1:1,500,DATE4))                                       
  OUTREC  IFTHEN=(WHEN=INIT,                                           
              OVERLAY=(530:(40,2,ZD,MUL,+3600,ADD,                     
                        43,2,ZD,MUL,+60,ADD,                           
                        46,2,ZD),SUB,                                   
                      (512,2,ZD,MUL,+3600,ADD,                         
                       515,2,ZD,MUL,+60,ADD,                           
                       518,2,ZD),                                       
                        M11,LENGTH=8)),                                 
          IFTHEN=(WHEN=GROUP,BEGIN=(9,9,CH,EQ,C'DATE TIME'),           
                   END=(9,10,CH,EQ,C'EVENT TEXT'),                     
                   PUSH=(537:530,8))                                   
  OUTFIL INCLUDE(537,8,ZD,LE,1200),                                     
         BUILD(1,500)                                                   
/*                                                                     
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top