Ü    EXCEPT (rpgle) / EXCPT (rpg)

·         The EXCEPT opcode is used to write the exception records.

·         Exceptional records are defined at  O-spec with ‘E’ as record type.

·         Whatever exceptional fields have been defined inside the exception records will be processed during the c-spec calculation.

·         If there are multiple entries for the same record name then they will be processed one by one.

·         EXCEPT can be used for printing a report and to partially update a physical file.

 

Example

 

       I.            Partially update a file using EXCEPT

 

 


 Columns . . . :    6 100                                      Browse         
 SEU==>                                                                       
 FMT FX FFilename++IPEASF.....L.....A.Device+.Keywords+++++++++++++++++++++++++
        *************** Beginning of data *************************************
0001.00 FACCOUNT   UF A E           K DISK                                    
0002.00  *                                                                    
0003.00 C     KLST1         KLIST                                             
0004.00 C                   KFLD                    ORG                       
0005.00 C                   KFLD                    ACC                       
0006.00 C                   EVAL      ORG=192                                 
0007.00 C                   EVAL      ACC='A00000000017'                      
0008.00 C     KLST1         SETLL     ACCOUNT                                 
0009.00 C                   IF        %EQUAL(ACCOUNT)                         
0010.00 C                   READ      ACCOUNT                                 
0011.00 C                   EVAL      CCY='AZK'                               
0012.00 C                   EXCEPT    UPDATE_R                                
0013.00 C                   ENDIF                                             
0014.00 C                   SETON                                        LR   
0015.00  *                                                                     
0016.00 OREC1      E            UPDATE_R                                      
0017.00 O                       CCY                                           
        ****************** End of data ****************************************

 

 


    II.            Print a report using EXCEPT



Columns . . . :    1 100                    Browse
SEU==>
FMT FX .....FFilename++IPEASF.....L.....A.Device+.Keywords+++++++++++++++++++++++++++++
*************** Beginning of data **********************************************
0001.00      FACCOUNT   UF A E           K DISK
0002.00      FQPRINT    O    F  132        PRINTER OFLIND(*In90)
0003.00       *
0004.00      C                   EXCEPT    HEADER
0005.00      C     *LOVAL        SETLL     ACCOUNT
0006.00      C                   READ(N)   ACCOUNT
0007.00      C                   DOW       NOT %EOF(ACCOUNT)
0008.00      C                   IF        *IN90=*ON
0009.00      C                   EXCEPT    HEADER
0010.00      C                   ENDIF
0011.00      C                   EXCEPT    DETAIL
0012.00      C                   READ(N)   ACCOUNT
0013.00      C                   ENDDO
0014.00      C                   EXCEPT    FOOTER
0015.00      C                   SETON                                        LR
0016.00       *
0017.00      OQPRINT    E            HEADER                          >>>> Exception record with
0018.00      O                                            6 'PAGE'    record name entry ‘HEADER’
0019.00      O                       Page                10
0020.00      O                                           47 'PARTY ACCOUNT REPORT'
0021.00      O                                           65 'DATE'
0022.00      O                       Udate         Y     75
0023.00      O          E            HEADER            1             >>>>> Exception record with
0024.00      O                                           10 'ORG CODE' record name ‘HEADER’
0025.00      O                                           25 'ACCOUNT NO'
0026.00      O                                           36 'CURRENCY'
0027.00      O                                           52 'PARTY NAME'
0028.00      O          E            DETAIL      1                   >>>>> Exception record with
0029.00      O                       ORG                 10           record name entry ‘DETAIL’
0030.00      O                       ACC                 25
0031.00      O                       CCY                 36
0032.00      O                       PARTY               52
0033.00      O          E            FOOTER      1                 >>>record name entry ‘FOOTER’
0034.00      O                                           42 '**************************'
****************** End of data ********************************************************


 

 

OUTPUT

 


                                    Display Spooled File
File  . . . . . :   QPRINT                                                Page/Line   1/1
Control . . . . .                                                     Columns     1 - 130
Find  . . . . . .
*...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9
PAGE   1                 PARTY ACCOUNT REPORT              DATE   2/09/13
ORG CODE     ACCOUNT NO   CURRENCY      PARTY NAME
190   A00000000001        CCY    P00000000001
190   A00000000005        INR    P00000000005
190   A00000000006        TRY    P00000000006
191   A00000000002        EUR    P00000000002
191   A00000000008        GBP    P00000000002
191   A00000000009        USD    P00000000001
192   A00000000003        USD    P00000000003
192   A00000000004        TRY    P00000000004
192   A00000000007        INR    P00000000007
195   A00000000010        EUR    P00000000003
**************************
 
