MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
maxisnowhere Beginner Joined: 25 May 2005 Posts: 59 Topics: 20
Posted: Mon Jun 25, 2007 4:52 am Post subject: Mutliple IFTHEN on same record
Hello Guys,
I'm having some problem by decode some fields in record. I try to explain my problem with an example.
I've an input file like:
In first posizion I have a code I have to decode with:
A -> 1
B -> 2
C -> 3
In the second position I have a code I have to decode with:
1 -> M
2 -> N
I tryed do do that with a sort step with:
Code: SORT FIELDS=COPY
INREC FIELDS=(1,2)
OUTREC IFTHEN=(WHEN=(1,1,CH,EQ,C'A'),OVERLAY=(1:C'1')),
IFTHEN=(WHEN=(1,1,CH,EQ,C'B'),OVERLAY=(1:C'2')),
IFTHEN=(WHEN=(1,1,CH,EQ,C'C'),OVERLAY=(1:C'3')),
IFTHEN=(WHEN=(2,1,CH,EQ,C'1'),OVERLAY=(2:C'M')),
IFTHEN=(WHEN=(2,1,CH,EQ,C'2'),OVERLAY=(2:C'N'))
OUTFIL OUTREC=(1,2)
I was suopposed to get an output like:
The problem is that when the program find a condition, it doesn't continue to check the other and goes directly to the next record...
So I get only the first code decoded and the second no...
My output is:
Can you help me?
thanks a lot!!!! _________________ Maxisnowhere
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Mon Jun 25, 2007 5:05 am Post subject:
Quote:
The problem is that when the program find a condition, it doesn't continue to check the other and goes directly to the next record...
So I get only the first code decoded and the second no...
maxisnowhere,
you need to use HIT=NEXT so that sort will look at the next IFTHEN statement
Try these untested sort cards
Code:
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL IFOUTLEN=2,
IFTHEN=(WHEN=(1,1,CH,EQ,C'A'),OVERLAY=(1:C'1'),HIT=NEXT),
IFTHEN=(WHEN=(1,1,CH,EQ,C'B'),OVERLAY=(1:C'2'),HIT=NEXT),
IFTHEN=(WHEN=(1,1,CH,EQ,C'C'),OVERLAY=(1:C'3'),HIT=NEXT),
IFTHEN=(WHEN=(2,1,CH,EQ,C'1'),OVERLAY=(2:C'M'),HIT=NEXT),
IFTHEN=(WHEN=(2,1,CH,EQ,C'2'),OVERLAY=(2:C'N'))
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
maxisnowhere Beginner Joined: 25 May 2005 Posts: 59 Topics: 20
Posted: Mon Jun 25, 2007 5:11 am Post subject:
As allways, you are my heroes!!!
Thanks a lot!!!!!!! _________________ Maxisnowhere
Back to top
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum