/*START OF SPECIFICATIONS****************************** REXX */ /* */ /* MEMBER-NAME = RECREMOV */ /* */ /* DESCRIPTIVE-NAME = Leading and trailing record removal */ /* */ /* COPYRIGHT= */ /* */ /* Contains restricted materials of Phoenix Software */ /* International. Copyright ¸ 1979-2025 by Phoenix */ /* Software International. Licensed materials property */ /* of Phoenix Software International. */ /* */ /* FUNCTION = */ /* */ /* This REXX is used to remove reading and trailing */ /* records from the file pass via the INPUT DD and */ /* writes the remaining records to the OUTPUT DD. */ /* */ /* PARAMETERS = */ /* */ /* Two parameters are passed. */ /* */ /* 1. The number of leading records to be removed */ /* */ /* 2. The number of trailing records to be removed */ /* */ /* Both parameters are required and can be zero. */ /* */ /* DD STATEMENTS = */ /* */ /* INPUT = this input DD contains the file with the */ /* record that need to be removed. */ /* */ /* CAMSERV = this output DD contains all of the records */ /* from INPUT with the exception of those that */ /* are removed. */ /* */ /* OPERATION = */ /* */ /* (1) The leading records are read into the stack and */ /* discarded. */ /* (2) The remainder of the file is read into a stem */ /* variable. All records are written to the output */ /* DD except for the specirfied number of trailing */ /* records. */ /* */ /* */ /*END OF SPECIFICATIONS***************************************/ RECREMOV: parse arg leading trailing if DATATYPE(leading) <> "NUM" then do say "**Error** Bad value supplied for leading record count" exit 12 end if DATATYPE(trailing) <> "NUM" then do say "**Error** Bad value supplied for trailing record count" exit 12 end "EXECIO 0 DISKR INPUT (OPEN" eof = 0 input.0 = 0 do i = 1 to leading "EXECIO 1 DISKR INPUT" if RC > 0 then do eof = 1 leave end end DELSTACK if eof = 0 then "EXECIO * DISKR INPUT (STEM input. FINIS" count = input.0 - trailing if count > 0 then "EXECIO" count "DISKW OUTPUT (OPEN STEM input." "EXECIO 0 DISKR INPUT (FINIS" "EXECIO 0 DISKW OUTPUT (FINIS" exit 0