The following sample of the DOCEXITC CL exit program updates a new document's keys based on an existing, matching document. This program calls DOCEXITR, which is the RPG program that performs the keyword updates.

/***********************************************************************/
/*             AUTHOR:   RICHARD J. SCHOEN                             */
/*       DATE WRITTEN:   10/02/2002                                    */
/*            PURPOSE:   MAIN DOCUMENT CHECK-IN EXIT POINT             */
/*EXPECTED PARAMETERS:   NONE                                          */
/*      SWITCHES USED:   NONE                                          */
/*                LDA:   NONE                                          */
/***********************************************************************/
        PGM        PARM(&DOCID &REVISION &DOCTITLE &DOCFLR1 +
                     &DOCFLR2 &DOCFLR3 &DOCFLR4 &DOCFLR5 &KEY1 +
                     &KEY2 &KEY3 &KEY4 &KEY5 &KEY6 &KEY7 &KEY8 +
                     &KEY9 &KEY10 &DOCPATH &DOCFILE &DOCTYPE)

        DCL        VAR(&DOCID) TYPE(*CHAR) LEN(100)
        DCL        VAR(&REVISION) TYPE(*DEC) LEN(9 0)
        DCL        VAR(&DOCTITLE) TYPE(*CHAR) LEN(200)
        DCL        VAR(&DOCFLR1) TYPE(*CHAR) LEN(100)
        DCL        VAR(&DOCFLR2) TYPE(*CHAR) LEN(100)
        DCL        VAR(&DOCFLR3) TYPE(*CHAR) LEN(100)
        DCL        VAR(&DOCFLR4) TYPE(*CHAR) LEN(100)
        DCL        VAR(&DOCFLR5) TYPE(*CHAR) LEN(100)
        DCL        VAR(&KEY1) TYPE(*CHAR) LEN(200)
        DCL        VAR(&KEY2) TYPE(*CHAR) LEN(200)
        DCL        VAR(&KEY3) TYPE(*CHAR) LEN(200)
        DCL        VAR(&KEY4) TYPE(*CHAR) LEN(200)
        DCL        VAR(&KEY5) TYPE(*CHAR) LEN(200)
        DCL        VAR(&KEY6) TYPE(*CHAR) LEN(200)
        DCL        VAR(&KEY7) TYPE(*CHAR) LEN(200)
        DCL        VAR(&KEY8) TYPE(*CHAR) LEN(200)
        DCL        VAR(&KEY9) TYPE(*CHAR) LEN(200)
        DCL        VAR(&KEY10) TYPE(*CHAR) LEN(200)
        DCL        VAR(&DOCPATH) TYPE(*CHAR) LEN(255)
        DCL        VAR(&DOCFILE) TYPE(*CHAR) LEN(255)
        DCL        VAR(&DOCTYPE) TYPE(*CHAR) LEN(10)
        DCL        VAR(&ERRRTN) TYPE(*CHAR) LEN(1)

        MONMSG     MSGID(CPF0000) EXEC(GOTO CMDLBL(ERRORS))

/***************************************************/
/* CALL EXIT RPG PROGRAM TO UPDATE                 */
/* DOCUMENT KEYWORDS. PASS THE DOCID & KEYWORD 1   */
/* SO WE KNOW WHICH DOC WE'RE UPDATING             */
/* THIS ALLOWS KEYWORDS TO BE AUTO-FILLED          */
/* AFTER DOCUMENT CHECK-IN.                        */
/***************************************************/
        CALL       PGM(DOCEXITR) PARM(&DOCID &KEY1 &ERRRTN)

        RETURN     /* NORMAL EXIT */

/***************************************************/
/* HANDLE ERRORS */
/***************************************************/
ERRORS:
        SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) +
                     MSGDTA('ERRORWARN: Exit point Errors +
                     occurred occurred while running Image +
                     Server document check-in for document +
                     ID:' |> &DOCID) MSGTYPE(*INFO)
        MONMSG     MSGID(CPF0000) /* MAKE SURE WE EXIT */
        SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) +
                     MSGDTA('ERRORWARN: Exit point Errors +
                     occurred while running Image Server +
                     document check-in for document ID:' |> +
                     &DOCID) TOMSGQ(*SYSOPR)
        MONMSG     MSGID(CPF0000) /* MAKE SURE WE EXIT */

        ENDPGM 

DOCEXITR RPG Exit point program called by DOCEXITC

H******************************************************************       
H*                                                                *     
H*  PROGRAM:    DOCEXITR                                          *
H*  PURPOSE:    Update Document Keywords based on values          *   
H*              found in previous document with matching          *     
H*              value in Key Field 1.                             *     
H*  DATE:       04/23/2003                                        *     
H*  AUTHOR:     RICHARD J. SCHOEN.                                *   
H*                                                                *     
H****************************************************************** 
F* Documents by DOCID
FDOCS01    UF   E           K DISK                                        
F* Documents by KEYWORD1
FDOCS04    IF   E           K DISK                                      
F                                     RENAME(DOCS00R:DOCS04R)           
D*****                                                                
D* Timestamp data area                                          
D*****                                                              
D tstamp          s               z                                 
D date            s               d   datfmt(*iso)                
D time            s               t   timfmt(*iso)                
D                 ds                                              
D timeres                       12s 0                               
D   timetime                     6s 0 overlay(timeres:1)          
D   timedate                     6s 0 overlay(timeres:7)          
                                                                  
