How can I control the minimum number of lines (rows) that should be kept together when a page break is necessary?
You can start wit experimenting with the following code
\newcount\jcodenum
\def\jcode[#1]#2[#3]#4\endjcode{\par
\hrule\medskip\hbox to\hsize{\bf #1}\medskip\hrule\medskip
{\jcodenum=0
\def\jkoitem[##1]##2{\advance\jcodenum by1 }#4
\interlinepenalty=10000 \let\jkoitem=\jkoitemx #4
\medskip\hrule\nobreak\medskip #3\par}
}
\def\jkoitemx[#1,#2,#3]#4{\par \noindent{\bf#1}, \ignorespaces#2\hfill #3\par\nobreak
#4\par
\advance\jcodenum by-1 \ifnum\jcodenum<2 \nobreak \fi
}
\jcode[HL7-Path, Name \hfill R/O, Rep\#]
[{\bf R/0} = Required/Optional, {\bf R} = Required,
{\bf O} = Optional, {\bf RO} = Required if known,
{\bf REP\#} = Repitition, {\bf Y} = entry can be taken from the list,
{\bf N} = Individual Values, {\bf Number} = Maximum length of the list]
\jkoitem[MSH-6-2,homeCommunityID,R]
{OID of the affinity domain where the document will be stored.}
\jkoitem[MSH-19,languageCode,R]
{Specifies the human language of the document. Format according RFC-3066.}
\jkoitem[PID-3,patientInfo.socialSecurityNumber,R]
{Social security number of the patient. Important: The social security
number will be
identified within the list of patient
identifiers (PID-3) by the OID of the social security association.}
\jkoitem[PID-3,patientInfo.sourcePatientID,R]
{Patient identifier of the local CIS/RIS/PACS…Important: The Patient
Identifier
will be identified within the list of patient identifiers (PID-3) by the
identifier type code PI.}
\jkoitem[PID-5-1,patientInfo.familyName,R]
{Family name of the patient.}
\jkoitem[PID-5-2,patientInfo.givenName,R]
{Given name of the patient.}
\jkoitem[PID-5-3,patientInfo.secondAndFurtherNames{[0]},O]
{Second and further names of the patient}
\endjcode
\bye
You can try this in plain TeX. To rewrite this for LaTeX is simple exercise. I'll do not this because I don't support LaTeX.
The paragraphs are not breakable between lines and the last two items plus footer are not breakable too because of the test \ifnum\jcodenum<2 \nobreak \fi
.