Example 2 (PL/I: non-DLL)

The following is an example of a PL/I program calling IDISNAP four times, showing several of the different invocation styles.
*PROCESS COMPILE,ATTRIBUTES,AGGREGATE,MAP,LIST,ESD,NEST;
 @960IDI:PROC OPTIONS(MAIN) REORDER;
    DCL  WKPTR              PTR ;
    DCL  WORK               CHAR(4) INIT('0001') ;
    DCL  WORK140            CHAR(140) INIT(' ');
    DCL  WORK1402           CHAR(140) INIT(' ');
    DCL  NUMWK              FIXED DEC(9) INIT(0)  ;
    DCL  NUMWK2             FIXED DEC(9) INIT(0)  ;
    DCL  PICWK              PIC'999' INIT(0);
    DCL  IDISNAP EXTERNAL ENTRY;
 /* ON ERROR CALL PLIDUMP('  F   B  ') */
 /* ON ERROR CALL IDISNAP(WORK,WORK140) */
    FETCH IDISNAP;
    CALL SUBA;
 SUBA: PROCEDURE ;
    CALL SUBB;
 END SUBA;
 SUBB: PROCEDURE ;
    /* THIS WILL CALL IDISNAP 4 TIMES THEN ABEND FOR CALL 5 */
    CALL IDISNAP;
    DISPLAY ('ZZZ RETURNED FROM IDISNAP TO SUBB');
    CALL IDISNAP('0000');
    DISPLAY ('ZZZ RETURNED FROM IDISNAP(0000) TO SUBB');
    WORK140 = 'USER TITLE DATA.';
    CALL IDISNAP(WORK,WORK140);
    WORK = '0002';
    WORK140 = 'USER TITLE DATA.';
    WORK1402 = 'DATASETS(IDIHIST(NULLFILE))';
    CALL IDISNAP(WORK,WORK140,WORK1402);
    PICWK = NUMWK2       ;
    PICWK = NUMWK2       ;
    PICWK = NUMWK2/NUMWK ;
 END SUBB;
 END @960IDI;