How to Separate Odd or Even numbers using DFSORT

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
devegouda.chage
Member
Posts: 32
Joined: Mon Sep 12, 2011 10:50 am
Location: Bangalore

How to Separate Odd or Even numbers using DFSORT

Post by devegouda.chage » Fri Oct 04, 2013 4:40 pm

Hi All,
Is that possible to separate even numbers into one file and odd numbers into another file using DFSORT
Example:
my input file is
102
125
045
224
155
176
my output files should be

ODD output file
125
045
155

EVEN output file
102
224
176

Please can anyone help on this.
Thanks & Regards
Dev

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Fri Oct 04, 2013 5:16 pm

You got 2 solutions yesterday on another forum and, today, a clarification from a DFSort developer as to why one was better than the other. Why are you posting again today here? That is not very polite and is, essentially, against the rules.
Regards
Nic

devegouda.chage
Member
Posts: 32
Joined: Mon Sep 12, 2011 10:50 am
Location: Bangalore

Post by devegouda.chage » Fri Oct 04, 2013 7:15 pm

HI Nic,
Before putting into forum,i have searched the web,but i got answer for position wise i.e odd records will be in one file and evenrecords in another file,but i want to separation on numbers not a position wise.:(

if you are specifying about the separation by numbers ,could you please paste the link.
Thanks in advance
Thanks & Regards
Dev

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Fri Oct 04, 2013 9:43 pm

Suggest you re-read the other answers.

IIRC, there was an explanation of how to do what you want . . .
Have a good one

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Fri Oct 04, 2013 9:56 pm

I think this is not a cross-posting, but a co-incidence.

Code: Select all

 OUTFIL FNAMES=EVEN,INCLUDE=(3,1,BI,EQ,B'.......0')
 OUTFIL FNAMES=ODD,SAVE
This is looking at the right-most bit of the right-most byte of your number. If that bit is zero, your number is even. Otherwise it is odd (as bits can only be zero or one).

devegouda.chage
Member
Posts: 32
Joined: Mon Sep 12, 2011 10:50 am
Location: Bangalore

Post by devegouda.chage » Mon Oct 07, 2013 10:47 am

Thanks a lot William Collins :)
its working!!!!

once again thanks for your quick reply:) :) :) :)
Thanks & Regards
Dev

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others