|
View previous topic :: View next topic
|
| Author |
Message |
apandey
New User

Joined: 31 Aug 2009 Posts: 73 Location: Mumbai
|
|
|
|
Hi ALL,
I have my input file of 20 lenght, 1st 5 are member-code , rest 15 are each member's value.
------------------------
0318900000012345876I
0451200000000012416D
0451800000000469576{
0456600000000739660H
0459900000000067484B
0804400000000000000{
0806800000022749564E
1) I want in my output file only Member Code 08068 and 08072 and Its
value. If these 2 codes found more than once then its value needs to
be summed up.
2) If any of these 2 codes are not present then Output should come as
below
08068000000000000000 -> if 08068 is missing
08072000000000000000 -> if 08072 is missing
I m able to write 1st condition but not the second.
Can anyone pls help. |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
What is the data type of value field (in what format value is present?)
Please show us what have you tried till now. |
|
| Back to top |
|
 |
apandey
New User

Joined: 31 Aug 2009 Posts: 73 Location: Mumbai
|
|
|
|
As i said, I have tried for 1st condition: Below Sortcard depicts datatype also.
SORT FIELDS=(1,7,CH,A)
INCLUDE COND=(1,7,CH,EQ,C'08072',OR,1,7,CH,EQ,C'08068')
SUM FIELDS=(8,15,ZD)
but I m not able to code for 2nd condtion. |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
| apandey wrote: |
As i said, I have tried for 1st condition: Below Sortcard depicts datatype also.
SORT FIELDS=(1,7,CH,A)
INCLUDE COND=(1,7,CH,EQ,C'08072',OR,1,7,CH,EQ,C'08068')
SUM FIELDS=(8,15,ZD)
but I m not able to code for 2nd condtion. |
This contradicts with your original post.. you said
LRECL is 20 (5 byte key and 15 byte value)
but
here it looks
LRECL is 22 (7 byte key and 15 bytes value)
Anyways, I take it as 20 byte LRECL with 5 byte key (modify if needed)
Create DUMMY file like this
| Code: |
08068000000000000000
08072000000000000000
|
And use your code
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=YOUR.INPUT.FILE.HERE
// DD DISP=SHR,DSN=YOUR.DUMMY.FILE.HERE
//SORTOUT DD DSN=YOUR.OUTPUT.FILE.HERE
//SYSIN DD *
SORT FIELDS=(1,5,CH,A)
INCLUDE COND=(1,5,CH,EQ,C'08072',OR,1,5,CH,EQ,C'08068')
SUM FIELDS=(6,15,ZD)
/*
|
|
|
| Back to top |
|
 |
apandey
New User

Joined: 31 Aug 2009 Posts: 73 Location: Mumbai
|
|
|
|
You are simply genious my frnd....
I was thinking of all complicated way but u provided such a simple solution..!!
Superb !! Excellent !! Thanks a ton.  |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
| apandey wrote: |
You are simply genious my frnd....
I was thinking of all complicated way but u provided such a simple solution..!!
Superb !! Excellent !! Thanks a ton.  |
I am happy it helped.  |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|