Posted: Wed May 06, 2009 3:03 pm Post subject: Select Previous record if condition met
Hi All,
I have a input report file LRECL=121 and RECFM=FBA.
I want to extract the records that have letters "TS" in postion 45 and the previous record as shown in the output
Input
Code:
1 Date: 2/19/2009 Time: 16.05.35 Page: 1
LOGPRINT DETAIL REPORT
CMD TBL DBID URI BLOCK L# TSN JOB NAME R-UNIT MP USER ID AREA MONITOR INFO INPUT RECORD FPR RXX
DATE TIME CLOCK SEC.USER MOVE TO LRID PREV LRSN LBSN TASK STATUS RECL DATA
UPDAT P66 187 0293F220 0049CC01 00 AADEE441 LCC370 51,340 ZLW9125 B04 56
02/18/2009 22.39.29 C3C4E67EC2B11681 PRODJOBZ 00000000 06CDBD37 06CDBD36 04A1C7B7 00140A89 56 B 0141 2E26
UPDAT P66 187 0293F221 0049CC01 00 AADEE441 LCC370 51,340 ZLW9125 B04 57
02/18/2009 22.39.29 C3C4E67EC2BCF580 TS123456 00000000 06CDBD38 06CDBD37 04A1C7B8 00140A89 56 B 0141 2E26
1 (CONTINUED) Date: 2/19/2009 Time: 16.05.35 Page: 2
LOGPRINT DETAIL REPORT
CMD TBL DBID URI BLOCK L# TSN JOB NAME R-UNIT MP USER ID AREA MONITOR INFO INPUT RECORD FPR RXX
DATE TIME CLOCK SEC.USER MOVE TO LRID PREV LRSN LBSN TASK STATUS RECL DATA
The sequence number will be generated for every record and when the Letters "TS" found at 45 postion we are subtracting one from the sequence number so that both the sequence number will be same.
In the select statement we are selecting only duplicate sequece number.
Joined: 12 Jun 2007 Posts: 64 Topics: 17 Location: Hyderabad
Posted: Thu May 14, 2009 3:48 am Post subject:
Hi Chandra,
Such a simple logic and I was braking my head.........actually I was not aware that in the control card we were negating one to get the duplicate value in the sequence number generation......
Kolusu, as per Chandra's request in writing, the ouput is correct. But, I was looking for the output that was shown in picture in the top of this post. It shows three lines and 6 lines in total. Let me know if it is achievable too...
Am I wrong somewhere?
Thanks. _________________ MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Fri Aug 21, 2009 11:05 am Post subject:
mf_user,
I have no clue as to what you are talking.The last post from you shows only 4 lines of data(when viewed even in 1024 X 768 resolution) which is the correct output according to chandra's request.
If your requirement is different then show us a sample input and desired output. _________________ Kolusu
www.linkedin.com/in/kolusu
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Wed Aug 26, 2009 10:31 am Post subject:
mf_user,
Your input and output doesn't match. There are 2 A3 records and your output shows only the first A3 record pair , what happened to the next A3? Why is it dropped?
What happens if an A3 record found and the previous 2 records overlaps with another A3?
Kolusu, my actual output needs to be as I shown above.
Whenever a third record has 'A3' in 21st column, I want to copy the previous two records to outut file. In the above test input, only the 2nd set of records has the "A3" in the third record.
Thanks. _________________ MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Thanks Kolusu. I will try it and come back.... _________________ MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum