//ALOADMJI JOB ............................................  <== Verify
//**                                                                  *
//**           Copyright (c) 1995 - SAS Institute, Inc.               *
//**             Unpublished - All Rights Reserved                    *
//**                                                                  *
//**  Name   : ALOADMJI   ( assembler dynamically loaded C function)  *
//**                                                                  *
//**  Purpose: Demonstrate how to maintain a single C execution       *
//**           framework in a C and assembler environment.            *
//**                                                                  *
//**  Function: Compile, assemble, and lked'it source files listed    *
//**            below.                                                *
//**                                                                  *
//**  Source  : see prefix.SAMPLE.ASM members -                       *
//**            ALOADMM - C main for Part#1, statically linked with   *
//**                      an assembler routine                        *
//**            ALOADMC - C function to display CRAB address          *
//**            ALOADMA - Assembler routine used by Part#1 and Part#2 *
//**            ALOADMD - Dynamically loaded C function               *
//**                                                                  *
//**  Details : ALOADM is a two part example, this JCL supports       *
//**            Part 2.  See prefix.SAMPLE.ASM(ALOADMM) for details.  *
//**                                                                  *
//**  NOTE: Ensure the statments indicated by '<==Verify' have been   *
//**        customized for your local environment.  'prefix' is the   *
//**        installation defined high level qualifier for the SAS/C   *
//**        product.                                                  *
//**                                                                  *
//**                                                                  *
//*
//*********************************************************************
//*                                                                   *
//*  Using HLASM, assemble the assembler program.                     *
//*  Note: MAC1 is the SAS/C assembler macro library.                 *
//*                                                                   *
//*  Options NODECK and OBJECT specify where the assembler is to      *
//*  place the output object deck.                                    *
//*                                                                   *
//*  Opiton SYSPARM(INDEP) is required so that the conditional        *
//*  asssembly instruction will know how to specify the               *
//*  CENTRY and CEXIT macros.                                         *
//*                                                                   *
//*********************************************************************
//*
//ALOADMA     EXEC hlasmc,                                   <== Verify
//            PARM.ASM='NODECK,OBJECT,SYSPARM(INDEP)',
//            MAC1='prefix.MACLIBA'                          <== Verify
//ASM.SYSIN   DD  DSN=prefix.SAMPLE.ASM(ALOADMA),            <== Verify
//            DISP=SHR
//ASM.SYSLIN  DD DSN=your.object.library(ALOADMA),           <== Verify
//            DISP=SHR
//*
//*********************************************************************
//*                                                                   *
//*  Complile the C fucntion which displays the CRAB address.         *
//*                                                                   *
//*********************************************************************
//*
//ALOADMC      EXEC LC370C,COND=(0,NE)
//C.SYSLIN     DD DSN=your.object.library(ALOADMC),          <== Verify
//             DISP=SHR
//C.SYSIN      DD DSN=prefix.SAMPLE.ASM(ALOADMC),            <== Verify
//             DISP=SHR
//*
//*********************************************************************
//*                                                                   *
//*  CLINK the assembler module with the C function.                  *
//*                                                                   *
//*  Note: CLINK is not required in this sample but is being used     *
//*        for illustration only.                                     *
//*                                                                   *
//*********************************************************************
//*
//CLINK1       EXEC LC370LR,COND=(0,NE)
//LKED.SYSLMOD DD DSN=your.load.library,                     <== Verify
//             DISP=SHR
//LKED.SYSIN   DD *
  INCLUDE INPTOBJ(ALOADMA)  Assembler dynamic loader routine
  INCLUDE INPTOBJ(ALOADMC)  C function to display CRAB
  ENTRY CASM                Ensure Correct Entry Point
  NAME  ALOADMJI(R)         The Dynamic Loader Module
/*
//LKED.INPTOBJ DD DSN=your.object.library,                   <== Verify
//             DISP=SHR
//*
//*********************************************************************
//*                                                                   *
//*  Compile the C function that will be dynamically loaded.          *
//*                                                                   *
//*  Note: Reentrant code is not required for this sample, but is     *
//*        being used here because so many functions which are        *
//*        dynmaically loaded are required to be reentrant.           *
//*                                                                   *
//*********************************************************************
//*
//CDYNLOAD     EXEC LC370C,COND=(0,NE),
//             PARM.C='RENT'
//C.SYSLIN     DD DSN=your.object.library(ALOADMD),          <== Verify
//             DISP=SHR
//C.SYSIN      DD DSN=prefix.SAMPLE.ASM(ALOADMD),            <== Verify
//             DISP=SHR
//*
//*********************************************************************
//*                                                                   *
//* CLINK the dynamically loaded module with the C function to        *
//* display the CRAB address.                                         *
//*                                                                   *
//*  Note: CLINK must be used to pre-link this dynamically loaded     *
//*        module because it was compiled with the                    *
//*        because it was compiled with the 'RENT' option.            *
//*                                                                   *
//*  Note: Dynmaically loaded C programs are required to have one     *
//*        of two entry points:                                       *
//*        Reentrant Code:      #DYNAMN                               *
//*        Non-Reentrant Code:  #DYNAMNR                              *
//*                                                                   *
//*********************************************************************
//*
//CLINK2       EXEC LC370LR,COND=(0,NE)
//LKED.SYSLMOD DD DSN=your.load.library,                     <== Verify
//             DISP=SHR
//LKED.SYSIN   DD *
  INCLUDE INPTOBJ(ALOADMD)   C function to be dynamically loaded
  INCLUDE INPTOBJ(ALOADMC)   C function to display CRAB
  ENTRY #DYNAMN              <Notice Entry: Reentrant Code
  NAME  CDYNLD(R)            Create module to load
/*
//LKED.INPTOBJ DD DSN=your.object.library,                   <== Verify
//             DISP=SHR
//*
//*********************************************************************
//*                                                                   *
//* Execute the sample program.                                       *
//*                                                                   *
//*********************************************************************
//*
//GO           EXEC PGM=ALOADMJI,COND=(0,NE)
//STEPLIB      DD DSN=your.load.library,                     <== Verify
//             DISP=SHR
//             DD DSN=prefix.LOAD,                           <== Verify
//             DISP=SHR
//SYSPRINT DD SYSOUT=A                                       <-- stdout
//SYSTERM  DD SYSOUT=A                                       <-- stderr
//SYSUDUMP DD SYSOUT=A
/*
//