× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



%STATUS (Return File or Program Status)

     %STATUS{(file_name)}

%STATUS returns the most recent value set for the program or file status.
%STATUS is set whenever the program status or any file status changes, usually
when an error occurs.

If %STATUS is used without the optional file_name parameter, then it returns the
program or file status most recently changed. If a file is specified, the value
contained in the INFDS *STATUS field for the specified file is returned. The
INFDS does not have to be specified for the file.

%STATUS starts with a return value of 00000 and is reset to 00000 before any
operation with an 'E' extender specified begins.

%STATUS is best checked immediately after an operation with the 'E' extender or
an error indicator specified, or at the beginning of an INFSR or the *PSSR
subroutine.

   ____________________________________________________________________________
      *...1....+....2....+....3....+....4....+....5....+....6....+....7...+....
      CL0N01Factor1+++++++Opcode(E)
+Factor2+++++++Result++++++++Len++D+HiLoEq....
       * The 'E' extender indicates that if an error occurs, the error
       * is to be handled as though an error indicator were coded.
       * The success of the operation can then be checked using the
       * %ERROR built-in function.  The status associated with the error
       * can be checked using the %STATUS built-in function.
      C                   EXFMT(E)  INFILE
      C                   IF        %ERROR
      C                   EXSR      CheckError
      C                   ENDIF
      C ...
       *-------------------------------------------------------------------
       * CheckError: Subroutine to process a file I/O error
       *-------------------------------------------------------------------
      C     CheckError    BEGSR
      C                   SELECT
      C                   WHEN      %STATUS < 01000
       * No error occurred
      C                   WHEN      %STATUS = 01211
       * Attempted to read a file that was not open
      C                   EXSR      InternalError
      C                   WHEN      %STATUS = 01331
       * The wait time was exceeded for a READ operation
      C                   EXSR      TimeOut
      C                   WHEN      %STATUS = 01261
       * Operation to unacquired device
      C                   EXSR      DeviceError
      C                   WHEN      %STATUS = 01251
       * Permanent I/O error
      C                   EXSR      PermError
      C                   OTHER
       * Some other error occurred
      C                   EXSR      FileError
      C                   ENDSL
      C                   ENDSR
   ____________________________________________________________________________
   Figure 163. %STATUS and %ERROR with 'E' Extender
   ____________________________________________________________________________

      DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords++++++++++++++++++++++++++
      D Zero            S              5P 0 INZ(0)
      CL0N01Factor1+++++++Opcode(E)
+Factor2+++++++Result++++++++Len++D+HiLoEq....
       * %STATUS starts with a value of 0
       *
       * The following SCAN operation will cause a branch to the *PSSR
       * because the start position has a value of 0.
      C     'A'           SCAN      'ABC':Zero    Pos
      C     BAD_SCAN      TAG
       * The following EXFMT operation has an 'E' extender, so %STATUS will
       * be set to 0 before the operation begins.  Therefore, it is
       * valid to check %STATUS after the operation.
       * Since the 'E' extender was coded, %ERROR can also be used to
       * check if an error occurred.
      C                   EXFMT(E)  REC1
      C                   IF        %ERROR
      C                   SELECT
      C                   WHEN      %STATUS = 01255
      C ...
      C                   WHEN      %STATUS = 01299
      C ...
       * The following scan operation has an error indicator.  %STATUS will
       * not be set to 0 before the operation begins, but %STATUS can be
       * reasonably checked if the error indicator is on.
      C     'A'           SCAN      'ABC':Zero    Pos                    10
      C                   IF        *IN10 AND %STATUS = 00100
      C ...
       * The following scan operation does not produce an error.
       * Since there is no 'E' extender %STATUS will not be set to 0,
       * so it would return a value of 00100 from the previous error.
       * Therefore, it is unwise to use %STATUS after an operation that
       * does not have an error indicator or the 'E' extender coded since
       * you cannot be sure that the value pertains to the previous
       * operation.
      C     'A'           SCAN      'ABC'         Pos
      C ...
      C     *PSSR         BEGSR
       * %STATUS can be used in the *PSSR since an error must have occurred.
      C                   IF        %STATUS = 00100
      C                   GOTO      BAD_SCAN
      C ...
   ____________________________________________________________________________
   Figure 164. %STATUS and %ERROR with 'E' Extender, Error Indicator and *PSSR

Peter Vidal
Pall Aeropower Corp.
SR Programmer Analyst
WWW.Pall.com / 727-539-8448, x2414

"A good player makes himself look good;
a great player makes the team look good."
Author unknown



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.