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

Identify error records


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

New User


Joined: 31 Aug 2007
Posts: 55
Location: bangalore

PostPosted: Thu Apr 28, 2016 9:45 pm
Reply with quote

Hi,

I have the requirement to catchup the error in the following file. In the below file it has three transaction and each trasaction starts with 'P' record and ends with 'E' Record.

If there is a character '*' in any records then that is the error record and I have to write the
'P' Record and that particular error record to the output file.

In this first transaction the S record (highlighted) has error and I have to write both P and S record in the output
P,OAHKP01071118,20140728,20140701,60,MJCtest3,USD,2006709MO,,
S,*,2642097,500,10,1812~

In the second transaction the P record(Highlighte) has error and I have to write only the P record in the output
P,OAHKP01011119,20140821,20140622,60,MJCtest2,USD,171HK,,~



P,OAHKP01071118,20140728,20140701,60,MJCtest3,USD,2006709MO,,
S,1,2642097,500,22,3986.4~
S,*,2642097,500,10,1812~
S,3,2642097,800,2,362.4~
S,4,2642097,700,1,226.5~
S,5,2642097,203,5,75.5~
S,6,2642097,700,11,2491.5~
E,337,34654.5~
P,OA*KP01011119,20140821,20140622,60,MJCtest2,USD,171HK,,~
S,1,3462138,111,14,274.4~
S,2,3402138,110,5,98~
S,3,3462138,109,12,235.2~
S,4,3462138,112,1,19.6~
E,66,1293.6~
P,OAHKP01111150,20140801,20130815,60,HH0583/13,USD,2015286HK,,~
S,1,1629987,102,55,1118.7~
S,2,1629987,124,12,244.08~
S,3,1629987,104,37,752.58~
S,4,1629987,105,30,610.2~
S,5,1629987,106,28,569.52~
E,66,1293.6~

Please let me know if this can be done by FileManager or Sort card. We are not allowed to do the Eztrieve as per our standard.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Thu Apr 28, 2016 11:35 pm
Reply with quote

krsenthil85 wrote:
Please let me know if this can be done by FileManager or Sort card.


Can you tell us something more about this product called "Sort card"?
Back to top
View user's profile Send private message
krsenthil85

New User


Joined: 31 Aug 2007
Posts: 55
Location: bangalore

PostPosted: Thu Apr 28, 2016 11:44 pm
Reply with quote

prino wrote:
krsenthil85 wrote:
Please let me know if this can be done by FileManager or Sort card.


Can you tell us something more about this product called "Sort card"?


I mean to say it is Sort utility. sorry for the confusion
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Fri Apr 29, 2016 12:23 am
Reply with quote

Quote:
Please let me know if this can be done by FileManager or Sort

YES. Can be done through SORT

.
Back to top
View user's profile Send private message
krsenthil85

New User


Joined: 31 Aug 2007
Posts: 55
Location: bangalore

PostPosted: Fri Apr 29, 2016 1:11 am
Reply with quote

RahulG31 wrote:
Quote:
Please let me know if this can be done by FileManager or Sort

YES. Can be done through SORT

.


Hi Rahul, Can you give me an overview how it can be done through the Sort utility
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Fri Apr 29, 2016 1:18 am
Reply with quote

Considering FB LRECL 30 record:
Code:
 INCLUDE COND=(1,1,CH,EQ,C'P',OR,1,30,SS,EQ,C'*')
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'P'),PUSH=(31:1,30))
 OUTFIL INCLUDE=(1,30,SS,EQ,C'*'),BUILD=(31,30,/,1,30)
 OPTION COPY

This should be close enough.

.
Back to top
View user's profile Send private message
krsenthil85

New User


Joined: 31 Aug 2007
Posts: 55
Location: bangalore

PostPosted: Fri Apr 29, 2016 1:54 am
Reply with quote

Thanks Rahul for the key. I am getting close to the expected result.

If I have two error records in one group and it is writing P record two times for each S record. Can

P,OAHKP01071118,20140728,00001
S,1,2*42097,500,22,3986.4~
P,OAHKP01071118,20140728,00001
S,3,26420*7,800,2,362.4~
P,OAHKP01011119,20140821,00003
S,7,3462*38,112,1,19.6~
P,OAHKP01111150,20140801,00005
S,9,1629987,*10,30,610.2~

But I want to write the P record only once irrespective to the number of S records in that group. Can you please suggest
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Fri Apr 29, 2016 2:57 am
Reply with quote

If you add RECORDS=2 after PUSH then you would create a blank line instead of another P record.
Code:
PUSH=(31:1,30),RECORDS=2)

That will be a little better, But I think, you may have to use ICETOOL to get the desired result i.e. to remove blank line and also remove duplicate for a P record having an * .
You would also be able to use RESIZE operator in ICETOOL instead of / in OUTFIL.

I'll let you ponder over that.

.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Apr 29, 2016 4:08 am
Reply with quote

Have a SEQ also on the PUSH, large enough for the maximum records there can be in a group.

Make the BUILD conditional, when SEQ-field is one, output the P and the data. WHEN=NONE, only output the data.

The RECORDS=2 would also work, when you'd test for blank in the P-field, to only output data otherwise output both (that's what the / does, output two records).

No need for ICETOOL or multiple steps. Just IFTHEN=(WHEN=(logicicalexpression) and WHEN=NONE.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Fri Apr 29, 2016 8:35 pm
Reply with quote

Quote:
Make the BUILD conditional

Yes, that was missing. I've added that and now it should get the desired result.
Code:
 INCLUDE COND=(1,1,CH,EQ,C'P',OR,1,30,SS,EQ,C'*')
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'P'),
                            PUSH=(31:1,30),RECORDS=2),
       IFTHEN=(WHEN=(1,30,CH,EQ,31,30,CH),OVERLAY=(31:30X))
 OUTFIL INCLUDE=(1,30,SS,EQ,C'*'),IFTHEN=(WHEN=(31,1,CH,NE,C' '),
 BUILD=(31,30,/,1,30))
 OPTION COPY

.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Apr 29, 2016 9:04 pm
Reply with quote

I imagine that you have an LRECL of 30 on your output dataset. It is much better to put the WHEN=NONE,BUILD=(1,30) and leave the LRECL out of the JCL.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Fri Apr 29, 2016 9:24 pm
Reply with quote

Quote:
I imagine that you have an LRECL of 30 on your output dataset.

No, I don't. And I did check with a LRECL 80 output file and it gave the same result. But, I think, it's the absence of WHEN=NONE that makes us wonder how we are getting the 31=space record. Isn't it ?

.
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 Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
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 CLIST - Virtual storage allocation error CLIST & REXX 5
Search our Forums:

Back to Top