|
View previous topic :: View next topic
|
| Author |
Message |
abhishekmdwivedi
New User
.jpg)
Joined: 22 Aug 2006 Posts: 95 Location: india
|
|
|
|
Hi,
I have a input file with following attribute :
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 |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
 |
Ronald Burr
Active User

Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
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 |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
 |
abhishekmdwivedi
New User
.jpg)
Joined: 22 Aug 2006 Posts: 95 Location: india
|
|
|
|
| Thanks a lot Skolusu & Ronald. The INREC IFTHEN worked correctly as desired. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|