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
 

 

SORT IFTHEN ISSUE

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: SORT IFTHEN ISSUE
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    Post subject:
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    Post subject:
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    Post subject: Reply to: SORT IFTHEN ISSUE
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    Post subject: Reply to: SORT IFTHEN ISSUE
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    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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm


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