View previous topic :: View next topic
|
Author |
Message |
nkreddy5
New User
Joined: 06 May 2008 Posts: 7 Location: BANGALORE
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
nkreddy5
New User
Joined: 06 May 2008 Posts: 7 Location: BANGALORE
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Good to hear it is working - thank you for letting us know
d |
|
Back to top |
|
|
|