Hello there,
I have 2 files (rm3head and rm3det) both ordered by recnum. There is a relationship set into rm3head (recnum field ties multiple detail records to one header record). Can anyone tell me why the output file in the select statement below would not be in the order of the records in rm3det? Thanks for your response.
SELECT rm3head.billed,rm3head.ad1b,rm3head.com2, rm3head.project, rm3head.account, rm3head.invoice, rm3head.program, rm3head.foreman, ;
rm3head.complete, rm3head.foreman, rm3head.accident, rm3head.special, rm3head.crewsize, rm3head.bridge, ;
rm3head.rptemptot, rm3head.rptmattot, rm3head.rpteqptot, rm3head.ad1, rm3head.ad2, rm3head.vendnam, rm3det.* ;
FROM rm3head , rm3det ;
WHERE rm3head.recnum = rm3det.recnum ;
AND (rm3head.complete BETWEEN Thisform.Pageframe1.Page1.bcomplete.VALUE AND Thisform.Pageframe1.Page1.ecomplete.VALUE) ;
AND (UPPER(rm3head.account) BETWEEN Thisform.Pageframe1.Page1.baccount.VALUE AND Thisform.Pageframe1.Page1.eaccount.VALUE) ;
AND (UPPER(rm3head.invoice) BETWEEN Thisform.Pageframe1.Page1.binvoice.VALUE AND Thisform.Pageframe1.Page1.einvoice.VALUE) ;
AND (UPPER(rm3head.project) BETWEEN Thisform.Pageframe1.Page1.bproject.VALUE AND Thisform.Pageframe1.Page1.eproject.VALUE) ;
AND (UPPER(rm3head.special) BETWEEN Thisform.Pageframe1.Page1.bspecial.VALUE AND Thisform.Pageframe1.Page1.especial.VALUE) ;
AND (UPPER(rm3head.foreman) BETWEEN Thisform.Pageframe1.Page1.bforeman.VALUE AND Thisform.Pageframe1.Page1.eforeman.VALUE) ;
AND (rm3head.crewsize BETWEEN Thisform.Pageframe1.Page1.bcrewsize.VALUE AND Thisform.Pageframe1.Page1.ecrewsize.VALUE) ;
AND (UPPER(rm3head.program) BETWEEN Thisform.Pageframe1.Page1.bprogram.VALUE AND Thisform.Pageframe1.Page1.eprogram.VALUE) ;
AND (UPPER(rm3head.bridge) BETWEEN Thisform.Pageframe1.Page1.bbridge.VALUE AND Thisform.Pageframe1.Page1.ebridge.VALUE) ;
AND (UPPER(rm3head.accident) BETWEEN Thisform.Pageframe1.Page1.baccident.VALUE AND Thisform.Pageframe1.Page1.eaccident.VALUE) ;
AND (rm3head.recnum BETWEEN Thisform.Pageframe1.Page1.brecnum.VALUE AND Thisform.Pageframe1.Page1.erecnum.VALUE) ;
AND (rm3head.estnum BETWEEN Thisform.Pageframe1.Page1.bestnum.VALUE AND Thisform.Pageframe1.Page1.eestnum.VALUE) ;
AND (UPPER(rm3det.twp) BETWEEN Thisform.Pageframe1.Page2.bunit.VALUE AND Thisform.Pageframe1.Page2.eunit.VALUE) ;
AND (UPPER(rm3det.rdname) BETWEEN Thisform.Pageframe1.Page2.broadname.VALUE AND Thisform.Pageframe1.Page2.eroadname.VALUE) ;
AND (UPPER(rm3det.route) BETWEEN Thisform.Pageframe1.Page2.broute.VALUE AND Thisform.Pageframe1.Page2.eroute.VALUE) ;
AND (UPPER(rm3det.loccode) BETWEEN Thisform.Pageframe1.Page2.bloccode.VALUE AND Thisform.Pageframe1.Page2.eloccode.VALUE) ;
AND (UPPER(rm3det.distrct) BETWEEN Thisform.Pageframe1.Page2.bdistrct.VALUE AND Thisform.Pageframe1.Page2.edistrct.VALUE) ;
AND (rm3det.sec BETWEEN Thisform.Pageframe1.Page2.bsec.VALUE AND Thisform.Pageframe1.Page2.esec.VALUE) ;
AND (rm3det.blog BETWEEN Thisform.Pageframe1.Page2.bblog.VALUE AND Thisform.Pageframe1.Page2.eblog.VALUE) ;
AND (rm3det.elog BETWEEN Thisform.Pageframe1.Page2.belog.VALUE AND Thisform.Pageframe1.Page2.eelog.VALUE) ;
AND (UPPER(rm3det.bloc) BETWEEN Thisform.Pageframe1.Page2.bbloc.VALUE AND Thisform.Pageframe1.Page2.ebloc.VALUE) ;
AND (UPPER(rm3det.eloc) BETWEEN Thisform.Pageframe1.Page2.beloc.VALUE AND Thisform.Pageframe1.Page2.eeloc.VALUE) ;
AND (rm3det.date BETWEEN Thisform.Pageframe1.Page3.bdate.VALUE AND Thisform.Pageframe1.Page3.edate.VALUE) ;
AND (UPPER(rm3det.opno) BETWEEN Thisform.Pageframe1.Page3.bopno.VALUE AND Thisform.Pageframe1.Page3.eopno.VALUE) ;
AND (rm3det.workcode BETWEEN Thisform.Pageframe1.Page3.bworkcode.VALUE AND Thisform.Pageframe1.Page3.eworkcode.VALUE) ;
AND (UPPER(rm3det.emp1) BETWEEN Thisform.Pageframe1.Page3.bemp1.VALUE AND Thisform.Pageframe1.Page3.eemp1.VALUE) ;
AND (UPPER(rm3det.mat1) BETWEEN Thisform.Pageframe1.Page3.bmat1.VALUE AND Thisform.Pageframe1.Page3.emat1.VALUE) ;
AND (UPPER(rm3det.mat1loc) BETWEEN Thisform.Pageframe1.Page3.bmat1loc.VALUE AND Thisform.Pageframe1.Page3.emat1loc.VALUE) ;
AND (UPPER(rm3det.eq1) BETWEEN Thisform.Pageframe1.Page3.beq1.VALUE AND Thisform.Pageframe1.Page3.eeq1.VALUE) ;
AND (UPPER(rm3det.paytype) BETWEEN Thisform.Pageframe1.Page3.bpaytype.VALUE AND Thisform.Pageframe1.Page3.epaytype.VALUE) ;
INTO TABLE "&CFSYSDRV.&CFI.&DWSTMP1"
I have 2 files (rm3head and rm3det) both ordered by recnum. There is a relationship set into rm3head (recnum field ties multiple detail records to one header record). Can anyone tell me why the output file in the select statement below would not be in the order of the records in rm3det? Thanks for your response.
SELECT rm3head.billed,rm3head.ad1b,rm3head.com2, rm3head.project, rm3head.account, rm3head.invoice, rm3head.program, rm3head.foreman, ;
rm3head.complete, rm3head.foreman, rm3head.accident, rm3head.special, rm3head.crewsize, rm3head.bridge, ;
rm3head.rptemptot, rm3head.rptmattot, rm3head.rpteqptot, rm3head.ad1, rm3head.ad2, rm3head.vendnam, rm3det.* ;
FROM rm3head , rm3det ;
WHERE rm3head.recnum = rm3det.recnum ;
AND (rm3head.complete BETWEEN Thisform.Pageframe1.Page1.bcomplete.VALUE AND Thisform.Pageframe1.Page1.ecomplete.VALUE) ;
AND (UPPER(rm3head.account) BETWEEN Thisform.Pageframe1.Page1.baccount.VALUE AND Thisform.Pageframe1.Page1.eaccount.VALUE) ;
AND (UPPER(rm3head.invoice) BETWEEN Thisform.Pageframe1.Page1.binvoice.VALUE AND Thisform.Pageframe1.Page1.einvoice.VALUE) ;
AND (UPPER(rm3head.project) BETWEEN Thisform.Pageframe1.Page1.bproject.VALUE AND Thisform.Pageframe1.Page1.eproject.VALUE) ;
AND (UPPER(rm3head.special) BETWEEN Thisform.Pageframe1.Page1.bspecial.VALUE AND Thisform.Pageframe1.Page1.especial.VALUE) ;
AND (UPPER(rm3head.foreman) BETWEEN Thisform.Pageframe1.Page1.bforeman.VALUE AND Thisform.Pageframe1.Page1.eforeman.VALUE) ;
AND (rm3head.crewsize BETWEEN Thisform.Pageframe1.Page1.bcrewsize.VALUE AND Thisform.Pageframe1.Page1.ecrewsize.VALUE) ;
AND (UPPER(rm3head.program) BETWEEN Thisform.Pageframe1.Page1.bprogram.VALUE AND Thisform.Pageframe1.Page1.eprogram.VALUE) ;
AND (UPPER(rm3head.bridge) BETWEEN Thisform.Pageframe1.Page1.bbridge.VALUE AND Thisform.Pageframe1.Page1.ebridge.VALUE) ;
AND (UPPER(rm3head.accident) BETWEEN Thisform.Pageframe1.Page1.baccident.VALUE AND Thisform.Pageframe1.Page1.eaccident.VALUE) ;
AND (rm3head.recnum BETWEEN Thisform.Pageframe1.Page1.brecnum.VALUE AND Thisform.Pageframe1.Page1.erecnum.VALUE) ;
AND (rm3head.estnum BETWEEN Thisform.Pageframe1.Page1.bestnum.VALUE AND Thisform.Pageframe1.Page1.eestnum.VALUE) ;
AND (UPPER(rm3det.twp) BETWEEN Thisform.Pageframe1.Page2.bunit.VALUE AND Thisform.Pageframe1.Page2.eunit.VALUE) ;
AND (UPPER(rm3det.rdname) BETWEEN Thisform.Pageframe1.Page2.broadname.VALUE AND Thisform.Pageframe1.Page2.eroadname.VALUE) ;
AND (UPPER(rm3det.route) BETWEEN Thisform.Pageframe1.Page2.broute.VALUE AND Thisform.Pageframe1.Page2.eroute.VALUE) ;
AND (UPPER(rm3det.loccode) BETWEEN Thisform.Pageframe1.Page2.bloccode.VALUE AND Thisform.Pageframe1.Page2.eloccode.VALUE) ;
AND (UPPER(rm3det.distrct) BETWEEN Thisform.Pageframe1.Page2.bdistrct.VALUE AND Thisform.Pageframe1.Page2.edistrct.VALUE) ;
AND (rm3det.sec BETWEEN Thisform.Pageframe1.Page2.bsec.VALUE AND Thisform.Pageframe1.Page2.esec.VALUE) ;
AND (rm3det.blog BETWEEN Thisform.Pageframe1.Page2.bblog.VALUE AND Thisform.Pageframe1.Page2.eblog.VALUE) ;
AND (rm3det.elog BETWEEN Thisform.Pageframe1.Page2.belog.VALUE AND Thisform.Pageframe1.Page2.eelog.VALUE) ;
AND (UPPER(rm3det.bloc) BETWEEN Thisform.Pageframe1.Page2.bbloc.VALUE AND Thisform.Pageframe1.Page2.ebloc.VALUE) ;
AND (UPPER(rm3det.eloc) BETWEEN Thisform.Pageframe1.Page2.beloc.VALUE AND Thisform.Pageframe1.Page2.eeloc.VALUE) ;
AND (rm3det.date BETWEEN Thisform.Pageframe1.Page3.bdate.VALUE AND Thisform.Pageframe1.Page3.edate.VALUE) ;
AND (UPPER(rm3det.opno) BETWEEN Thisform.Pageframe1.Page3.bopno.VALUE AND Thisform.Pageframe1.Page3.eopno.VALUE) ;
AND (rm3det.workcode BETWEEN Thisform.Pageframe1.Page3.bworkcode.VALUE AND Thisform.Pageframe1.Page3.eworkcode.VALUE) ;
AND (UPPER(rm3det.emp1) BETWEEN Thisform.Pageframe1.Page3.bemp1.VALUE AND Thisform.Pageframe1.Page3.eemp1.VALUE) ;
AND (UPPER(rm3det.mat1) BETWEEN Thisform.Pageframe1.Page3.bmat1.VALUE AND Thisform.Pageframe1.Page3.emat1.VALUE) ;
AND (UPPER(rm3det.mat1loc) BETWEEN Thisform.Pageframe1.Page3.bmat1loc.VALUE AND Thisform.Pageframe1.Page3.emat1loc.VALUE) ;
AND (UPPER(rm3det.eq1) BETWEEN Thisform.Pageframe1.Page3.beq1.VALUE AND Thisform.Pageframe1.Page3.eeq1.VALUE) ;
AND (UPPER(rm3det.paytype) BETWEEN Thisform.Pageframe1.Page3.bpaytype.VALUE AND Thisform.Pageframe1.Page3.epaytype.VALUE) ;
INTO TABLE "&CFSYSDRV.&CFI.&DWSTMP1"