/* ************************************************************************** */
/* DBG103CL: Copy subset of files records */
/* 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 PARM(&FILE &LIBRARY &CPYRCDS)
DCL VAR(&NBRCURRCD) TYPE(*DEC) LEN(10 0)
DCL VAR(&NBRRCDS) TYPE(*DEC) LEN(10 0)
DCL VAR(&CPYRCDS) TYPE(*DEC) LEN(10 0)
DCL VAR(&LOOPCOUNT) TYPE(*DEC) LEN(3 0)
DCL VAR(&OFFSET) TYPE(*DEC) LEN(10 0) VALUE(1)
DCL VAR(&BLOCKSIZE) TYPE(*DEC) LEN(10 0)
DCL VAR(&FILE) TYPE(*CHAR) LEN(10)
DCL VAR(&LIBRARY) TYPE(*CHAR) LEN(10)
/* ************************************************************************** */
/* START OF MAINLINE CODE */
/* ************************************************************************** */
MONMSG MSGID(CPF0000)
RTVMBRD FILE(&FILE) NBRCURRCD(&NBRCURRCD)
CHGVAR VAR(&NBRRCDS) VALUE(&CPYRCDS / 10)
CHGVAR VAR(&BLOCKSIZE) VALUE(&NBRCURRCD / 10)
CLRPFM FILE(&LIBRARY/&FILE)
TOPOFLOOP:
CHGVAR VAR(&LOOPCOUNT) VALUE(&LOOPCOUNT + 1)
IF COND(&LOOPCOUNT *GT 10) THEN(GOTO +
CMDLBL(ENDLOOP))
CPYF FROMFILE(&FILE) TOFILE(&LIBRARY/&FILE) +
MBROPT(*ADD) FROMRCD(&OFFSET) +
NBRRCDS(&NBRRCDS)
MONMSG MSGID(CPF0000)
CHGVAR VAR(&OFFSET) VALUE(&OFFSET + &BLOCKSIZE)
GOTO CMDLBL(TOPOFLOOP)
ENDLOOP:
RETURN
ENDPGM
--
MartinRowe - 24 Jun 2005