|
View previous topic :: View next topic
|
| Author |
Message |
krsenthil85
New User
Joined: 31 Aug 2007 Posts: 55 Location: bangalore
|
|
|
|
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 |
|
 |
prino
Senior Member

Joined: 07 Feb 2009 Posts: 1325 Location: Vilnius, Lithuania
|
|
|
|
| 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 |
|
 |
krsenthil85
New User
Joined: 31 Aug 2007 Posts: 55 Location: bangalore
|
|
|
|
| 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 |
|
 |
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
| Quote: |
Please let me know if this can be done by FileManager or Sort
|
YES. Can be done through SORT
. |
|
| Back to top |
|
 |
krsenthil85
New User
Joined: 31 Aug 2007 Posts: 55 Location: bangalore
|
|
|
|
| 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 |
|
 |
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
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 |
|
 |
krsenthil85
New User
Joined: 31 Aug 2007 Posts: 55 Location: bangalore
|
|
|
|
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 |
|
 |
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
| 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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| 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 |
|
 |
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
| 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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|