2013-07-15 36 views
1

目前,我們需要限制這些臨時工作文件的輸出。原因是這些是巨大的主文件,並且需要永遠運行。如果我們沒有創建文件* NOMAX,那麼必須有人來回答更多擴展的消息,並且它包含作業隊列。目前,我們想要顯示數據被正確選擇。但我添加了這些計數字段,但它並未停止該程序。限制AS400中的輸出工作文件RPG

FARCMASAC IF E    DISK         
* Order Header file - Keyed by Company and entity number   
FOEORH4 IF E   K DISK         
* Output file - Customers who hav no orders - TRCMASAC PF   
FTRCMA1 UF A E   K DISK         
* Customer Keycode BI file           
FZRCST1 IF E   K DISK         
* Output file - Customers who have no Keycode - VRCSTKBI PF  
FVRCST1 UF A E   K DISK         
* Address Master file - ADRESSAD PF        
FADRES1 IF E   K DISK         
* Output file - Address - ZDRESSAD PF        
FZDRES1 UF A E   K DISK         

*----------------------------------------------------------------- 
* Calculation Specification           
*----------------------------------------------------------------- 
* Step 1               
C     READ  ARCMASAC        
C     DOW  NOT %EOF      
*               
* Check the record does not exist in order header file  
C     EXSR  CHKORH_SR      
* Read the next record          
C     READ  ARCMASAC      
c  counta  ifge  9990       
C     EVAL  *INLR = *ON     
c     leave         
c     endif         
c  countz  ifge  9990       
C     EVAL  *INLR = *ON     
c     leave         
c     endif         
C     ENDDO         

* Step 2 and 3            
C  *LOVAL  SETLL  TRCMA1       
C     READ(N) TRCMA1       
C     DOW  NOT %EOF      

C     EXSR  CHKCUS_SR        
*                 
* Check the record does not exist in address file     
C     EXSR  CHKADR_SR        
*                 
* Read the next record            
C     READ(N) TRCMA1         
C     ENDDO            

*----------------------------------------------------------------- 
* End of the Program             
*----------------------------------------------------------------- 
C     EVAL  *INLR = *ON        

*----------------------------------------------------------------- 
* Check the order header entity          
*----------------------------------------------------------------- 
C  CHKORH_SR  BEGSR            
C  ORHKEY  CHAIN  OEORH4          
* If the order entity is notfound, write the rec into TRCMASAC file  
C     IF  NOT %FOUND(OEORH4)       
C     WRITE  TRCMASRR         
C     ENDIF            
*                  
C     ENDSR            
*-----------------------------------------------------------------  
* Check the customer keycode entity          
*-----------------------------------------------------------------  
C  CHKCUS_SR  BEGSR            
*                  
C  ORHKEY  CHAIN  ZRCST1          
* If the order entity is found, write the rec into VRCSTKBI file  
C     IF  %FOUND(ZRCST1)        
C     WRITE  VRCSTKRR         
c     add  1    countz   500  
C     ENDIF            
C     ENDSR             

*-----------------------------------------------------------------  
* Check the address entity for records of never ordered     
*-----------------------------------------------------------------  
C  CHKADR_SR  BEGSR             
*                  
C  ACENT#  CHAIN  ADRES1          
* If the order entity is found, write the rec into ZDRESSRR file   
C     IF  %FOUND(ADRES1)        
C     WRITE  ZDRESSRR         
c     add  1    counta   500   
C     ENDIF             
*                  
C     ENDSR             

*-----------------------------------------------------------------  
* Program Initialization Subroutine          
*-----------------------------------------------------------------  
C  *INZSR  BEGSR             
+0

這個程序結束後你需要工作文件嗎?這裏的實際目標是什麼? – WarrenT

+0

沒有數據熟悉度,我們的最佳答案就是猜測。請通過限定%EOF來消除歧義,例如DOW NOT%EOF(ARCMASAC)。我收集說,這個程序有(可能更多)更多,我懷疑一些必要的調試件被省略。請考慮發佈整個源代碼(或足以消除這些問題)......並請請不要發佈固定格式的代碼,就像它是自由格式一樣。使用堆棧溢出的代碼功能,以便代碼正確顯示。仔細檢查http://publib.boulder.ibm.com/iseries/v5r2/ic2924/books/c092508429.htm#HDRBBEOF – Dennis

+0

是的,需要程序完成後的工作文件。 – Booksman

回答

1

你檢查countacountz值在第一DO循環 - 但是你是不是遞增,直到第二DO循環。

移動你:

c  counta  ifge  9990       
C     EVAL  *INLR = *ON     
c     leave         
c     endif         
c  countz  ifge  9990       
C     EVAL  *INLR = *ON     
c     leave         
c     endif 

代碼到第二DO循環。