Bottom
F3=Exit   F12=Cancel   F19=Left   F20=Right   F24=More keys


 

 


 III.            Print a report using EXCEPT with no entry in FACTOR-2

 

When we are putting EXCEPT opcode with no entry in factor-2, then all the exception records with no record name entry in output spec are written during the calculation as is clear from the example below.

 

 


        *************** Beginning of data ***********************************
0001.00 FACCOUNT   UF A E           K DISK
0002.00 FQPRINT    O    F  132        PRINTER OFLIND(*In90)
0003.00  *
0004.00 C                   EXCEPT    HEADER
0005.00 C                   EXCEPT                    >>> EXCEPT opcode without FACTOR-2 entry
0006.00 C     *LOVAL        SETLL     ACCOUNT
0007.00 C                   READ(N)   ACCOUNT
0008.00 C                   DOW       NOT %EOF(ACCOUNT)
0009.00 C                   IF        *IN90=*ON
0010.00 C                   EXCEPT    HEADER
0011.00 C                   EXCEPT                    >>> EXCEPT opcode without FACTOR-2 entry
0012.00 C                   EVAL      *IN90=*OFF
0013.00 C                   ENDIF
0014.00 C                   EXCEPT    DETAIL
0015.00 C                   READ(N)   ACCOUNT
0016.00 C                   ENDDO
0017.00 C                   EXCEPT    FOOTER
0018.00 C                   SETON                                        LR
0019.00  *
0020.00 OQPRINT    E            HEADER                           >>>>> Exception record with
0021.00 O                                            6 'PAGE'        record name entry ‘HEADER’
0022.00 O                       Page                10
0023.00 O                                           47 'PARTY ACCOUNT REPORT'
0024.00 O                                           65 'DATE'
0025.00 O                       Udate         Y     75
0026.00 O          E                              1               >>>>> Exception record with
0027.00 O                                           10 'ORG CODE'        no record name entry
0028.00 O                                           25 'ACCOUNT NO'
0029.00 O                                           36 'CURRENCY'
0030.00 O                                           52 'PARTY NAME'
0031.00 O          E            DETAIL      1                     >>>> Exception record with
0032.00 O                       ORG                 10              record name entry ‘DETAIL’
0033.00 O                       ACC                 25
0034.00 O                       CCY                 36
0035.00 O                       PARTY               52
0036.00 O          E            FOOTER      1                  >>>> record name entry ‘FOOTER’
0037.00 O                                           42 '**************************'
****************** End of data *********************************************************

 

 

 

OUTPUT

 


                                       Display Spooled File
File  . . . . . :   QPRINT                                                 Page/Line   1/1
Control . . . . .                                                      Columns     1 - 130
Find  . . . . . .
*...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9
PAGE   1                 PARTY ACCOUNT REPORT              DATE   2/09/13
ORG CODE     ACCOUNT NO   CURRENCY      PARTY NAME
190   A00000000001        CCY    P00000000001
190   A00000000005        INR    P00000000005
190   A00000000006        TRY    P00000000006
190   A00000000013        EUR    P00000000009
190   P00000000019        EUR    P00000000015
191   A00000000002        EUR    P00000000002
191   A00000000008        GBP    P00000000002
191   A00000000009        USD    P00000000001
PAGE   2                 PARTY ACCOUNT REPORT              DATE   2/09/13
ORG CODE     ACCOUNT NO   CURRENCY      PARTY NAME
191   P00000000014        USD    P00000000004
192   A00000000003        USD    P00000000003
192   A00000000004        TRY    P00000000004
192   A00000000007        INR    P00000000007
192   A00000000012        EUR    P00000000002
192   A00000000015        INR    P00000000010
192   A00000000016        GBP    P00000000011
192   A00000000017        GBP    P00000000017
193   A00000000011        TRY    P00000000005
195   A00000000010        EUR    P00000000003
         **************************
                                                                                 Bottom
F3=Exit   F12=Cancel   F19=Left   F20=Right   F24=More keys












User Comments:



Subscribe

.  


Copyright © www.go4as400.com, 2013-2023. Copyright notice   Terms of services   Privacy policy