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

Sorting based on selected strings


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

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Jan 05, 2012 2:18 pm
Reply with quote

Quote:

if You believe that TWO DD statements have that bad influence


And how about :

//SYMNOUT DD SYSOUT=*

Thats a whole lot more jcl statements.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Jan 05, 2012 2:18 pm
Reply with quote

here is a solution without using symnames

it will sort the records in the proper sequence on both fields
only for the AF records it will leave them alone, but in the proper place relative to the others

Code:
 ****** ***************************** Top of Data ******************************
 000001 //ENRICO1  JOB NOTIFY=&SYSUID,                                         
 000002 //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=X                       
 000003 //*                                                                     
 000004 //ICE1    EXEC PGM=SORT                                                 
 000005 //SYSPRINT  DD SYSOUT=*                                                 
 000006 //SYMNOUT   DD SYSOUT=*                                                 
 000007 //SYSOUT    DD SYSOUT=*                                                 
 000008 //TOOLMSG   DD SYSOUT=*                                                 
 000009 //DFSMSG    DD SYSOUT=*                                                 
 000010 //SORTIN    DD *                                                       
 000011 AB9                                                                     
 000012 ZQ8                                                                     
 000013 AB7                                                                     
 000014 XB9                                                                     
 000015 YA8                                                                     
 000016 XB7                                                                     
 000017 AF9                                                                     
 000018 AF5                                                                     
 000019 AF2                                                                     
 000020 AF5                                                                     
 000021 //SORTOUT   DD SYSOUT=*,DCB=(RECFM=FB,LRECL=80)   
 000022 //SYSIN     DD *                                                       
 000023   OPTION EQUALS                                                         
 000024   SORT   FIELDS=(81,3,CH,A)                                             
 000025   INREC  IFTHEN=(WHEN=(1,2,CH,EQ,C'AF'),OVERLAY=(81:1,2,C' ')),         
 000026          IFTHEN=(WHEN=NONE,OVERLAY=(81:1,2,3,1))                       
 000027   OUTREC BUILD=(1,80)                                                   
 ****** **************************** Bottom of Data ****************************

result
Code:
********************************* TOP OF DATA **********************************
AB7                                                                             
AB9                                                                             
AF9                                                                             
AF5                                                                             
AF2                                                                             
AF5                                                                             
XB7                                                                             
XB9                                                                             
YA8                                                                             
ZQ8                                                                             
******************************** BOTTOM OF DATA ********************************


just a proof of concept, modify the fields positions according to Your needs
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Jan 05, 2012 2:21 pm
Reply with quote

SORT FIELDS=(FLD1,A,FLD2,A)

tells me nothing about field characteristics, now i have to browse another
dataset for the SYMNAMES definition. A waste of time.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Jan 05, 2012 2:22 pm
Reply with quote

Quote:
And how about :

//SYMNOUT DD SYSOUT=*


that was already counted in the two...
//SYMNAMES ==>1
//SYMNOUT ==> 2
icon_biggrin.gif

Quote:
SORT FIELDS=(FLD1,A,FLD2,A)

tells me nothing about field characteristics, now i have to browse another
dataset for the SYMNAMES definition. A waste of time.


You just started a religion war icon_wink.gif
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Jan 05, 2012 2:30 pm
Reply with quote

Quote:

You just started a religion war


I hope i didnt, its just what i think. Bill Woodger is a Cobol zealot, so i understand he loves to use SYMNAMES to define Cobol like names. Well
whoever wants to use it, thats ok with me.
Back to top
View user's profile Send private message
CJT

New User


Joined: 02 Aug 2007
Posts: 83
Location: Here

PostPosted: Thu Jan 05, 2012 4:36 pm
Reply with quote

Hi Enrico,

Thanks a million - this is what i was looking for. I will try this and let you know.

Thanks a ton again icon_smile.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jan 05, 2012 4:57 pm
Reply with quote

Since CJT is now happy, and all these might move anyway:

Code:

  SORT FIELDS=(22,3,CH,A),EQUALS                                         
  INREC IFTHEN=(WHEN=(12,2,CH,GE,C'AB',AND,12,2,CH,LE,C'AF'),OVERLAY=(22*
              :10,2,X)),IFTHEN=(WHEN=NONE,OVERLAY=(22:10,2,13,1))     
  OUTREC BUILD=(1,21)                                                   


This is the output from the symbol substitution.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Thu Jan 05, 2012 6:26 pm
Reply with quote

enrico-sorichetti wrote:
Quote:
And how about :

//SYMNOUT DD SYSOUT=*


that was already counted in the two...
//SYMNAMES ==>1
//SYMNOUT ==> 2
icon_biggrin.gif

Quote:
SORT FIELDS=(FLD1,A,FLD2,A)

tells me nothing about field characteristics, now i have to browse another
dataset for the SYMNAMES definition. A waste of time.


You just started a religion war icon_wink.gif
SYMNOUT is optional, BTW, so use of symbols only requires you to add one DD statement to the job.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Fri Jan 06, 2012 12:03 am
Reply with quote

Quote:
SORT FIELDS=(FLD1,A,FLD2,A)

tells me nothing about field characteristics, now i have to browse another
dataset for the SYMNAMES definition. A waste of time.


It's NOT a waste of time when you consider that DFSORT Symbols allows you to stop worrying about the field characteristics. You just set the symbols up once in your SYMNAMES data set and forget about them until you need to change something. Then you go back to your SYMNAMES definition file and change it appropriately. As an example (if you use * for the fields), this makes it very easy to insert a new field between two existing fields without having to change all of the positions in your control statements.

If you want to know the field characteristics for some reason, you can look at the SYMNAMES definition data set, or run the job and look at SYMNOUT or the transformed statements in //SYSOUT.

Having a separate data set for the SYMNAMES definitions is very similar to what you do for most high level languages such as C, COBOL, etc. Are you suggesting that symbols SHOULD NOT be used for those languages either? I don't really see the difference between using Symbols for DFSORT and using Symbols for HLLs (which almost everyone would agree is a better way to go).
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Fri Jan 06, 2012 12:58 am
Reply with quote

When a file layout changes, you usually have to chase down every sort control card used to process that file and make sure that you make the necessary adjustments to the hard-coded field positions. I have seen production jobs crash and burn because someone forgot to update a sort card. It's usually not the sort step that abends, but rather a downstream step that is now seeing the data in an unexpected sequence.

Symbols greatly mitigate that risk.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Fri Jan 06, 2012 1:43 am
Reply with quote

Quote:
Symbols greatly mitigate that risk.


Exactly. That's why I added Symbols for DFSORT/ICETOOL.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jan 06, 2012 1:49 am
Reply with quote

Hello,

Quote:
You just set the symbols up once in your SYMNAMES data set and forget about them until you need to change something.
And you can use lots of the same names people are already familiar/comfortable with from writing code or queries. . .

Quote:
Symbols greatly mitigate that risk.
Yup, Just like using the Copybook rather than some custom/program-specific file definition. . .

Of course, there is the issue of so many organizations that believe any change or new feature is bad. . . icon_rolleyes.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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
This topic is locked: you cannot edit posts or make replies. Automation need help in sorting the data DFSORT/ICETOOL 38
No new posts To search DB2 table based on Conditio... DB2 1
This topic is locked: you cannot edit posts or make replies. Merge 2 input files based on the reco... JCL & VSAM 2
No new posts Split large FB file based on Key coun... DFSORT/ICETOOL 4
No new posts Mass JCL release via IDZ tool(eclipse... CA Products 1
Search our Forums:

Back to Top