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
 

 

add leading and trailing zero for different conditions

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

New User


Joined: 24 Feb 2009
Posts: 14
Location: chennai

PostPosted: Fri Feb 27, 2009 5:02 pm    Post subject: add leading and trailing zero for different conditions
Reply with quote

Input File -1
Code:

153
155
160
17
0
1
2


output File-1
Code:

00153
00155
16000
00017
00000
00001
20000


1. If It is a ODD number , gotta include leading zeros
2. if it is a EVEN number , gotta incluide trailing zeros,for zero - 00000
3. Lenght should be = 5
Back to top
View user's profile Send private message

genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Fri Feb 27, 2009 5:50 pm    Post subject:
Reply with quote

i tried this.. worked for me..

Code:

   SORT FIELDS=COPY                               
   INREC FIELDS=(1,5,X,1,5,UFF,M10)               
   OUTFIL IFTHEN=(WHEN=(11,1,SS,EQ,C'1 3 5 7 9'), 
          BUILD=(1,5,UFF,M11)),                   
          IFTHEN=(WHEN=(11,1,SS,EQ,C'0 2 4 6 8'), 
          BUILD=(1,5,ZD,M11))                     
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: Fri Feb 27, 2009 10:15 pm    Post subject:
Reply with quote

Vaasuki,

You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
153
155
160
17
0
1
2
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFOUTLEN=80,
   IFTHEN=(WHEN=INIT,
    OVERLAY=(81:1,5,UFF,MOD,+2,M11,LENGTH=1)),
   IFTHEN=(WHEN=(81,1,CH,EQ,C'1'),
    OVERLAY=(1:1,5,UFF,M11,LENGTH=5)),
   IFTHEN=(WHEN=NONE,
    OVERLAY=(1:1,5,ZD,M11,LENGTH=5))
/*
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 DFSORT report with multiple conditions Bill Woodger DFSORT/ICETOOL 9 Wed Jan 20, 2016 2:19 am
No new posts Syncsort to remove the leading spaces V S Amarendra Reddy SYNCSORT 5 Fri Jan 08, 2016 9:47 pm
This topic is locked: you cannot edit posts or make replies. Mainframe Jobs in Leading Indian MNC aman2248 Mainframe Jobs 0 Mon Dec 21, 2015 3:25 pm
No new posts Add Trailing Zeroes depending upon th... Rohit Umarjikar DFSORT/ICETOOL 3 Fri Oct 23, 2015 1:47 am
No new posts Removing Leading Spaces and Removing ... rahulpala COBOL Programming 4 Fri Sep 04, 2015 4:58 am


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