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 

IFTHEN WHEN hit=next with else condition

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


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Mon Dec 07, 2020 3:38 pm    Post subject: IFTHEN WHEN hit=next with else condition Reply with quote

Hi,

i have a scenario

Code:

if posted is numeric
   add POSTED to total
end-if
if clear-flag = 'y'
   add susp to total
else
  add asusp to total
end-if


Please advise if the following sort statement is correct for above statement.

Assuming total is available in 12th position

Code:

IFTHEN=(WHEN=(POSTED,EQ,NUM),               
OVERLAY=(12:12,12,ZD,ADD,                                   
         POSTED,TO=ZD,LENGTH=12),HIT=NEXT),
IFTHEN=(WHEN=(CLEAR-FLAG,EQ,C'Y'),             
OVERLAY=(12:12,8,ZD,ADD,SUSP,TO=ZD,LENGTH=12)),               
IFTHEN=(WHEN=NONE,                                           
        OVERLAY=(12:12,8,ZD,ADD,ASUSP,TO=ZD,LENGTH=12))


I have a doubt whether the above sort work like the below statement


Code:

if posted is numeric
   add POSTED to total
else
   add asusp to total (I don't want this to happen)
end-if
if clear-flag = 'y'
   add susp to total
else
  add asusp to total
end-if




Thanks
Magesh
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Dec 07, 2020 5:29 pm    Post subject: Reply with quote

Magesh_J,

WHEN=NONE will NOT be active if any of the IFTHEN Conditions have been true. You only had HIT=NEXT on the first IFTHEN, so it will check for Clear-flag but not for when=none.

Btw why do you have 8 and 12 bytes for the same position?

When you are adding POSTED you are using a 12 byte value for SUSP and ASUSP, you are only using 8 bytes which does not make sense. Is that a typo?
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Mon Dec 07, 2020 9:22 pm    Post subject: Reply with quote

Hi Kolusu,

Thanks for the advice,

Yes, it's a typo.

Code:

IFTHEN=(WHEN=(POSTED,EQ,NUM),               
OVERLAY=(12:12,12,ZD,ADD,                                   
         POSTED,TO=ZD,LENGTH=12),HIT=NEXT),
IFTHEN=(WHEN=(CLEAR-FLAG,EQ,C'Y'),             
OVERLAY=(12:12,12,ZD,ADD,SUSP,TO=ZD,LENGTH=12)),               
IFTHEN=(WHEN=NONE,                                           
        OVERLAY=(12:12,12,ZD,ADD,ASUSP,TO=ZD,LENGTH=12))


IF I understood correctly, then this works as below code.

Code:

if posted is numeric
   add POSTED to total
end-if
if clear-flag = 'y'
   add susp to total
else
  add asusp to total
end-if


Thanks
Magesh
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