| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| rkarthik22 Beginner
 
 
 Joined: 27 Sep 2008
 Posts: 24
 Topics: 9
 
 
 | 
			
				|  Posted: Fri May 29, 2009 3:30 am    Post subject: Do While loop is not working in EZT |   |  
				| 
 |  
				| Hi all, 
 I have two files file1 and file2
 
 File1 LRECL is 250 bytes  (duplicates is there)
 emp-key1 which is of 28 bytes
 
 File2 LRECL is 500        (duplicates are not there)
 emp-key2 which is of 28 bytes
 
 I have to match this two file on emp-key
 
 Requirement:
 READ ONE FILE( say file1)
 SCAN THE WHOLE File for the 2nd File (say file2) if matching on emp key
 Match is found- write the records to Matched File- records from File1, Records from file2
 if match is not found- implies record is present only on the input file 1
 write the record in the output1 file
 
 this is what i tried..
 
 
  	  | Quote: |  	  | FILE FILE1 FB (250 0) 
 INP1-REC                      01     250  A
 EMP-KEY1                     13    28  A
 
 FILE FILE2 FB (500 0)
 
 INP2-REC                      01     500  A
 EMP-KEY2                     01    28  A
 
 FILE OUTPUT FB (800 0)
 
 OUT-REC1                        01  800  A
 
 FILE OUTPUT1 (500 0)
 
 OUT-REC2                        01  500  A
 
 JOB INPUT(NULL)                         +
 START(FST-PROCESS)                 +
 FINISH(LAST)
 DO WHILE NOT EOF FILE1 AND WS-CNT LE 10
 GET FILE1
 DISPLAY 'READ FILE1'
 DO WHILE NOT EOF FILE2
 GET FILE2
 DISPLAY 'READ FILE2'
 PERFORM  CHANGE-MAN-DIFF
 END-DO
 WS-CNT = WS-CNT  +  1
 END-DO
 
 FST-PROCESS. PROC
 WS-RECORD-CNT            = 0
 WS-RECORD-CNT1           = 0
 WS-CNT                   = 0
 END-PROC
 
 CHANGE-MAN-DIFF. PROC
 IF  EMP-KEY1     = EMP-KEY2
 
 DISPLAY    'MATCH COND'
 [i am moving all the matched input records to the output file]
 PUT OUTPUT
 WS-RECORD-CNT     = WS-RECORD-CNT + 1
 ELSE
 OUT-REC2          = INP2-REC
 PUT OUTPUT1
 WS-RECORD-CNT1  =   WS-RECORD-CNT1    +   1
 END-IF
 END-PROC
 
 LAST. PROC
 DISPLAY 'NO OF MATCHED RECORDS     : ', WS-RECORD-CNT
 DISPLAY 'NO OF FFDONLY RECORDS     : ', WS-RECORD-CNT1
 END-PROC
 | 
 
 my inner DO WHILE loop is working fine..i.e..(DO WHILE NOT EOF FILE2)
 
 its processing fine for the first record in input file1.
 
 But the outer loop is not working...i mean after completing the process for the first record ...the control is not moving to the second record of the  input
 
 file 1..
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| expat Intermediate
 
  
 Joined: 01 Mar 2007
 Posts: 475
 Topics: 9
 Location: Welsh Wales
 
 | 
			
				|  Posted: Fri May 29, 2009 5:46 am    Post subject: |   |  
				| 
 |  
				| Please do not post the same topic on multiple helpboards. _________________
 If it's true that we are here to help others,
 then what exactly are the others here for ?
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  | 
	
		|  |