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

Using IFTHEN to modify just one field in output


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

New User


Joined: 01 Jun 2009
Posts: 9
Location: India

PostPosted: Tue May 25, 2010 7:45 pm
Reply with quote

Hi,

I am trying a simple thing, just moving some fields from input file to output file, the only logic to apply is to check if one field in input is 'M' or 'F' then concatenate two input fields to last output field. Following is the sort card that I am trying to use but getting different errors mostly syntax error.

Code:

SORT FIELDS=COPY                                                 
OUTREC BUILD=(27,3,C'!',1,10,SQZ=(SHIFT=LEFT),C'!',             
              30,10,SQZ=(SHIFT=LEFT),C'!',                       
              590,6,PD,EDIT=(SIIIIIT.TT),SIGNS=(,-),C'!',       
              604,6,PD,EDIT=(SIIIIIT.TT),SIGNS=(,-),C'!',       
              620,6,PD,EDIT=(SIIIIIT.TT),SIGNS=(,-),C'!',       
              626,6,PD,EDIT=(SIIIIIT.TT),SIGNS=(,-),C'!',       
              632,6,PD,EDIT=(SIIIIIT.TT),SIGNS=(,-),C'!',       
              127,15,C'!',142,20,C'!',537,40,C'!',               
              498,1,C'!',584,6,SQZ=(SHIFT=LEFT),C'!',           
              170,30,C'!',200,30,C'!',230,30,C'!',260,30,C'!',   
              320,3,C'!',323,9,C'!',1358,1,C'!',                 
              1359,1,C'!',1360,1,C'!',1361,9,C'!',               
              1370,16,C'!',113,1,C'!',96,1,C'!',                 
              40,8,C'!',64,8,C'!',56,8,C'!',371:X               
       IFTHEN=(WHEN=(498,1,CH,EQ,C'M',OR,498,1,CH,EQ,C'F'),     
       OVERLAY=(371:142,20,391:127,15)))                         


I think this can be achieve if I use IFTHEN with BUILD twice, but just want to know if it is possible the way I am trying as above, or is there any other efficient way.

Thanks,
Manu
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue May 25, 2010 10:18 pm
Reply with quote

Manu Dhawan,

With OUTREC build you have already moved the contents of 498 to pos 160. You also moved the contents of 127 and 142 to 82 and 98 respectively. So you cannot really use the same position as your input on the IFTHEN statement. Try these updated control cards.

Code:

//SYSIN    DD *                                               
  SORT FIELDS=COPY                                           
  OUTREC IFTHEN=(WHEN=INIT,                                   
  BUILD=(0027,3,C'!',1,10,SQZ=(SHIFT=LEFT),C'!',             
         0030,10,SQZ=(SHIFT=LEFT),C'!',                       
         0590,6,PD,EDIT=(SIIIIIT.TT),SIGNS=(,-),C'!',         
         0604,6,PD,EDIT=(SIIIIIT.TT),SIGNS=(,-),C'!',         
         0620,6,PD,EDIT=(SIIIIIT.TT),SIGNS=(,-),C'!',         
         0626,6,PD,EDIT=(SIIIIIT.TT),SIGNS=(,-),C'!',         
         0632,6,PD,EDIT=(SIIIIIT.TT),SIGNS=(,-),C'!',         
         0127,15,C'!',142,20,C'!',537,40,C'!',               
         0498,1,C'!',584,6,SQZ=(SHIFT=LEFT),C'!',             
         0170,30,C'!',200,30,C'!',230,30,C'!',260,30,C'!',   
         0320,3,C'!',323,9,C'!',1358,1,C'!',                 
         1359,1,C'!',1360,1,C'!',1361,9,C'!',                 
         1370,16,C'!',113,1,C'!',96,1,C'!',                   
         0040,8,C'!',64,8,C'!',56,8,C'!',371:X)),             
  IFTHEN=(WHEN=(160,1,CH,EQ,C'M',OR,160,1,CH,EQ,C'F'),       
  OVERLAY=(371:98,20,391:82,15))                             
//*
Back to top
View user's profile Send private message
Manu Dhawan

New User


Joined: 01 Jun 2009
Posts: 9
Location: India

PostPosted: Wed May 26, 2010 11:24 am
Reply with quote

Hi Skolusu,

It worked.

Thank you,
Manu
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 Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts Build a record in output file and rep... DFSORT/ICETOOL 11
No new posts XDC SDSF output to temp dataset CLIST & REXX 4
Search our Forums:

Back to Top