Article

Build data structures -- Code

David Anderson
 BUILMV - Display file to collect parameters.

A                                      DSPSIZ(24 80 *DS3)          
A                                      CA03(03 'END OF JOB')       
A          R FMT001                                                
A                                  2  5'BUILDMV'                   
A N30                              2 31'BUILD MOVE CALCULATIONS'   
A                                      DSPATR(HI)                  
A  30                              2 31'BUILD DATA STRUCTURES'     
A                                      DSPATR(HI)                  
A                                  2 73DATE                        
A                                      EDTCDE(Y)                   
A                                  3  5'BUILDMV(FMT001)'           
A                                      DSPATR(UL)                  
A                                  3 73TIME                        
A                                      DSPATR(UL)                  
A                                  6 25'PHYSICAL FILE NAME....'    
A            FILE          10A  I  6 49                            
A                                  7 25'OBJECT LIBRARY NAME...'  
A            LIB1          10A  B  7 49                          
A                                  9 25'RPG PROGRAM NAME......'  
A            PROG          10A  I  9 49                          
A                                 10 25'SOURCE LIBRARY NAME...'  
A            LIB2          10A  B 10 49                          
A                                 23  7'CMD03:'                  
A                                      DSPATR(RI)                
A                                 23 14'EXIT'                    
A                                      DSPATR(HI)                
****************** End of data **********************************

BUILDDSCL - CLP to display screen and call program.

PGM                                                    
DCL        VAR(&FILE) TYPE(*CHAR) LEN(10)              
DCL        VAR(&LIB1) TYPE(*CHAR) LEN(10) +            
             VALUE('*LIBL     ')                       
DCL        VAR(&PROG) TYPE(*CHAR) LEN(10)              
DCL        VAR(&LIB2) TYPE(*CHAR) LEN(10) +            
             VALUE('TESTLIB   ')                       
DCLF       FILE(BUILDMV) RCDFMT(FMT001)                
CLRPFM     FILE(DSPFFDPF)                              
CHGVAR     VAR(&IN30) VALUE('1')                       
                                                       
SNDRCVF    RCDFMT(FMT001)                              
IF         COND(*IN03 = '1') THEN(GOTO CMDLBL(END001)) 
IF         COND(&FILE = ' ') THEN(GOTO CMDLBL(END001)) 
IF         COND(&PROG = ' ') THEN(GOTO CMDLBL(END001)) 
IF         COND(&LIB1 = ' ') THEN(GOTO CMDLBL(END001)) 
IF         COND(&LIB2 = ' ') THEN(GOTO CMDLBL(END001))    
DSPFFD     FILE(&LIB1/&FILE) OUTPUT(*OUTFILE) +           
             OUTFILE(DSPFFDPF2)                           
OVRDBF     FILE(QRPGLESRC) TOFILE(&LIB2/QRPGLESRC) +      
             MBR(&PROG)                                   
CALL       PGM(BUILDDSILE)                                
CLRPFM     FILE(DSPFFDPF2)                                
END001:     ENDPGM                                                        
****************** End of data **********************************

BUILDDSILE - Program to create DS & 'D' specs.

