Previous Topic: 7.3.2.1.1 - Define Non-database Files (USRFMT1)

Next Topic: 7.3.2.1.3 Define Input/Output Processing (USRFMT3)

7.3.2.1.2 Define Input Record Validation (USRFMT2)

The USRFMT2 macro is used to do initial validation of each
input record immediately after it is read.  In addition,
some essential data elements must be populated at this point.

Each record entering your USRFMT2 routine must experience
one of the following outcomes:

  o  It is completely rejected by incrementing the WEIRDREC
     counter and branching as explained below.

  o  It is found to be unwanted and is flagged to be skipped.

  o  It is accepted, validated etc., and reaches the end of
     your USRFMT2 routine.  This allows the code that
     contains the _USRSEL exit point, common field
     determination and observation checkpointing to be
     executed next.  This must occur for every observation of
     every FDA file created.

Consider the following items and code your routine
appropriately:

  o Occasionally, an input data stream contains troublesome
    records.  One such event may involve completely
    unrecognizable data.  These records must be handled by
    incrementing the MICS-supplied counter named WEIRDREC and
    then causing the next input record to be read:

      WEIRDREC+1;
      GOTO EOF_CK;

  o Another occasional occurrence is that the total length of
    the incoming record is not proper for the INPUT process
    that will follow.  Logic in your USRFMT2 routine should
    validate the input record length.

    The SAS variable RECLEN is specified in the INFILE
    statement in DYfdaFMT.  RECLEN contains the current input
    record's length.  Ensure that USRFMT2 checks the value of
    RECLEN prior to code that performs an INPUT of fields
    from the input record to avoid the error of attempting to
    read beyond the end of the record.

    When USRFMT2 determines that the current input record is
    not the expected length or is shorter than some minimum
    length, again the MICS-supplied counter named WEIRDREC
    must be incremented and the next input record read:

      WEIRDREC+1;
      GOTO EOF_CK;

  o Your USRFMT2 logic must assign the variables ENDTS and
    ORGSYSID to non-missing values for use by the CA MICS
    checkpoint process.  If you do not assign these variables
    properly, the prefix.MICS.CHECKPT.DATA data set will not
    be updated with valid ORGSYSID/COMPONENT checkpoint
    information.  If the timestamp to be associated with the
    end of an event is not immediately apparent given the
    input data source, call CA Technical Support for
    assistance in determining what value you should assign to
    ENDTS.

    The variable ENDTS is used to compute values for common
    CA MICS variables such as MONTH, YEAR, HOUR, and DAY.
    These variables will be computed in the %SYSID macro
    which is invoked between the %USRFMT2 and %USRFMT3 macros
    in DYfdaFMT.

  o If your FDA is processing SMF records, you are probably
    interested in only one or two SMF record types.  Read the
    record type information from the input record and examine
    it in USRFMT2.  When a record type should be dropped,
    set the MICS-supplied variable SKIP_REC to 1 and
    branch to the end of your USRFMT2 routine.  Ensure that
    ORGSYSID has a non-blank value such as ORTH or UNKN.

    Note that this may also be accomplished in the common
    _USRSEL input record selection exit. See section 4.3.2.1
    General Operational Exits in this guide.

  o The MICS-supplied label COMPROC: can be used when USRFMT2
    needs to branch to the end of its processing.  This label
    begins the routine that contains the _USRSEL exit point,
    common field determination and observation checkpointing.

  o DO NOT issue commands that cause the DATA step to return
    prematurely.  (RETURN and DELETE cause premature
    returns.)  Each pass of an input record must 'fall
    through' to the bottom of USRFMT2 or result in a GOTO to
    a label as described above.

You must not write output files in USRFMT2 because duplicate
data is not eliminated until later processing steps execute
CKRTN2.  If the DAILY job that invokes your format routine
and exits is processing the same data as a previous run of
the DAILY, CKRTN2 will eliminate the records that have been
processed before.  Records output from within USRFMT2 will
bypass the duplicate data checking performed by CKRTN2.