cobol2.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
STICKY-LINKAGE Details (↑ Choosing Run-time Behavior)
 Key Summary                             Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
     A program can be called via different entry-points that expect
     different parameters. When a Linkage Section record is used as a
     parameter in a called program it is linked to the corresponding
     data item in the calling program. This directive causes such
     links to remain during subsequent calls of the called program, so
     that the record can be accessed during subsequent calls even if
     they are via entry-points that do not use it as a parameter.
 
     For example, in the calling program:
 
       CALL "ENTRY-1" USING HOURLY-RATE EMPLOYEE
       CALL "ENTRY-2"                           *> STICKY-LINKAGE "1" or "2"
 
       CALL "ENTRY-1" USING HOURLY-RATE         *> STICKY-LINKAGE "2" only
 
     In the called program:
 
       ENTRY "ENTRY-1" USING HOURLY-RATE.
       DISPLAY HOURLY-RATE
       DISPLAY EMPLOYEE
       EXIT PROGRAM.
 
       ENTRY "ENTRY-2".
       DISPLAY HOURLY-RATE
       EXIT PROGRAM.
 
     Specifying STICKY-LINKAGE "1" causes the called program to fill in any
     parameters not specified in the ENTRY... USING phrase. Thus, both the
     DISPLAY HOURLY-RATE statements will work correctly for the first two
     CALL statements, but DISPLAY EMPLOYEE will cause run-time error 203
     (CALL parameter not supplied (fatal)).
 
     Specifying STICKY-LINKAGE "2" causes the called program to fill in any
     parameter not actually passed by the caller. The caller must be a
     COBOL program ,which, if generated, was generated with PARMCOUNTCHECK.
     Thus, the DISPLAY EMPLOYEE statement will work correctly for the first
     and third calls, as well as the DISPLAY HOURLY-RATE statement in all
     three cases.
 
     With NOSTICKY-LINKAGE specified, the second and third calls will
     cause run-time error 203 (CALL parameter not supplied (fatal)).
 
     See also PARAMCOUNTCHECK
                                    -♦-