/* ************************************************************************** */
/* SRCPARSER: Parse source members from single member                         */
/* Copyright (C) 2000  Martin Rowe  <martin@dbg400.net>                       */
/*                                                                            */
/* This program is free software; you can redistribute it and/or modify       */
/* it under the terms of the GNU General Public License as published by       */
/* the Free Software Foundation; either version 2 of the License, or          */
/* (at your option) any later version.                                        */
/*                                                                            */
/* This program is distributed in the hope that it will be useful,            */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of             */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              */
/* GNU General Public License for more details.                               */
/*                                                                            */
/* You should have received a copy of the GNU General Public License          */
/* along with this program; if not, write to the Free Software                */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307   USA */
/* ************************************************************************** */
PGM
  DCL        VAR(&LINECOUNT) TYPE(*DEC)  LEN(6 0)
  DCL        VAR(&FROMRCD)   TYPE(*DEC)  LEN(6 0) VALUE(1)
  DCL        VAR(&TORCD)     TYPE(*DEC)  LEN(6 0)
  DCL        VAR(&MEMBER)    TYPE(*CHAR) LEN(10)
  DCL        VAR(&TYPE)      TYPE(*CHAR) LEN(10)
  DCL        VAR(&TEXT)      TYPE(*CHAR) LEN(50)
  DCL        VAR(&SRCLIB)    TYPE(*CHAR) LEN(10)  VALUE('DBG400')
  DCL        VAR(&SRCFILE)   TYPE(*CHAR) LEN(10)
  DCLF       FILE(DBGSRCFILE) RCDFMT(DBGSRCFILE)
/* ************************************************************************** */
/* MAINLINE:                                                                  */
/* ************************************************************************** */
  CHKOBJ     OBJ(&SRCLIB/QCLSRC) OBJTYPE(*FILE)
  MONMSG     MSGID(CPF9801) EXEC(CRTSRCPF +
               FILE(&SRCLIB/QCLSRC))
  CHKOBJ     OBJ(&SRCLIB/QCMDSRC) OBJTYPE(*FILE)
  MONMSG     MSGID(CPF9801) EXEC(CRTSRCPF +
               FILE(&SRCLIB/QCMDSRC))
  CHKOBJ     OBJ(&SRCLIB/QDDSSRC) OBJTYPE(*FILE)
  MONMSG     MSGID(CPF9801) EXEC(CRTSRCPF +
               FILE(&SRCLIB/QDDSSRC))
  CHKOBJ     OBJ(&SRCLIB/QRPGSRC) OBJTYPE(*FILE)
  MONMSG     MSGID(CPF9801) EXEC(CRTSRCPF +
               FILE(&SRCLIB/QRPGSRC))
  CHKOBJ     OBJ(&SRCLIB/QTXTSRC) OBJTYPE(*FILE)
  MONMSG     MSGID(CPF9801) EXEC(CRTSRCPF +
               FILE(&SRCLIB/QTXTSRC))
  CHKOBJ     OBJ(&SRCLIB/QPNLSRC) OBJTYPE(*FILE)
  MONMSG     MSGID(CPF9801) EXEC(CRTSRCPF +
               FILE(&SRCLIB/QPNLSRC))
  CHKOBJ     OBJ(&SRCLIB/QQMQRYSRC) OBJTYPE(*FILE)
  MONMSG     MSGID(CPF9801) EXEC(CRTSRCPF +
               FILE(&SRCLIB/QQMQRYSRC))
  CHKOBJ     OBJ(&SRCLIB/QRPGLESRC) OBJTYPE(*FILE)
  MONMSG     MSGID(CPF9801) EXEC(CRTSRCPF +
               FILE(&SRCLIB/QRPGLESRC) RCDLEN(112))
  OVRDBF     FILE(DBGSRCFILE) TOFILE(&SRCLIB/DBGSRCFILE) +
               MBR(ALLSRCMBRS)
/* Process all the records in the ALLDBGMBRS member                           */
TOPOFLOOP:
  RCVF       RCDFMT(DBGSRCFILE)
  MONMSG     MSGID(CPF0000) EXEC(GOTO CMDLBL(ENDPGM))
  CHGVAR     VAR(&LINECOUNT) VALUE(&LINECOUNT + 1)
/* Check if we've reached the end of the member yet                           */
  IF         COND(%SST(&SRCDTA 1 10) = '::PARSER::') +
               THEN(DO)
/* Set the end of the previous member                                         */
    CHGVAR     VAR(&TORCD) VALUE(&LINECOUNT - 1)
/* Extract the member details                                                 */
    CHGVAR     VAR(&MEMBER) VALUE(%SST(&SRCDTA 11 10))
    CHGVAR     VAR(&TYPE) VALUE(%SST(&SRCDTA 21 10))
    CHGVAR     VAR(&SRCFILE) VALUE(%SST(&SRCDTA 31 10))
    CHGVAR     VAR(&TEXT) VALUE(%SST(&SRCDTA 41 50))
/* Create a matching member in the appropriate source file                    */
    CHKOBJ     OBJ(&SRCLIB/&SRCFILE) OBJTYPE(*FILE) +
                 MBR(&MEMBER)
    MONMSG     MSGID(CPF9815) EXEC(ADDPFM +
                 FILE(&SRCLIB/&SRCFILE) MBR(&MEMBER) +
                 TEXT(&TEXT))
    CHGPFM     FILE(&SRCLIB/&SRCFILE) MBR(&MEMBER) +
                 SRCTYPE(&TYPE) TEXT(&TEXT)
/* Add in the records from the subsection just processed                      */
    CPYF       FROMFILE(&SRCLIB/DBGSRCFILE) +
                 TOFILE(&SRCLIB/&SRCFILE) +
                 FROMMBR(ALLSRCMBRS) TOMBR(&MEMBER) +
                 MBROPT(*REPLACE) FROMRCD(&FROMRCD) +
                 TORCD(&TORCD) FMTOPT(*MAP) SRCOPT(*SEQNBR +
                 *DATE)
/* Set the start point for the next section                                   */
    CHGVAR     VAR(&FROMRCD) VALUE(&LINECOUNT + 1)
  ENDDO
  GOTO       CMDLBL(TOPOFLOOP)
ENDPGM:
  RETURN
ENDPGM

-- MartinRowe - 24 Jun 2005
Topic revision: r1 - 24 Jun 2005 - 05:34:58 - MartinRowe
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding DBG/400? Send feedback