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
 

 

IF loop is not working ,going inside loop without check cond

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
View previous topic :: :: View next topic  
Author Message
nkreddy5

New User


Joined: 06 May 2008
Posts: 7
Location: BANGALORE

PostPosted: Fri Nov 07, 2008 5:34 am    Post subject: IF loop is not working ,going inside loop without check cond
Reply with quote

Hi ,

Here is the code which iam trying to find out the duplicates successquily in my input file..i have coded as below.but if loop is not getting considered and going continously with out taking if loop into consideration..
can you please suggest how can i proceed.

Code:
FILE INPUT1                                   
   INPUT1-REC                   1  400  A     
   SE                           1   10  A     
   REF                          15  09  A     
   PERIOD                       30  4   A     
   CARD                         40  17  A     
   AMOUNT                       65  12  A     
FILE OUTPUT1                                 
   OUTPUT1-REC                  1  400  A     
DEFINE   WS-SE1        W                 10  A     
DEFINE   WS-REF1       W                 09  A     
DEFINE   WS-PERIOD1    W                 4   A     
DEFINE   WS-CARD1      W                 17  A     
DEFINE   WS-AMOUNT1    W                 12  A     
DEFINE   WS-SE2        W                 10  A     
DEFINE   WS-REF2       W                 09  A     
DEFINE   WS-PERIOD2    W                 4   A     
DEFINE   WS-CARD2      W                 17  A     
DEFINE   WS-AMOUNT2    W                 12  A     

****************************************************************     
WS-IND           W   07 A                                             
*******************************************************************   
*      A C T I V I T Y   S E C T I O N                               
*********************************************************************
JOB INPUT NULL                                                       
   GET INPUT1                                                         
   WS-SE1 = SE                                                       
   WS-REF1 = REF                                                     
   WS-PERIOD1 = PERIOD                                               
   WS-CARD1 = CARD                                                   
   WS-AMOUNT1 = AMOUNT                                               
   DO WHILE NOT EOF INPUT1                                           
    GET INPUT1                                                       
    WS-SE2 = SE                                                       
    WS-REF2 = REF                                                     
    WS-PERIOD2 = PERIOD                                               
    WS-CARD2 = CARD                                                   
    WS-AMOUNT2 = AMOUNT                                               
    IF (SE ¬= WS-SE1) AND (REF ¬= WS-REF1) AND (CARD ¬= WS-CARD1)     
     IF (PERIOD ¬= WS-PERIOD1) AND (AMOUNT ¬= WS-AMOUNT1)             
      DISPLAY 'ORG'                                                   
      WS-SE1 = WS-SE2                                               
      WS-REF1 = WS-REF2                                             
      WS-PERIOD1 = WS-PERIOD2                                       
      WS-CARD1 = WS-CARD2                                           
      WS-AMOUNT1 = WS-AMOUNT2                                       
     END-IF                                                         
    END-IF                                                         
    IF (SE = WS-SE1) AND (REF = WS-REF1) AND (CARD = WS-CARD1)     
     IF (PERIOD = WS-PERIOD1) AND (AMOUNT = WS-AMOUNT1)             
      DISPLAY 'DUP'                                                 
      OUTPUT1-REC = INPUT1-REC                                     
      PUT OUTPUT1                                                   
     END-IF                                                         
    END-IF                                                         
   END-DO                                                           
    STOP                                                           


Please let me know if i hve to provide any other informmation..

Thanks,
karthik
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Nov 07, 2008 6:43 am    Post subject:
Reply with quote

Hello,

Quote:
but if loop is not getting considered and going continously with out taking if loop into consideration..
I do not understand what this is telling me.

What is at the bottom of the Easytrieve listing?

Does the process abend due to a time out (going continuously)?

Does the process create incorrect output - if yes, show the incorrect output and what it should be.

Is there some reason that JOB INPUT INPUT1 was not used (which is much more common tha GET)?

The code issues GETs but does not check eof after the read.

How many records does "input1" contain?

It may help if you post the jcl for this step.
Back to top
View user's profile Send private message
nkreddy5

New User


Joined: 06 May 2008
Posts: 7
Location: BANGALORE

PostPosted: Mon Nov 10, 2008 8:53 pm    Post subject:
Reply with quote

Hi Dick,

Thanks for reply.
I got know why my if loop is not working..because in the input file i have in between records hex variables are embeeded in input file.
So,if loop didnt work for me.

When i gave hex variable input file.my above coding will not consider the if loop and will jsut go through the code.

Job will not abend..just it will all records in input with out considering the contdtions which i have coded thru if loop.

Thanks,
Karthik
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Nov 10, 2008 10:46 pm    Post subject: Reply to: IF loop is not working ,going inside loop without
Reply with quote

Good to hear it is working - thank you for letting us know icon_smile.gif

d
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 -> CA Products All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 7 Fri Nov 18, 2016 1:48 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts save SAY var loop. italo_pm CLIST & REXX 3 Sun Sep 04, 2016 3:06 am
No new posts SCRNAME not working on my mainframe? mrsidhu12 TSO/ISPF 7 Thu Sep 01, 2016 2:17 pm


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