Ü   BEGSR (Beginning of Subroutine)

   

§  The op-code represents beginning of a subroutine placed in factor-1.

§  If factor-1 entry is *PSSR then this subroutine will handle all program exceptions/errors. Only one subroutine can be defined with *PSSR.

§  If factor-1 entry is *INZSR, it represents the initialization of the program and will be executed only once when the program starts. Only one subroutine can be defined with *INZSR.

Factor 1

Op-code

Factor 2

Result Field

Resulting Indicators

Subroutine name/*PSSR/*INZSR

BEGSR

 

 

 

 

 

 

Example


0006.09  *____________________________________________________________________
0009.00 C     *IN03         DOWEQ     *OFF
0010.00 C                   EXSR      MAIN
0010.03 C                   EXSR      DSPSFL
0011.00 C                   ENDDO
0012.00 C                   SETON                                            LR
0013.00 C*
0014.00 C*_____________________________________________
0015.00 C*____________MAIN SUBROUTINE BEGINS HERE______
0016.00 C*_____________________________________________
0017.00 C     MAIN          BEGSR               >>>>>>>>>>>>>>>>>>>
0018.00 C**** some operation code comes here
0019.00 C                   ENDSR
0020.00 C*_________________________________________________
0021.00 C*_________________________________________________
0022.00 C*_______________CLEAR SUBFILE_____________________
0023.00 C*_________________________________________________
0024.00 C     CLRSFL        BEGSR               >>>>>>>>>>>>>>>>>>>
0024.01 C**** Clear the subfile
0029.00 C                   ENDSR
0030.00 C*_________________________________________________
0031.00 C*_______________FIRST FUBROUTINE__________________
0032.00 C*_________________________________________________
0033.00 C*
0034.00 C     *INZSR        BEGSR               >>>>>>>>>>>>>>>>>>>
0034.01 C                   SETOFF                                       505152
0034.02 C                   SETOFF                                       45
0035.00 C                   Z-ADD     *ZEROS        RRN               4 0
0035.01 C                   EVAL      S_RECNO=1
0040.00 C                   ENDSR
0041.00 C*_________________________________________________
0042.00 C*_______________FILL SUBFILE__________________
0043.00 C*_________________________________________________
0044.00 C*
0045.00 C     FILSFL        BEGSR               >>>>>>>>>>>>>>>>>>>
0047.00 C*** Fill the subfile Buffer
0061.00 C                   ENDSR
0062.00 C*_________________________________________________
0063.00 C*
0064.00 C     DSPSFL        BEGSR               >>>>>>>>>>>>>>>>>>>
0065.00 C**** Display the subfile
0069.00 C                   ENDSR
****************** End of data ****************************************

 











User Comments:



Subscribe

.  


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