                         A M S C A L L


      This routine can be recalled from a Cobol or Assembler program
and allow to do IDCAMS commands from inside the program.
So, the program itself can do a DELETE/DEFINE, a LISTCAT, REPRO etc. 
using, as SYSIN cards, normal variables setted by the program.
Usually, is advisable do a separate step to do IDCAMS commands, because
it is more maintenable; this routine can be used in any case in which
is not possible to know in advance what IDCAMS command will be do at
run time.


      In cobol:

            CALL 'AMSCALL' USING LEN-FIELD COMMAND

      where:
            LEN-FIELD   PIC   S9(7)      COMP  VALUE +nnn.
            COMMAND     PIC   X(nnn).

      In assembler:
            CALL AMSCALL,(LENFIELD,COMMAND),VL   (omit 'VL' in VSE)

      where
            LENFIELD    DC    F'nnn'
            COMMAND     DS    CLnnn

  In "LENFIELD" will be length of field "COMMAND" (that is  nnn)
  ("LENFIELD" must be from  40 and 10000)
  "COMMAND" is the program variable containings IDCAMS commands
  written exactly in the same manner of normal IDCAMS cards in SYSIN.
  "COMMAND" can be broken in more variables provided that:
  - are contigous
  - sum of theirs length is in LEN-FIELD

      Since this routine associate to input 'COMMANd' one or more
SYSIN records, with length 70 characters each, is recommended that
'COMMAND' is broken in more variables of length 70 each, as if each of
this is a line of SYSIN; use as usual character '-' to continue command
in the next line.
At return calling program has in "LEN-FIELD" the return code.
Note: in MVS 'SYSPRINT' cannot be opened from calling program, because 
is used from IDCAMS for its messages; in VSE SYSLIST can be opened:
in this case IDCAMS messages are mixed with program output in SYSLIST.

This routine cannot be used in a CICS program.


      Here an example of Cobol program recalling AMSCALL:


       IDENTIFICATION DIVISION.
       PROGRAM-ID.   PROVA1.
       AUTHOR. PIERO.
      ****************************************************************
      * PROVA RICHIAMO DELLA ROUTINE AMSCALL                         *
      ****************************************************************
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SPECIAL-NAMES.
           DECIMAL-POINT  IS  COMMA.
      ****************************************************************
       DATA DIVISION.
       WORKING-STORAGE SECTION.
      * Two IDCAMS command: DELETE and LISTCAT  **********************
       77  LEN-FIELD   PIC   S9(7)      COMP  VALUE  +210.
       77  COMMAND     PIC   X(70) VALUE
                   '     DELETE PROVA.PIERO.ELENCO    -          '.
       77  FILLER1     PIC   X(70) VALUE
                   '            CLUSTER PURGE '.
       77  FILLER2     PIC   X(70) VALUE
                   '     LISTCAT NAME CAT(CATALOGO.SYSWK3) '.
      ****************************************************************
       PROCEDURE DIVISION.
       INIZIO.
           MOVE +210 TO LEN-FIELD.
           CALL 'AMSCALL' USING LEN-FIELD COMMAND.
           DISPLAY 'RC= ' LEN-FIELD.
       FINE.
           STOP RUN.
      ********************************************************* END *


