Joined: 22 Mar 2009 Posts: 161 Location: South Africa
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 ****************************
Joined: 22 Mar 2009 Posts: 161 Location: South Africa
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
Joined: 22 Mar 2009 Posts: 161 Location: South Africa
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 ********************************
----+----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
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
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.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
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.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
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.
Joined: 22 Mar 2009 Posts: 161 Location: South Africa
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.