FDSPFFDPF2 IP   E             DISK                               
FQRPGLESRC O    E             DISK    RENAME(QRPGLESRC:OUTPUT)   
F*                                                               
D*                                                               
D ARA             S              1    DIM(100)                   
D*                                                               
D                 DS                                             
D WHTEXT                  1     50                               
D  FLD_TEXT               1     15                               
D*                                                               
D                 DS                                             
D  DECA                   1      2                               
D   DEC1                  1      1  0                            
D   DEC2                  2      2  0                            
D   DEC1A                 1      1                               
D   DEC2A                 2      2                               
D*                                                                     
D                 DS                                                   
D  BYTEA                  1      5                                     
D  BYTE1                  1      1  0                                  
D  BYTE2                  2      2  0                                  
D  BYTE3                  3      3  0                                  
D  BYTE4                  4      4  0                                  
D  BYTE5                  5      5  0                                  
D  BYTE1A                 1      1                                     
D  BYTE2A                 2      2                                     
D  BYTE3A                 3      3                                     
D  BYTE4A                 4      4                                     
D  BYTE5A                 5      5                                     
C*                                                                    *
C**********************************************************************
C*                                                                    *
C     *IN(99)       IFEQ      '0'                                      
C                   MOVE      '1'           *IN(99)                
C                   Z-ADD     1             SEQ               6 2  
C                   MOVE      'D'           ARA(6)                 
C                   MOVEA     'DS'          ARA(24)                
C                   MOVEA     ARA           SRCDTA                 
C                   MOVE      UDATE         SRCDAT                 
C                   WRITE     OUTPUT                               
C                   ADD       1             SEQ                    
C                   Z-ADD     1             START                  
C                   MOVEL     WHNAME        HLD_FMT          10    
C                   MOVE      *BLANKS       BLANK1          100    
C                   MOVEA     BLANK1        ARA(1)                 
C                   MOVE      'D'           ARA(6)                 
C                   MOVEA     WHNAME        ARA(7)                 
C                   MOVEA     ARA           SRCDTA                 
C                   MOVE      UDATE         SRCDAT                 
C                   WRITE     OUTPUT                               
C                   ADD       1             SEQ                        
C                   ENDIF                                              
C*                                                                    *
C**********************************************************************
C*                                                                    *
C     WHNAME        IFNE      HLD_FMT                                  
C                   MOVE      *BLANKS       BLANK1          100        
C                   MOVEA     BLANK1        ARA(1)                     
C                   MOVE      'D'           ARA(6)                     
C                   MOVEA     'DS'          ARA(24)                    
C                   MOVEA     ARA           SRCDTA                     
C                   MOVE      UDATE         SRCDAT                     
C                   WRITE     OUTPUT                                   
C                   ADD       1             SEQ                        
C                   MOVE      *BLANKS       BLANK1          100        
C                   MOVEA     BLANK1        ARA(1)                     
C                   MOVE      'D'           ARA(6)                     
C                   MOVEA     WHNAME        ARA(7)                     
C                   MOVEA     ARA           SRCDTA                     
C                   MOVE      UDATE         SRCDAT                     
C                   WRITE     OUTPUT                                   
C                   ADD       1             SEQ                        
C                   Z-ADD     1             START             5 0      
C                   MOVEL     WHNAME        HLD_FMT          10        
C                   ENDIF                                              
C*                                                                     
C*                                                                     
C     '*IN'         SCAN      WHFLDI                                 66
C                   IF        NOT *IN(66)                              
C                   MOVE      *BLANKS       BLANK1          100        
C                   MOVEA     BLANK1        ARA(1)                     
C                   MOVE      'D'           ARA(6)                     
C                   MOVE      START         BYTEA                      
C     BYTE1         IFGT      0                                        
C                   MOVE      BYTE1A        ARA(28)   
C                   MOVE      BYTE2A        ARA(29)   
C                   MOVE      BYTE3A        ARA(30)   
C                   MOVE      BYTE4A        ARA(31)   
C                   MOVE      BYTE5A        ARA(32)   
C                   ELSE                              
C     BYTE2         IFGT      0                       
C                   MOVE      BYTE2A        ARA(29)   
C                   MOVE      BYTE3A        ARA(30)   
C                   MOVE      BYTE4A        ARA(31)   
C                   MOVE      BYTE5A        ARA(32)   
C                   ELSE                              
C     BYTE3         IFGT      0                       
C                   MOVE      BYTE3A        ARA(30)   
C                   MOVE      BYTE4A        ARA(31)   
C                   MOVE      BYTE5A        ARA(32)   
C                   ELSE                              
C     BYTE4         IFGT      0                                   
C                   MOVE      BYTE4A        ARA(31)               
C                   MOVE      BYTE5A        ARA(32)               
C                   ELSE                                          
C                   MOVE      BYTE5A        ARA(32)               
C                   ENDIF                                         
C                   ENDIF                                         
C                   ENDIF                                         
C                   ENDIF                                         
C*                                                                
C                   Z-ADD     WHFLDP        DEC               2 0 
C                   MOVE      DEC           DECA                  
C*                                                                
C                   IF        WHFLDD > 0                          
C                   Z-ADD     WHFLDD        BYTE#             5 0 
C                   ELSE                                          
C                   Z-ADD     WHFLDB        BYTE#             5 0 
C                   ENDIF                                       
C                   ADD       BYTE#         START               
C     START         SUB       1             ENDPOS            5 
C                   MOVE      ENDPOS        BYTEA               
C                   MOVEA     WHFLDI        ARA(8)              
C     BYTE1         IFGT      0                                 
C                   MOVE      BYTE1A        ARA(35)             
C                   MOVE      BYTE2A        ARA(36)             
C                   MOVE      BYTE3A        ARA(37)             
C                   MOVE      BYTE4A        ARA(38)             
C                   MOVE      BYTE5A        ARA(39)             
C                   ELSE                                        
C     BYTE2         IFGT      0                                 
C                   MOVE      BYTE2A        ARA(36)             
C                   MOVE      BYTE3A        ARA(37)             
C                   MOVE      BYTE4A        ARA(38)             
C                   MOVE      BYTE5A        ARA(39)             
C                   ELSE                               
C     BYTE3         IFGT      0                        
C                   MOVE      BYTE3A        ARA(37)    
C                   MOVE      BYTE4A        ARA(38)    
C                   MOVE      BYTE5A        ARA(39)    
C                   ELSE                               
C     BYTE4         IFGT      0                        
C                   MOVE      BYTE4A        ARA(38)    
C                   MOVE      BYTE5A        ARA(39)    
C                   ELSE                               
C                   MOVE      BYTE5A        ARA(39)    
C                   ENDIF                              
C                   ENDIF                              
C                   ENDIF                              
C                   ENDIF                              
C*                                                     
C     WHFLDD        IFGT      0                        
C     DEC1          IFGT      0                    
C                   MOVE      DEC1A         ARA(41)
C                   MOVE      DEC2A         ARA(42)
C                   ELSE                           
C                   MOVE      DEC2A         ARA(42)
C                   ENDIF                          
C                   ENDIF                          
C*                                                 
C                   MOVEA     FLD_TEXT      ARA(81)
C                   MOVEA     ARA           SRCDTA 
C                   MOVE      UDATE         SRCDAT 
C                   Z-ADD     SEQ           SRCSEQ 
C                   WRITE     OUTPUT               
C                   ADD       1             SEQ    
C                   ENDIF                          
**************** End of data *** 
Related Topics: iSeries skills, VIEW ALL TOPICS

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: