C...A simple skeleton program, illustrating a typical Pythia run:
C...W+W- pair production at LEP 2.

C-----------------------------------------------------------------

C...Preamble: declarations.
 
C...All real arithmetic in double precision.
      IMPLICIT DOUBLE PRECISION(A-H, O-Z)
C...Three Pythia functions return integers, so need declaring.
      INTEGER PYK,PYCHGE,PYCOMP
C...Parameter statement to help give large particle numbers
C...(left- and righthanded SUSY, excited fermions).
      PARAMETER (KSUSY1=1000000,KSUSY2=2000000,KEXCIT=4000000)

C...EXTERNAL statement links PYDATA on most machines.
      EXTERNAL PYDATA

C...Commonblocks.
C...The event record.
      COMMON/PYJETS/N,NPAD,K(4000,5),P(4000,5),V(4000,5)
C...Parameters.
      COMMON/PYDAT1/MSTU(200),PARU(200),MSTJ(200),PARJ(200)
C...Particle properties + some flavour parameters.
      COMMON/PYDAT2/KCHG(500,4),PMAS(500,4),PARF(2000),VCKM(4,4)
C...Decay information.
      COMMON/PYDAT3/MDCY(500,3),MDME(4000,2),BRAT(4000),KFDP(4000,5)
C...Selection of hard scattering subprocesses.
      COMMON/PYSUBS/MSEL,MSELPD,MSUB(500),KFIN(2,-40:40),CKIN(200)
C...Parameters. 
      COMMON/PYPARS/MSTP(200),PARP(200),MSTI(200),PARI(200)
C...Supersymmetry parameters.
      COMMON/PYMSSM/IMSS(0:99),RMSS(0:99)

C-----------------------------------------------------------------

C...First section: initialization.
 
C...Main parameters of run: c.m. energy and number of events.
      ECM=180D0
      NEV=1000

C...Select W pair production process.
      MSEL=0
      MSUB(25)=1

C...Initialize.
      CALL PYINIT('CMS','e+','e-',ECM)

C...Book histograms.
      CALL PYBOOK(1,'W mass',100,0D0,100D0)
      CALL PYBOOK(2,'charged multiplicity',100,-0.5D0,99.5D0)

C-----------------------------------------------------------------

C...Second section: event loop.
 
C...Begin event loop.
      DO 200 IEV=1,NEV
        CALL PYEVNT

C...List first few events.
        IF(IEV.LE.5) CALL PYLIST(1)

C...Extract and fill event properties.
        CALL PYFILL(1,P(7,5),1D0)
        CALL PYFILL(1,P(8,5),1D0)
        CALL PYEDIT(3)
        CALL PYFILL(2,DBLE(N),1D0)

C...End event loop.
  200 CONTINUE

C-----------------------------------------------------------------

C...Third section: produce output and end.

C...Cross section table.
      CALL PYSTAT(1)

C...Histograms.
      CALL PYHIST

      END
