Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

IF condition in SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: IF condition in SORT
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us