D WDOCTITLE       s            100A   inz()                     
D WKEYWORD1       s            200A   inz()                         
D WKEYWORD2       s            200A   inz()                       
D WKEYWORD3       s            200A   inz()                 
D WKEYWORD4       s            200A   inz()                       
D WKEYWORD5       s            200A   inz()                 
D WKEYWORD6       s            200A   inz()                     
D WKEYWORD7       s            200A   inz()               
D WKEYWORD8       s            200A   inz()                   
D WKEYWORD9       s            200A   inz()                   
D WKEYWORD10      s            200A   inz()               
                                                                
C****************************************************************   
C* *ENTRY PARAMETER LIST                                            
C****************************************************************       
C     *ENTRY        PLIST                                             
C                   PARM                    IDOCKEY         100       
C                   PARM                    IKEYWORD1       200        
C                   PARM                    ERRRTN            1            
                                                                        
C****************************************************************       
C* RETRIEVE DOCUMENT INFO FROM EXISTING DOCUMENT WITH MATCHING      
C* VALUE IN KEY 1 AND UPDATE TO NEW DOCUMENT                          
C****************************************************************       
C                   EVAL      ERRRTN = '0'                            
                                                                      
 *                  ** Chain for document record with Keyword 1           
 *                  ** We need to see if old doc exists or not.       
C     IKEYWORD1     SETLL     DOCS04                                      
C     IKEYWORD1     READE     DOCS04                               33     
                                                                          
 *                  ** Bail out if our current DOCID is the only          
 *                  ** matching record. No need to update keywords.       
C                   IF        %TRIM(DOCID) = %TRIM(IDOCKEY)             
C                   EVAL      ERRRTN = '1'                          
C                   MOVE      *ON           *INLR                     
C                   RETURN                                        
C                   ENDIF                                           
                                                                      
 *                  ** Bail out if old record does not exist            
 *                  ** matching record. No need to update keywords. 
C                   IF        *IN33 = *ON                                 
C                   EVAL      ERRRTN = '1'                            
C                   MOVE      *ON           *INLR                   
C                   RETURN                                        
C                   ENDIF                                         
                                                                      
 *                  ** If old document exists.                        
 *                  ** Save keywords 2 - 10 to work fields              
C                   Eval      WKEYWORD2  = %trimr(KEYWORD2)         
C                   Eval      WKEYWORD3  = %trimr(KEYWORD3)         
C                   Eval      WKEYWORD4  = %trimr(KEYWORD4)       
C                   Eval      WKEYWORD5  = %trimr(KEYWORD5)         
C                   Eval      WKEYWORD6  = %trimr(KEYWORD6)             
C                   Eval      WKEYWORD7  = %trimr(KEYWORD7)             
C                   Eval      WKEYWORD8  = %trimr(KEYWORD8)             
C                   Eval      WKEYWORD9  = %trimr(KEYWORD9)           
C                   Eval      WKEYWORD10 = %trimr(KEYWORD10)              
                                                                    
 *                  ** Retreive new DOCID record and update new keywords 2-10 
 *                  ** based on the previous checkin values.    
C     IDOCKEY       CHAIN     DOCS01                             34       
                                                                        
 *                  ** Bail out if record does not exist              
C                   IF        *IN34 = *ON                               
C                   EVAL      ERRRTN = '1'                            
C                   MOVE      *ON           *INLR               
C                   RETURN                                        
C                   ENDIF                                         
                                                                    
 *                  ** Move keywords 2 - 10 to current doc fields       
C                   Eval      KEYWORD2  = %trimr(WKEYWORD2)             
C                   Eval      KEYWORD3  = %trimr(WKEYWORD3)             
C                   Eval      KEYWORD4  = %trimr(WKEYWORD4)             
C                   Eval      KEYWORD5  = %trimr(WKEYWORD5)               
C                   Eval      KEYWORD6  = %trimr(WKEYWORD6)               
C                   Eval      KEYWORD7  = %trimr(WKEYWORD7)             
C                   Eval      KEYWORD8  = %trimr(WKEYWORD8)             
C                   Eval      KEYWORD9  = %trimr(WKEYWORD9)               
C                   Eval      KEYWORD10 = %trimr(WKEYWORD10)              
                                                                  
 *                  ** Update doc info                                  
C                   UPDATE    DOCS00R                               
                                                                  
C*                  ** Exit after adding new record                     
C                   MOVE      *ON           *INLR                       
C                   RETURN

 


Still have questions? We can help. Submit a case to Technical Support.

Last Modified On: December 10, 2016