FORTRAN Generation
(/./ftp/cats/V/147)

Conversion of standardized ReadMe file for file /./ftp/cats/V/147 into FORTRAN code for reading data files line by line.

Note that special values are assigned to unknown or unspecified numbers (also called NULL numbers); when necessary, the coordinate components making up the right ascension and declination are converted into floating-point numbers representing these angles in degrees.



      program load_ReadMe
C=============================================================================
C  F77-compliant program generated by readme2f_1.81 (2015-09-23), on 2024-Apr-16
C=============================================================================
*  This code was generated from the ReadMe file documenting a catalogue
*  according to the "Standard for Documentation of Astronomical Catalogues"
*  currently in use by the Astronomical Data Centers (CDS, ADC, A&A)
*  (see full documentation at URL http://vizier.u-strasbg.fr/doc/catstd.htx)
*  Please report problems or questions to   
C=============================================================================

      implicit none
*  Unspecified or NULL values, generally corresponding to blank columns,
*  are assigned one of the following special values:
*     rNULL__    for unknown or NULL floating-point values
*     iNULL__    for unknown or NULL   integer      values
      real*4     rNULL__
      integer*4  iNULL__
      parameter  (rNULL__=--2147483648.)  	! NULL real number
      parameter  (iNULL__=(-2147483647-1))	! NULL int  number
      integer    idig			! testing NULL number

C=============================================================================
Cat. V/147          The SDSS Photometric Catalogue, Release 12          (Alam+, 2015)
*================================================================================
*The SDSS Photometric Catalogue, Data Release 12 (DR12)
*     Alam S. et al.
*    <Astrophys. J. Suppl. Ser. 219, 12 (2015)>
*    =2015ApJS..219...12A
*    =2016yCat.5147....0A
C=============================================================================

C  Internal variables

      integer*4 i__

c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

C  Declarations for 'sdss12.sam'	! *Sample output of the SDSS photometric catalog

      integer*4 nr__
      parameter (nr__=1000)	! Number of records
      character*1168 ar__   	! Full-size record

C  Position composed of: RAdeg DEdeg
      real*8        RAdeg       ! (deg) Right Ascension of the object (ICRS)
*                                   at Epoch="ObsDate" (ra)
      real*8        DEdeg       ! (deg) Declination of the object (ICRS)
*                                   at Epoch="ObsDate" (dec)
      integer*4     mode        ! [1/2] 1: primary  (469,053,874 sources),
*                                   2: secondary (324,960,094 sources)
      character*1   q_mode      ! [+] '+' indicates clean photometry
*                                   (310,190,812 sources with mode 1+) (clean)
      integer*4     class       ! Type of object (3=galaxy, 6=star) (1)
      character*19  SDSS12      ! SDSS-DR12 name, based on J2000 position
      character*1   m_SDSS12    ! [*] The asterisk indicates that 2 different
*                                   SDSS objects share the same SDSS12 name
      character*20  SDSS_ID     ! [0-9 -] SDSS object identifier (2)
      integer*8     objID       ! SDSS unique object identifier (2)
      character*15  Sp_ID       ! ? Spectroscopic Plate-MJD-Fiber identifier (7)
      integer*8     SpObjID     ! Pointer to the spectrum of object, or 0 (7)
      integer*8     parentID    ! Pointer to parent (if object deblended)
      integer*8     flags       ! Photo Object Attribute flags (3)
      integer*4     Status      ! Hexadecimal status (4)
      real*4        e_RAdeg     ! (arcsec) [0/51703] Mean error on RAdeg (raErr)
      real*4        e_DEdeg     ! (arcsec) [0/20301] Mean error on DEdeg (decErr)
      real*8        ObsDate     ! (yr) Mean Observation date (6)
      integer*4     Q           ! [1/3] Quality of the observation:
*                                  1=bad 2=acceptable 3=good
      real*4        umag        ! (mag) [4/38]? Model magnitude in u filter, AB scale
*                                   (u) (5)
      real*4        e_umag      ! (mag) ? Mean error on umag (err_u)
      real*4        gmag        ! (mag) [5/40]? Model magnitude in g filter, AB scale
*                                   (g) (5)
      real*4        e_gmag      ! (mag) ? Mean error on gmag (err_g)
      real*4        rmag        ! (mag) [4/39]? Model magnitude in r filter, AB scale
*                                   (r) (5)
      real*4        e_rmag      ! (mag) ? Mean error on rmag (err_r)
      real*4        imag        ! (mag) [3/40]? Model magnitude in i filter, AB scale
*                                   (i) (5)
      real*4        e_imag      ! (mag) ? Mean error on imag (err_i)
      real*4        zmag        ! (mag) [3/38]? Model magnitude in z filter, AB scale
*                                   (z) (5)
      real*4        e_zmag      ! (mag) ? Mean error on zmag (err_z)
*--------------------------------------------------------------------------------
      real*8        zsp         ! [-0.02/7.1]? Spectroscopic redshift
*                                   (when SpObjID>0) (7)
      real*8        e_zsp       ! ? Mean error on zsp (negative for bad fit) (7)
      integer*4     f_zsp       ! [0/196]? "zwarning" flag (9)
      real*8        Vdisp       ! (km/s) [0/850]? Velocity dispersion (velDisp)
      real*4        e_Vdisp     ! (km/s) ? Mean error on Vdisp (velDispErr)
      character*4   spInst      ! ? Spectral instrument used (SDSS or BOSS)
*                                    (instrument)
      character*19  spType      ! ? Source type (sourceType) (10)
      character*6   spCl        ! ? Spectroscopic class: GALAXY, QSO,
*                                    STAR
      character*21  subCl       ! ? Spectroscopic subclass (subClass) (11)
      real*4        spS_N       ! [0/132]? Median signal-to-noise over all good
*                                    pixels (snMedian)
*--------------------------------------------------------------------------------
      integer*8     uFlags      ! Detection flags, u band (flags_u) (3)
      integer*4     us          ! 0=notStar, 1=Star in u band (probPSF_u)
      integer*4     uc          ! [0/6] Phototype in u band, 6=Star (type_u) (1)
      real*8        uDate       ! (yr) Date of observation in u band (6)
      real*4        u_mag       ! (mag) [4/38]? Model magnitude in u' filter (= umag)
*                                    (5)
      real*4        e_u_mag     ! (mag) ? Mean error on u'mag (= e_umag)
      real*4        upmag       ! (mag) [5/34]? PSF magnitude in u band (psfMag_u)
      real*4        e_upmag     ! (mag) ? Mean error on upmag (psfMagErr_u)
      real*4        uPmag_1     ! (mag) [3/43]? Petrosian magnitude in u band
*                                    (petroMag_u)
      real*4        e_uPmag_1   ! (mag) ? Mean error on  uPmag (petroMagErr_u)
      real*8        uPrad       ! (arcsec) [0/260]? Petrosian radius in u band
*                                    (petroRad_u)
      real*8        e_uPrad     ! (arcsec) ?=-1000 Mean error in uPrad (petroRadErr_u)
      real*4        uoRA        ! (arcsec) ? Offset of u position along RA (offsetRa_u)
      real*4        uoDE        ! (arcsec) ? Offset of u position along Dec
*                                     (offsetDec_u)
      real*8        udVrad      ! (arcsec) ? de Vaucouleurs fit radius, u band
*                                     (deVRad_u)
      real*8        udVell      ! (arcsec) ? de Vaucouleurs fit ellipt, u band
*                                     (1-deVAB_u)
      real*4        uPA         ! (deg) ? Position angle of dVrad in u band
*                                     (deVPhi_u)
*--------------------------------------------------------------------------------
      integer*8     gFlags      ! Detection flags, g band (flags_g) (3)
      integer*4     gs          ! 0=notStar, 1=Star in g band (probPSF_g)
      integer*4     gc          ! Phototype in g band, 6=Star (type_g) (1)
      real*8        gDate       ! (yr) Date of observation in g band (6)
      real*4        g_mag       ! (mag) [5/39]? Model magnitude in g' filter (= gmag)
*                                     (5)
      real*4        e_g_mag     ! (mag) ? Mean error on g'mag (= e_gmag)
      real*4        gpmag       ! (mag) [5/37]? PSF magnitude in g band (psfMag_g)
      real*4        e_gpmag     ! (mag) ? Mean error on gpmag (psfMagErr_g)
      real*4        gPmag_1     ! (mag) [4/46]? Petrosian magnitude in g band
*                                     (petroMag_g)
      real*4        e_gPmag_1   ! (mag) ? Mean error on  gPmag (petroMagErr_g)
      real*8        gPrad       ! (arcsec) ? Petrosian radius in g band (petroRad_g)
      real*8        e_gPrad     ! (arcsec) ?=-1000 Mean error in gPrad (petroRadErr_g)
      real*4        goRA        ! (arcsec) ? Offset of g position along RA (offsetRa_g)
      real*4        goDE        ! (arcsec) ? Offset of g position along Dec
*                                      (offsetDec_g)
      real*8        gdVrad      ! (arcsec) ? de Vaucouleurs fit radius, g band
*                                      (deVRad_g)
      real*8        gdVell      ! (arcsec) ? de Vaucouleurs fit ellipt, g band
*                                      (1-deVAB_g)
      real*4        gPA         ! (deg) ? Position angle of dVrad in g band
*                                      (deVPhi_g)
*--------------------------------------------------------------------------------
      integer*8     rFlags      ! Detection flags, r band (flags_r) (3)
      integer*4     rs          ! 0=notStar, 1=Star in r band (probPSF_r)
      integer*4     rc          ! Phototype in r band, 6=Star (type_r) (1)
      real*8        rDate       ! (yr) Date of observation in r band (6)
      real*4        r_mag       ! (mag) [4/39]? Model magnitude in r' filter (= rmag)
*                                      (5)
      real*4        e_r_mag     ! (mag) ? Mean error on r'mag (= e_rmag)
      real*4        rpmag       ! (mag) [4/33]? PSF magnitude in r band (psfMag_r)
      real*4        e_rpmag     ! (mag) ? Mean error on rpmag (psfMagErr_r)
      real*4        rPmag_1     ! (mag) [4/43]? Petrosian magnitude in r band
*                                      (petroMag_r)
      real*4        e_rPmag_1   ! (mag) ? Mean error on  rPmag (petroMagErr_r)
      real*8        rPrad       ! (arcsec) ? Petrosian radius in r band (petroRad_r)
      real*8        e_rPrad     ! (arcsec) ?=-1000 Mean error in rPrad (petroRadErr_r)
      real*4        roRA        ! (arcsec) ? Offset of r position along RA (offsetRa_r)
      real*4        roDE        ! (arcsec) ? Offset of r position along Dec
*                                       (offsetDec_r)
      real*8        rdVrad      ! (arcsec) ? de Vaucouleurs fit radius, r band
*                                       (deVRad_r)
      real*8        rdVell      ! (arcsec) ? de Vaucouleurs fit ellipt, r band
*                                       (1-deVAB_r)
      real*4        rPA         ! (deg) ? Position angle of dVrad in r band
*                                       (deVPhi_r)
*--------------------------------------------------------------------------------
      integer*8     iFlags      ! Detection flags, i band (flags_i) (3)
      integer*4     is          ! 0=notStar, 1=Star in i band (probPSF_i)
      integer*4     ic          ! Phototype in i band, 6=Star (type_i) (1)
      real*8        iDate       ! (yr) Date of observation in i band (6)
      real*4        i_mag       ! (mag) [3/40]? Model magnitude in i' filter (= imag)
*                                       (5)
      real*4        e_i_mag     ! (mag) ? Mean error on i'mag (= e_imag)
      real*4        ipmag       ! (mag) [3/34]? PSF magnitude in i band (psfMag_i)
      real*4        e_ipmag     ! (mag) ? Mean error on ipmag (psfMagErr_i)
      real*4        iPmag_1     ! (mag) [3/45]? Petrosian magnitude in i band
*                                       (petroMag_i)
      real*4        e_iPmag_1   ! (mag) ? Mean error on  iPmag (petroMagErr_i)
      real*8        iPrad       ! (arcsec) ? Petrosian radius in i band (petroRad_i)
      real*8        e_iPrad     ! (arcsec) ?=-1000 Mean error in iPrad (petroRadErr_i)
      real*4        ioRA        ! (arcsec) ? Offset of i position along RA (offsetRa_i)
      real*4        ioDE        ! (arcsec) ? Offset of i position along Dec
*                                       (offsetDec_i)
      real*8        idVrad      ! (arcsec) ? de Vaucouleurs fit radius, i band
*                                       (deVRad_i)
      real*8        idVell      ! (arcsec) ? de Vaucouleurs fit ellipt, i band
*                                       (1-deVAB_i)
      real*4        iPA         ! (deg) ? Position angle of dVrad in i band
*                                       (deVPhi_i)
*--------------------------------------------------------------------------------
      integer*8     zFlags      ! Detection flags, z band (flags_z) (3)
      integer*4     zs          ! 0=notStar, 1=Star in z band (probPSF_z)
      integer*4     zc          ! Phototype in z band, 6=Star (type_z) (1)
      real*8        zDate       ! (yr) Date of observation in z band (6)
      real*4        z_mag       ! (mag) [3/38]? Model magnitude in z filter (= zmag)
*                                       (5)
      real*4        e_z_mag     ! (mag) ? Mean error on z'mag (= e_zmag)
      real*4        zpmag       ! (mag) [3/32]? PSF magnitude in z band (psfMag_z)
      real*4        e_zpmag     ! (mag) ? Mean error on zpmag (psfMagErr_z)
      real*4        zPmag_1     ! (mag) [3/42]? Petrosian magnitude in z band
*                                       (petroMag_z)
      real*4        e_zPmag_1   ! (mag) ? Mean error on  zPmag (petroMagErr_z)
      real*8        zPrad       ! (arcsec) ? Petrosian radius in z band (petroRad_z)
      real*8        e_zPrad     ! (arcsec) ?=-1000 Mean error in zPrad (petroRadErr_z)
      real*4        zoRA        ! (arcsec) ? Offset of z position along RA (offsetRa_z)
      real*4        zoDE        ! (arcsec) ? Offset of z position along Dec
*                                       (offsetDec_z)
      real*8        zdVrad      ! (arcsec) ? de Vaucouleurs fit radius, z band
*                                      (deVRad_z)
      real*8        zdVell      ! (arcsec) ? de Vaucouleurs fit ellipt, z band
*                                     (1-deVAB_z)
      real*4        zPA         ! (deg) ? Position angle of dVrad in z band
*                                   (deVPhi_z)
*--------------------------------------------------------------------------------
      real*8        pmRA        ! (mas/yr) [-6121/4129]? Proper motion along Right
*                                   Ascension (pmRa) (8)
      real*4        e_pmRA      ! (mas/yr) ? Mean error on pmRA (pmRaErr) (8)
      real*8        pmDE        ! (mas/yr) [-4846/4437]? Proper motion along Declination
*                                   (pmDec) (8)
      real*4        e_pmDE      ! (mas/yr) ? Mean error on pmDE (pmDecErr) (8)
      real*8        sigRA       ! (mas) [0/8662]? RMS residual of proper motion fit
*                                   in RA (8)
      real*4        sigDE       ! (mas) [0/10625]? RMS residual of proper motion fit
*                                   in Dec (8)
      integer*4     M           ! [1/4]?=-1 Number of USNO-B objects matched
*                                   within 1arcsec (match) (8)
      integer*4     N           ! [4/6]?=-1 Number of detections used in the pm
*                                   fit, including SDSS (nFit) (8)
      real*4        g_O         ! ? Magnitude from O plate recalibrated to g (8)
      real*4        r_E         ! ? Magnitude from E plate recalibrated to r (8)
      real*4        g_J         ! ? Magnitude from J plate recalibrated to g (8)
      real*4        r_F         ! ? Magnitude from F plate recalibrated to r (8)
      real*4        i_N         ! ? Magnitude from N plate recalibrated to i (8)
      real*8        zph         ! [-9999/]? Photometric redshift; estimated
*                                   by robust fit to nearest neighbors in
*                                   a reference set (12)
      real*8        e_zph       ! [-9999/]? Estimated error of the
*                                   photometric redshift (zErr) (12)
      real*4        v_zph_      ! [0.009/0.9]? average redshift of the nearest
*                                   neighbors; if significantly different from
*                                   zph this might be a better estimate than zph
*                                   (nnAvgZ)
      real*8        chi2        ! ? Chi-square value for the minimum
*                                   chi-square template fit (chisq_zph)
      real*8        u_Mag_1     ! (mag) [-644/4]? rest frame u' absolute magnitude
*                                   (absMagU)
      real*8        g_Mag_1     ! (mag) [-472/3]? rest frame g' absolute magnitude
*                                   (absMagG)
      real*8        r_Mag_1     ! (mag) [-351/3]? rest frame r' absolute magnitude
*                                   (absMagR)
      real*8        i_Mag_1     ! (mag) [-271/7]? rest frame i' absolute magnitude
*                                   (absMagI)
      real*8        z_Mag_1     ! (mag) [-199/3]? rest frame z' absolute magnitude
*                                   (absMagZ)
*Note (1): The type (class) is numbered as follows:
*      0 = Unknown: Object type is not known.
*      1 = Cosmic-ray track (not used).
*      2 = Defect (not used)
*      3 = Galaxy: An extended object composed of many stars and other matter
*          (208,478,448 with mode=1 occurrences)
*      4 = Ghost: Object created by reflected or refracted light. (not used)
*      5 = KnownObject: Object came from some other catalog (not yet used)
*      6 = Star: A a self-luminous gaseous celestial body
*          (260,562,744 with mode=1 occurrences)
*      7 = Trail: A satellite or asteroid or meteor trail. (not yet used)
*      8 = Sky: Blank sky spectrogram (no objects in this arcsecond area).
*      9 = NotAType (not used)
*Note (2): The SDSS identifier is composed of the 5 numbers run, rerun
*     (301), camcol (1-6), field (11-1001) and object (1-16000). The SDSS-ID
*     is written run-rerun-cam-field-obj (5 numbers and 4 dashes). The objID
*     is also combined from these numbers (the <<n operator represents the
*     left shift of n bits, i.e. a multiplication by 2^n):
*     objID = skyVersion<<59 + rerun<<48 + run<<32 + camcol<<29
*           + field<<16 + obj
*     (in the case of DR8-9, skyVersion=2 and rerun=301, i.e. objID is in the
*     range 1237645472596754432-1237926947573465087
*     (hexa 112d000000000000-112dffffffffffff).
*Note (3): flags written in hexadecimal, full description available at
*   http://skyserver.sdss.org/dr12/en/help/browser/browser.aspx#\
*   &&history=search+PhotoFlags
* ------------------------------------------------------------------------------
* 0000000000000001 = CANONICAL_CENTER   Measurements used the center in r*
* 0000000000000002 = BRIGHT             Object detected in bright object-finding
* 0000000000000004 = EDGE               Object is too close to edge of frame
* 0000000000000008 = BLENDED            Multiple peaks detected
* 0000000000000010 = CHILD              Product of deblending a BLENDED object.
* 0000000000000020 = PEAKCENTER         Position of peak pixel rather than ML
* 0000000000000040 = NODEBLEND          No deblending attempted on BLENDED object
* 0000000000000080 = NOPROFILE          Radial profile could not be estimated
* 0000000000000100 = NOPETRO            No valid Petrosian radius found
* 0000000000000200 = MANYPETRO          More than one Petrosian radius found.
* 0000000000000400 = NOPETRO_BIG        Petrosian radius beyond radial profile.
* 0000000000000800 = DEBLENDTOOMANY_PEAKS More than 25 peaks in this object
* 0000000000001000 = COSMIC_RAY         Contains a pixel part of a cosmic ray.
* 0000000000002000 = MANYR50            More than one 50% light radius.
* 0000000000004000 = MANYR90            More than one 90% light radius.
* 0000000000008000 = BAD_RADIAL         Some points in radial profile S/N<0
* 0000000000010000 = INCOMPLETE_PROFILE Petrosian radius intersects frame edge
* 0000000000020000 = INTERP             Pixel(s) determined by interpolation.
* 0000000000040000 = SATURATED          Saturated pixel(s)
* 0000000000080000 = NOTCHECKED         Not checked for local peaks
* 0000000000100000 = SUBTRACTED         BRIGHT object, wings subtracted
* 0000000000200000 = NOSTOKES           No measured Stokes params
* 0000000000400000 = BADSKY             Sky level so bad that highest pixel <0.
* 0000000000800000 = PETROFAINT         Petrosian radius(es) rejected for low SB
* 0000000001000000 = TOO_LARGE          Object too large to measure its profile
* 0000000002000000 = DEBLENDEDASPSF   Deblender treated obj as PSF
* 0000000004000000 = DEBLEND_PRUNED     At least one child was removed
* 0000000008000000 = ELLIPFAINT         Object center fainter than the isophote
* 0000000010000000 = BINNED1            Object detected in 1x1 binned image
* 0000000020000000 = BINNED2            Object detected in 2x2 binned image
* 0000000040000000 = BINNED4            Object detected in 4x4 binned image
* 0000000080000000 = MOVED              Possibly moving object
* 0000000100000000 = DEBLENDEDASMOVING A MOVED object treated as moving.
* 0000000200000000 = NODEBLEND_MOVING    A MOVED object not treated as moving.
* 0000000400000000 = TOOFEWDETECTIONS Too few detections to deblend as moving.
* 0000000800000000 = BADMOVINGFIT     Moving fit too poor to be believable.
* 0000001000000000 = STATIONARY         Object consistent with being stationary.
* 0000002000000000 = PEAKSTOOCLOSE    Some peaks merged into a single peak.
* 0000004000000000 = MEDIAN_CENTER      Center given is of median-smoothed image.
* 0000008000000000 = LOCAL_EDGE         Center too close to an edge.
* 0000010000000000 = BADCOUNTSERROR   Too few good pixels, error underestimated
* 0000020000000000 = BADMOVINGFIT_CHILD Moving child's velocity fit too poor
* 0000040000000000 = DEBLENDUNASSIGNEDFLUX  After deblending flux not assigned
* 0000080000000000 = SATUR_CENTER        Center is close to saturated pixel(s)
* 0000100000000000 = INTERP_CENTER       Center is close to interpolated pixel(s)
* 0000200000000000 = DEBLENDEDATEDGE   Object close to edge was deblended
* 0000400000000000 = DEBLEND_NOPEAK      No detected peak within this child
* 0000800000000000 = PSFFLUXINTERP     PSF flux from interpolated pixels > 20%
* 0001000000000000 = TOOFEWGOOD_DETECTIONS Too few good detections
* 0002000000000000 = CENTEROFFAIMAGE   At least one peak's center lay off image
* 0004000000000000 = DEBLEND_DEGENERATE  Identical candidate children, 1 retained
* 0008000000000000 = BRIGHTESTGALAXYCHILD Brightest member classified as galaxy
* 0010000000000000 = CANONICAL_BAND       Band chosen as 'Canonical', generally r
* 0020000000000000 = AMOMENT_FAINT        Object too faint to measure moments
* 0040000000000000 = AMOMENT_SHIFT        Centroid shift too large
* 0080000000000000 = AMOMENT_MAXITER      Maximum number of iterations exceeded
* 0100000000000000 = MAYBE_CR             Object could actually be a cosmic ray
* 0200000000000000 = MAYBE_EGHOST         Object could actually be a ghost
* 0400000000000000 = NOTCHECKED_CENTER    Object center in a region not searched
* 0800000000000000 = OBJECT2HASSATUR_DN Trails included in estimated flux.
* 1000000000000020 = OBJECT2DEBLENDPEEPHOLE Deblend modified by peephole
* 2000000000000020 = GROWN_MERGED         Growing led to a merger
* 4000000000000020 = HAS_CENTER           Object has a canonical center
* 8000000000000020 = RESERVED             Not used
* ------------------------------------------------------------------------------
*Note (4): status flags written in hexadecimal, full description available at
* http://skyserver.sdss3.org/dr9/en/help/browser/enum.asp?n=ResolveStatus
* Identical in http://skyserver.sdss.org/dr12/en/help/browser/browser.aspx#\
*              &&history=search+ResolveStatus
* ------------------------------------------------------------------------------
* 00000001 = RUN_PRIMARY      Object status set in reference to its own run
* 00000002 = RUN_RAMP         Object in what would be the overlap area of a field
* 00000004 = RUN_OVERLAPONLY  Object only appears in the overlap between 2 fields
* 00000008 = RUN_IGNORE       Bright or parent object that should be ignored
* 00000010 = RUN_EDGE         Object near lowest or highest column
* 00000020 = RUN_DUPLICATE    Duplicate measurements of same pixels in 2 fields
* 00000100 = SURVEY_PRIMARY   Primary observation within survey (mode=1)
* 00000200 = SURVEY_BEST      Best observation in full survey, but not primary.
* 00000400 = SURVEY_SECONDARY Repeat (independent) observation (mode=2)
* 00000800 = SURVEY_BADFIELD  In field with score=0
* 00001000 = SURVEY_EDGE      Not kept as secondary
* ------------------------------------------------------------------------------
*Note (5):
*     The response curves of the SDSS filters (u g r i z) can be found on
*     the SDSS pages: http://www.sdss.org/dr5/instruments/imager/index.html
*     The central wavelength and FWHM are:
*     -----------------------------------------------
*      (nm)      u'      g'      r'      i'      z'
*     -----------------------------------------------
*     lambda   354.3    477.0   623.1   762.5   913.4
*     FWHM      56.7    138.7   137.3   152.6    95.0
*     -----------------------------------------------
*     Note that the ugriz magnitudes are not exactly on the AB scale
*     for the u-band (uAB=umag-0.04) and z-band (zAB=zmag+0.02)
*     (http://www.sdss.org/DR7/algorithms/fluxcal.html)
*Note (6): column from the "Fields" table.
*     Dates of the observations for each colour, and their average.
*Note (7): column from the "SpecObjAll" table. The "SpObjID" is composed
*     of plate + mjd + fiber + run2d with formula (the <<n operator
*     represents the left shift of n bits, i.e. a multiplication by 2^n):
*     SpObjID = (plate<<50)+((mjd-50000)<<24)+(fiber<<38)+(run2d<<10)
*Note (8): column from the "ProperMotions" table.
*Note (9): the "zwarning" flag is a number made of the following bits:
*   1 (20) = sky fiber
*   2 (21) = too little wavelength coverage
*   4 (22) = chi-squared of best fit is too close to that of second best
*   8 (23) = synthetic spectrum is negative
*  16 (24) = fraction of points more than 5 sigma away from best model
*              is too large (>5%)
*  32 (25) = chi-squared minimum at edge of the redshift fitting range
*  64 (26) = a QSO line exhibits negative emission (triggered only in QSO
*              spectra if CIV, CIII, MgII, Hbeta, or Halpha has
*              lineArea+3*(lineArea)<0)
* 128 (27) = the fiber was unplugged, so no spectrum obtained
*  See http://skyserver.sdss.org/dr12/en/help/browser/browser.aspx#\
*      &&history=search+SpeczWarning
*Note (10): the spectroscopic Source types are summarized in the
*      "type9.htx" file; see also the SDSS DR12 help:
*      http://skyserver.sdss.org/dr12/en/help/browser/browser.aspx#\
*      &history=enum+AncillaryTarget1+E
*Note (11): the spectroscopic subclass includes:
*   * for GALAXY classes: BROADLINE, STARFORMING, STARBURST, AGN
*   * for STAR classes: MK spectral sub-classes, CV=Catataclysmic Variable,
*     Carbon stars (Carbon, Carbon_lines), white dwarfs (WD, WDcooler,
*     WDhotter, WDmagnetic, CarbonWD, CalciumWD)
*Note (12): If zErr=-9999, the fit failed, but the neighbors' average redshift
*           might still be available.

C=============================================================================

C  Loading file 'sdss12.sam'	! *Sample output of the SDSS photometric catalog

C  Format for file interpretation

    1 format(
     +  F10.6,1X,F10.6,1X,I1,1X,A1,1X,I1,1X,A19,1X,A1,1X,A20,1X,I19,
     +  1X,A15,1X,I19,1X,I19,1X,I19,1X,I4,1X,F5.3,1X,F5.3,1X,F9.4,1X,
     +  I1,1X,F6.3,1X,F5.3,1X,F6.3,1X,F5.3,1X,F6.3,1X,F5.3,1X,F6.3,1X,
     +  F5.3,1X,F6.3,1X,F5.3,1X,F8.5,1X,F7.5,1X,I3,1X,F10.6,1X,F6.3,
     +  1X,A4,1X,A19,1X,A6,1X,A21,1X,F6.2,1X,I19,1X,I1,1X,I1,1X,F9.4,
     +  1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,F7.3,1X,
     +  F9.3,1X,F6.2,1X,F6.2,1X,F7.3,1X,F7.3,1X,F5.1,1X,I19,1X,I1,1X,
     +  I1,1X,F9.4,1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,
     +  F7.3,1X,F9.3,1X,F6.2,1X,F6.2,1X,F7.3,1X,F7.3,1X,F5.1,1X,I19,
     +  1X,I1,1X,I1,1X,F9.4,1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,
     +  1X,F6.3,1X,F7.3,1X,F9.3,1X,F6.2,1X,F6.2,1X,F7.3,1X,F7.3,1X,
     +  F5.1,1X,I19,1X,I1,1X,I1,1X,F9.4,1X,F6.3,1X,F6.3,1X,F6.3,1X,
     +  F6.3,1X,F6.3,1X,F6.3,1X,F7.3,1X,F9.3,1X,F6.2,1X,F6.2,1X,F7.3,
     +  1X,F7.3,1X,F5.1,1X,I19,1X,I1,1X,I1,1X,F9.4,1X,F6.3,1X,F6.3,1X,
     +  F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,F7.3,1X,F9.3,1X,F6.2,1X,F6.2,
     +  1X,F7.3,1X,F7.3,1X,F5.1,1X,F7.1,1X,F6.1,1X,F7.1,1X,F6.1,1X,
     +  F7.2,1X,F6.2,1X,I2,1X,I2,1X,F4.1,1X,F4.1,1X,F4.1,1X,F4.1,1X,
     +  F4.1,1X,F10.4,1X,F10.4,1X,F6.4,1X,F7.3,1X,F8.3,1X,F8.3,1X,
     +  F8.3,1X,F8.3,1X,F8.3)

C  Effective file loading

      open(unit=1,status='old',file=
     +'sdss12.sam')
      write(6,*) '....Loading file: sdss12.sam'
      do i__=1,1000
        read(1,'(A1168)')ar__
        read(ar__,1)
     +  RAdeg,DEdeg,mode,q_mode,class,SDSS12,m_SDSS12,SDSS_ID,objID,
     +  Sp_ID,SpObjID,parentID,flags,Status,e_RAdeg,e_DEdeg,ObsDate,Q,
     +  umag,e_umag,gmag,e_gmag,rmag,e_rmag,imag,e_imag,zmag,e_zmag,
     +  zsp,e_zsp,f_zsp,Vdisp,e_Vdisp,spInst,spType,spCl,subCl,spS_N,
     +  uFlags,us,uc,uDate,u_mag,e_u_mag,upmag,e_upmag,uPmag_1,
     +  e_uPmag_1,uPrad,e_uPrad,uoRA,uoDE,udVrad,udVell,uPA,gFlags,gs,
     +  gc,gDate,g_mag,e_g_mag,gpmag,e_gpmag,gPmag_1,e_gPmag_1,gPrad,
     +  e_gPrad,goRA,goDE,gdVrad,gdVell,gPA,rFlags,rs,rc,rDate,r_mag,
     +  e_r_mag,rpmag,e_rpmag,rPmag_1,e_rPmag_1,rPrad,e_rPrad,roRA,
     +  roDE,rdVrad,rdVell,rPA,iFlags,is,ic,iDate,i_mag,e_i_mag,ipmag,
     +  e_ipmag,iPmag_1,e_iPmag_1,iPrad,e_iPrad,ioRA,ioDE,idVrad,
     +  idVell,iPA,zFlags,zs,zc,zDate,z_mag,e_z_mag,zpmag,e_zpmag,
     +  zPmag_1,e_zPmag_1,zPrad,e_zPrad,zoRA,zoDE,zdVrad,zdVell,zPA,
     +  pmRA,e_pmRA,pmDE,e_pmDE,sigRA,sigDE,M,N,g_O,r_E,g_J,r_F,i_N,
     +  zph,e_zph,v_zph_,chi2,u_Mag_1,g_Mag_1,r_Mag_1,i_Mag_1,z_Mag_1
        if(ar__(197:202) .EQ. '') umag = rNULL__
        if(ar__(204:208) .EQ. '') e_umag = rNULL__
        if(ar__(210:215) .EQ. '') gmag = rNULL__
        if(ar__(217:221) .EQ. '') e_gmag = rNULL__
        if(ar__(223:228) .EQ. '') rmag = rNULL__
        if(ar__(230:234) .EQ. '') e_rmag = rNULL__
        if(ar__(236:241) .EQ. '') imag = rNULL__
        if(ar__(243:247) .EQ. '') e_imag = rNULL__
        if(ar__(249:254) .EQ. '') zmag = rNULL__
        if(ar__(256:260) .EQ. '') e_zmag = rNULL__
        if(ar__(262:269) .EQ. '') zsp = rNULL__
        if(ar__(271:277) .EQ. '') e_zsp = rNULL__
        if(ar__(279:281) .EQ. '') f_zsp = iNULL__
        if(ar__(283:292) .EQ. '') Vdisp = rNULL__
        if(ar__(294:299) .EQ. '') e_Vdisp = rNULL__
        if(ar__(355:360) .EQ. '') spS_N = rNULL__
        if(ar__(396:401) .EQ. '') u_mag = rNULL__
        if(ar__(403:408) .EQ. '') e_u_mag = rNULL__
        if(ar__(410:415) .EQ. '') upmag = rNULL__
        if(ar__(417:422) .EQ. '') e_upmag = rNULL__
        if(ar__(424:429) .EQ. '') uPmag_1 = rNULL__
        if(ar__(431:436) .EQ. '') e_uPmag_1 = rNULL__
        if(ar__(438:444) .EQ. '') uPrad = rNULL__
        if(ar__(456:461) .EQ. '') uoRA = rNULL__
        if(ar__(463:468) .EQ. '') uoDE = rNULL__
        if(ar__(470:476) .EQ. '') udVrad = rNULL__
        if(ar__(478:484) .EQ. '') udVell = rNULL__
        if(ar__(486:490) .EQ. '') uPA = rNULL__
        if(ar__(526:531) .EQ. '') g_mag = rNULL__
        if(ar__(533:538) .EQ. '') e_g_mag = rNULL__
        if(ar__(540:545) .EQ. '') gpmag = rNULL__
        if(ar__(547:552) .EQ. '') e_gpmag = rNULL__
        if(ar__(554:559) .EQ. '') gPmag_1 = rNULL__
        if(ar__(561:566) .EQ. '') e_gPmag_1 = rNULL__
        if(ar__(568:574) .EQ. '') gPrad = rNULL__
        if(ar__(586:591) .EQ. '') goRA = rNULL__
        if(ar__(593:598) .EQ. '') goDE = rNULL__
        if(ar__(600:606) .EQ. '') gdVrad = rNULL__
        if(ar__(608:614) .EQ. '') gdVell = rNULL__
        if(ar__(616:620) .EQ. '') gPA = rNULL__
        if(ar__(656:661) .EQ. '') r_mag = rNULL__
        if(ar__(663:668) .EQ. '') e_r_mag = rNULL__
        if(ar__(670:675) .EQ. '') rpmag = rNULL__
        if(ar__(677:682) .EQ. '') e_rpmag = rNULL__
        if(ar__(684:689) .EQ. '') rPmag_1 = rNULL__
        if(ar__(691:696) .EQ. '') e_rPmag_1 = rNULL__
        if(ar__(698:704) .EQ. '') rPrad = rNULL__
        if(ar__(716:721) .EQ. '') roRA = rNULL__
        if(ar__(723:728) .EQ. '') roDE = rNULL__
        if(ar__(730:736) .EQ. '') rdVrad = rNULL__
        if(ar__(738:744) .EQ. '') rdVell = rNULL__
        if(ar__(746:750) .EQ. '') rPA = rNULL__
        if(ar__(786:791) .EQ. '') i_mag = rNULL__
        if(ar__(793:798) .EQ. '') e_i_mag = rNULL__
        if(ar__(800:805) .EQ. '') ipmag = rNULL__
        if(ar__(807:812) .EQ. '') e_ipmag = rNULL__
        if(ar__(814:819) .EQ. '') iPmag_1 = rNULL__
        if(ar__(821:826) .EQ. '') e_iPmag_1 = rNULL__
        if(ar__(828:834) .EQ. '') iPrad = rNULL__
        if(ar__(846:851) .EQ. '') ioRA = rNULL__
        if(ar__(853:858) .EQ. '') ioDE = rNULL__
        if(ar__(860:866) .EQ. '') idVrad = rNULL__
        if(ar__(868:874) .EQ. '') idVell = rNULL__
        if(ar__(876:880) .EQ. '') iPA = rNULL__
        if(ar__(916:921) .EQ. '') z_mag = rNULL__
        if(ar__(923:928) .EQ. '') e_z_mag = rNULL__
        if(ar__(930:935) .EQ. '') zpmag = rNULL__
        if(ar__(937:942) .EQ. '') e_zpmag = rNULL__
        if(ar__(944:949) .EQ. '') zPmag_1 = rNULL__
        if(ar__(951:956) .EQ. '') e_zPmag_1 = rNULL__
        if(ar__(958:964) .EQ. '') zPrad = rNULL__
        if(ar__(976:981) .EQ. '') zoRA = rNULL__
        if(ar__(983:988) .EQ. '') zoDE = rNULL__
        if(ar__(990:996) .EQ. '') zdVrad = rNULL__
        if(ar__(998:1004) .EQ. '') zdVell = rNULL__
        if(ar__(1006:1010) .EQ. '') zPA = rNULL__
        if(ar__(1012:1018) .EQ. '') pmRA = rNULL__
        if(ar__(1020:1025) .EQ. '') e_pmRA = rNULL__
        if(ar__(1027:1033) .EQ. '') pmDE = rNULL__
        if(ar__(1035:1040) .EQ. '') e_pmDE = rNULL__
        if(ar__(1042:1048) .EQ. '') sigRA = rNULL__
        if(ar__(1050:1055) .EQ. '') sigDE = rNULL__
        if(ar__(1063:1066) .EQ. '') g_O = rNULL__
        if(ar__(1068:1071) .EQ. '') r_E = rNULL__
        if(ar__(1073:1076) .EQ. '') g_J = rNULL__
        if(ar__(1078:1081) .EQ. '') r_F = rNULL__
        if(ar__(1083:1086) .EQ. '') i_N = rNULL__
        if(ar__(1088:1097) .EQ. '') zph = rNULL__
        if(ar__(1099:1108) .EQ. '') e_zph = rNULL__
        if(ar__(1110:1115) .EQ. '') v_zph_ = rNULL__
        if(ar__(1117:1123) .EQ. '') chi2 = rNULL__
        if(ar__(1125:1132) .EQ. '') u_Mag_1 = rNULL__
        if(ar__(1134:1141) .EQ. '') g_Mag_1 = rNULL__
        if(ar__(1143:1150) .EQ. '') r_Mag_1 = rNULL__
        if(ar__(1152:1159) .EQ. '') i_Mag_1 = rNULL__
        if(ar__(1161:1168) .EQ. '') z_Mag_1 = rNULL__
c    ..............Just test output...........
        write(6,1)
     +  RAdeg,DEdeg,mode,q_mode,class,SDSS12,m_SDSS12,SDSS_ID,objID,
     +  Sp_ID,SpObjID,parentID,flags,Status,e_RAdeg,e_DEdeg,ObsDate,Q,
     +  umag,e_umag,gmag,e_gmag,rmag,e_rmag,imag,e_imag,zmag,e_zmag,
     +  zsp,e_zsp,f_zsp,Vdisp,e_Vdisp,spInst,spType,spCl,subCl,spS_N,
     +  uFlags,us,uc,uDate,u_mag,e_u_mag,upmag,e_upmag,uPmag_1,
     +  e_uPmag_1,uPrad,e_uPrad,uoRA,uoDE,udVrad,udVell,uPA,gFlags,gs,
     +  gc,gDate,g_mag,e_g_mag,gpmag,e_gpmag,gPmag_1,e_gPmag_1,gPrad,
     +  e_gPrad,goRA,goDE,gdVrad,gdVell,gPA,rFlags,rs,rc,rDate,r_mag,
     +  e_r_mag,rpmag,e_rpmag,rPmag_1,e_rPmag_1,rPrad,e_rPrad,roRA,
     +  roDE,rdVrad,rdVell,rPA,iFlags,is,ic,iDate,i_mag,e_i_mag,ipmag,
     +  e_ipmag,iPmag_1,e_iPmag_1,iPrad,e_iPrad,ioRA,ioDE,idVrad,
     +  idVell,iPA,zFlags,zs,zc,zDate,z_mag,e_z_mag,zpmag,e_zpmag,
     +  zPmag_1,e_zPmag_1,zPrad,e_zPrad,zoRA,zoDE,zdVrad,zdVell,zPA,
     +  pmRA,e_pmRA,pmDE,e_pmDE,sigRA,sigDE,M,N,g_O,r_E,g_J,r_F,i_N,
     +  zph,e_zph,v_zph_,chi2,u_Mag_1,g_Mag_1,r_Mag_1,i_Mag_1,z_Mag_1
c    .......End.of.Just test output...........
      end do
      close(1)

C=============================================================================
      stop
      end