Question

The following code compiled under CRTBNDRPG but when running it is stuck on only 1 I/O.

All I hav to do is - all of our tables have order number as 8 but this one file has it as 10. So I am just creating the 2 fields i need one making it 8 and the other is ok as it is. ANy ideas why this little program doesn't take off?

FMFHHMH    IF   E             DISK                                    
F* output file                                                        
FMFHHMHPK  O  A E             DISK                                    
D*EXTSHP           S             13  6                                
D                                                                     
C                                                                     
C                   READ      MFHHMH                                  
C                   Dow       NOT %EOF(MFHHMH)                        
C                   iF        %found                                  
c                   MOVE      MHORDR        MHORDp                    
c                   MOVE      MHZONE        MHZONE                    
C                   WRITE     MFHHMHP                                 
C                   READ      mfhhmh                                  
C                   End                                               
C                   END                                               
C                   SETON                                        LR   
Was it helpful?

Solution

You have created an infinite loop where NOT %EOF is TRUE but %FOUND is FALSE.

Note from the documentation for %FOUND that it does not reflect a status for a READ operation.

The IF conditional is not needed in your code as the DOW loop is sufficient to guarantee you have a record.

OTHER TIPS

It's right what saying James in the first answer .. with op-code READ you can use IF %EOF but you can't use IF %FOUND .... Use %FOUND with CHAIN

You can also use an sql statement if both tables have a similar structure

INSERT INTO MFHHMHPK (select * from MFHHMH where whateveryouwant)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top