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

IF condition in SORT


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

New User


Joined: 31 Aug 2009
Posts: 73
Location: Mumbai

PostPosted: Tue Apr 12, 2011 3:00 pm
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Apr 12, 2011 3:19 pm
Reply with quote

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
View user's profile Send private message
apandey

New User


Joined: 31 Aug 2009
Posts: 73
Location: Mumbai

PostPosted: Tue Apr 12, 2011 3:24 pm
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Apr 12, 2011 3:33 pm
Reply with quote

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) icon_rolleyes.gif

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 icon_smile.gif

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
View user's profile Send private message
apandey

New User


Joined: 31 Aug 2009
Posts: 73
Location: Mumbai

PostPosted: Tue Apr 12, 2011 3:55 pm
Reply with quote

You are simply genious my frnd....
I was thinking of all complicated way but u provided such a simple solution..!! icon_biggrin.gif
Superb !! Excellent !! Thanks a ton. icon_biggrin.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Apr 12, 2011 4:05 pm
Reply with quote

apandey wrote:
You are simply genious my frnd....
I was thinking of all complicated way but u provided such a simple solution..!! icon_biggrin.gif
Superb !! Excellent !! Thanks a ton. icon_biggrin.gif

I am happy it helped. icon_smile.gif
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top