MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Mutliple IFTHEN on same record

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
maxisnowhere
Beginner


Joined: 25 May 2005
Posts: 59
Topics: 20

PostPosted: Mon Jun 25, 2007 4:52 am    Post subject: Mutliple IFTHEN on same record Reply with quote

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:
Code:

A1
B1
B2
C2


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:

Code:
1M
2M
3N
4N


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:

Code:
11
21
22
32

Can you help me?

thanks a lot!!!!
_________________
Maxisnowhere
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Mon Jun 25, 2007 5:05 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
maxisnowhere
Beginner


Joined: 25 May 2005
Posts: 59
Topics: 20

PostPosted: Mon Jun 25, 2007 5:11 am    Post subject: Reply with quote

As allways, you are my heroes!!!

Thanks a lot!!!!!!!
_________________
Maxisnowhere
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group