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

How to find a given number ODD or EVEN?


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

New User


Joined: 15 Sep 2009
Posts: 8
Location: India

PostPosted: Tue Sep 22, 2009 7:10 am
Reply with quote

I have the following in input file (LRECL=20,RECFM=FB)

Acct No(1-8) Sequence No(10-12,Format Type=ZD)
AAAAAAAA 001
AAAAAAAB 002
AAAAAAAC 003
AAAAAAAD 004
AAAAAAAE 005

I need an output like below (LRECL=20,RECFM=FB) using DFSORT/ICETOOL

Acct No(1-8) Sequence No(10-12) Type(14-17)
AAAAAAAA 001 ODD
AAAAAAAB 002 EVEN
AAAAAAAC 003 ODD
AAAAAAAD 004 EVEN
AAAAAAAE 005 ODD

I have achieved the above output with the help of FILEAID bach,
(
$$DD01 COPY IF=(12,EQ,B'01'),MOVE=(C'ODD',14)
COPY IF=(12,EQ,B'00'),MOVE=(C'EVEN',14)

)

but not sure how to get it done with DFSORT/ICETOOL. Can any one of you help me out. Many thanks in advance
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Sep 22, 2009 7:34 am
Reply with quote

Hi,

this might assist
Code:
//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *                                                     
AAAAAAAA 001                                                         
AAAAAAAB 002                                                         
AAAAAAAC 003                                                         
AAAAAAAD 004                                                         
AAAAAAAE 005                                                         
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                     
   SORT FIELDS=COPY                                                 
     INREC IFTHEN=(WHEN=(12,1,CH,EQ,C'1'),OVERLAY=(14:C'ODD ')),     
           IFTHEN=(WHEN=(12,1,CH,EQ,C'3'),OVERLAY=(14:C'ODD ')),     
           IFTHEN=(WHEN=(12,1,CH,EQ,C'5'),OVERLAY=(14:C'ODD ')),     
           IFTHEN=(WHEN=(12,1,CH,EQ,C'7'),OVERLAY=(14:C'ODD ')),     
           IFTHEN=(WHEN=(12,1,CH,EQ,C'9'),OVERLAY=(14:C'ODD ')),     
           IFTHEN=(WHEN=NONE,OVERLAY=(14:C'EVEN'))                   
/*                                                                   


Gerry
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Sep 22, 2009 7:45 am
Reply with quote

Hi,

or like this
Code:
   SORT FIELDS=COPY                                     
     INREC IFTHEN=(WHEN=(12,1,SS,EQ,C'1,3,5,7,9'),     
                             OVERLAY=(14:C'ODD ')),         
           IFTHEN=(WHEN=NONE,OVERLAY=(14:C'EVEN'))     


Gerry
Back to top
View user's profile Send private message
Kumar Saraboji

New User


Joined: 15 Sep 2009
Posts: 8
Location: India

PostPosted: Tue Sep 22, 2009 7:58 am
Reply with quote

Hi Gerry,

Woov.....! Thanks a lot for the solution.

Regards,
Kumar
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: Tue Sep 22, 2009 9:14 pm
Reply with quote

Kumar,

You can use a bit test with DFSORT as you did with FileAid.

Code:

  OPTION COPY                                                       
  INREC IFTHEN=(WHEN=(12,1,BI,EQ,B'.......1'),OVERLAY=(14:C'ODD')),
        IFTHEN=(WHEN=NONE,OVERLAY=(14:C'EVEN'))                     
Back to top
View user's profile Send private message
Kumar Saraboji

New User


Joined: 15 Sep 2009
Posts: 8
Location: India

PostPosted: Wed Sep 23, 2009 10:22 am
Reply with quote

Thanks a lot Frank for the solution, from bit wise point of view. It is simply great! replying to the developer of DFSORT/ICETOOL
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 Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
Search our Forums:

Back to Top