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

SORT IFTHEN ISSUE


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

New User


Joined: 22 Aug 2006
Posts: 95
Location: india

PostPosted: Tue Mar 08, 2011 3:32 pm
Reply with quote

Hi,

I have a input file with following attribute :

Code:

LRECL=196
RECFM=FB


Requirement : I have a conditional check wherein
1) if value at column 182(2 byte PD Field) is numeric then I have to write the same to output at position 182(2 byte PD Field) else I have to write zeroes.
2) if value in the input at column 184(3 byte PD Field) is numeric and greater then 0 then I have to write input value at 184(3 byte PD Field) else I have write the value at 34 position in the input (3 byte ZD field) to 184 position in the output (PD).
For this requirement I have written following code :

Code:

OPTION COPY                       
INCLUDE COND=(37,3,CH,EQ,C'AAA',OR,
              37,3,CH,EQ,C'ABB',OR,
              37,3,CH,EQ,C'CBB',OR,
              37,3,CH,EQ,C'CBS')   

OUTREC IFTHEN=(WHEN=INIT,                                             
        BUILD=(1:1,196)),                   
       IFTHEN=(WHEN=INIT,                                             
        OVERLAY=(182:+0,TO=PD,LENGTH=2,184:34,3,ZD,TO=PD,LENGTH=3)), 
       IFTHEN=(WHEN=(182,2,PD,EQ,NUM),                               
          OVERLAY=(182:182,2),HIT=NEXT),                             
       IFTHEN=(WHEN=(184,3,PD,EQ,NUM,AND,184,3,PD,GT,0),             
          OVERLAY=(184:184,3))                             


Issue :
BUILD is working correctly but the WHEN=(Cond) are not working. Values as per condition are not overlaying.

Can someone please help me with this one.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Mar 08, 2011 10:54 pm
Reply with quote

abhishekmdwivedi,


Your IFTHEN=(WHEN=INIT statement is overlaying the contents. You just need to overlay when the conditions are true. Use the following control cards which will give you the desired results.

Code:

//SYSIN    DD *                                   
  OPTION COPY                                     
  INCLUDE COND=(37,3,SS,EQ,C'AAA,ABB,CBB,CBS') 
 
  INREC IFTHEN=(WHEN=(182,2,PD,NE,NUM),           
       OVERLAY=(182:X'000C'),HIT=NEXT),           
  IFTHEN=(WHEN=(184,3,PD,NE,NUM,OR,184,3,PD,LT,0),
       OVERLAY=(184:34,3,ZD,PD,LENGTH=3))         
//*
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Tue Mar 08, 2011 11:16 pm
Reply with quote

According to the OP's first post, the second requirement was

"if value in the input at column 184(3 byte PD Field) is numeric and greater then 0 then I have to write input value at 184(3 byte PD Field) else I have write the value at 34 position in the input (3 byte ZD field) to 184 position in the output (PD)"

I interpret that as meaning that the overlay from position 34 should only be done if the value is not numeric or if it not greater than zero, in which case the test following the OR in the second IFTHEN should be 'LE,0' (or 'LT,1') not 'LT,0', as in:
Code:

//SYSIN    DD *                                   
  OPTION COPY                                     
  INCLUDE COND=(37,3,SS,EQ,C'AAA,ABB,CBB,CBS') 
 
  INREC IFTHEN=(WHEN=(182,2,PD,NE,NUM),           
       OVERLAY=(182:X'000C'),HIT=NEXT),           
  IFTHEN=(WHEN=(184,3,PD,NE,NUM,OR,184,3,PD,LE,0),
       OVERLAY=(184:34,3,ZD,PD,LENGTH=3))         
//*
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Mar 08, 2011 11:34 pm
Reply with quote

Ronald Burr,

Thank you. It should be LE to 0.

abhishekmdwivedi, The Second IFTHEN should be checking for LE 0 instead of LT.
Back to top
View user's profile Send private message
abhishekmdwivedi

New User


Joined: 22 Aug 2006
Posts: 95
Location: india

PostPosted: Wed Mar 09, 2011 11:13 am
Reply with quote

Thanks a lot Skolusu & Ronald. The INREC IFTHEN worked correctly as desired.
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top