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
 

 

Question about DFSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
zaphany

New User


Joined: 16 May 2006
Posts: 11

PostPosted: Mon Jun 12, 2006 3:22 pm    Post subject: Question about DFSORT
Reply with quote

Dear all,

Just wondering, i have the following case :

Code:

Input
field1   field2   field3
123      456      a
123      000      b
000      789      c


Code:

Output
456a
123b
789c


basically, what i want to do is if field 2 has value, take field 2 & 3 to form the output, if field 2 = 0, take field 1 & 3 to form the output

Now, what i do is to do DFSORT

Code:

sort 1 :
   SORT FIELDS=(1,3,CH,A)
   INCLUDE COND=(4,3,ZD,EQ,0)
   OUTREC FIELDS=(1,3,7,1)

sort 2 :
   SORT FIELDS=(4,3,CH,A)
   INCLUDE COND=(4,3,ZD,NE,0)
   OUTREC FIELDS=(4,3,7,1)
   
sort 3 :
merge sort 1 + sort 2 to form the output


My question is: is there a much simplier way to do so? by ICETOOLS or DFSORT?
Thanks!
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Jun 12, 2006 8:31 pm    Post subject:
Reply with quote

You can use DFSORT's IFTHEN function to do that kind of thing much more easily. Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
123456a
123000b
000789c
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(4,3,ZD,EQ,+0),BUILD=(1,3,7,1)),
        IFTHEN=(WHEN=NONE,BUILD=(4,3,7,1))
/*


For complete information on DFSORT's IFTHEN function, see:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/
Back to top
View user's profile Send private message
zaphany

New User


Joined: 16 May 2006
Posts: 11

PostPosted: Tue Jun 13, 2006 1:12 pm    Post subject: Re: Question about DFSORT
Reply with quote

Thanks Frank! The information really helps! It reduces my original JCLs from 60 lines to 10 lines! icon_lol.gif so great!!
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Jun 13, 2006 9:00 pm    Post subject:
Reply with quote

Glad I could help.
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
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts Fault Analyzer - listings question. egrove IBM Tools 4 Thu Aug 11, 2016 5:31 pm
No new posts DFSORT sorting only specific records akodakka DFSORT/ICETOOL 4 Thu Aug 04, 2016 11:24 am
No new posts dataset copy question - REPRO or some... atulxp TSO/ISPF 2 Wed Aug 03, 2016 10:56 pm


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