× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey Robert

The table column names are only "in scope" for the SQL statement that
contains them. They're not known within the host program, so you don't
need to declare either data structure. Although I have to warn you, the
word "scope" is an oxymoron when used in the same month as the RPG SQL
precompiler.

Pete Hall
pbhall@xxxxxxxxxxxxx
http://pbhall.us


Robert Munday wrote:
I am performing some validation using SQL to determine if a value exists in a
transaction file before submitting a report program. If the value does not
exist there is no reason to run the report. I have four report selections to
test but they appear in two files... control and detail. For example, the
group number is in the control file and the order number is in the detail
file. My problem is that I have some fields with idential names in both
files. Here is what I have thus far:

* Control File
D PDTOTCTL E DS ExtName(PDTOTCTL)

* Detail File
D PDTOTDTL E DS ExtName(PDTOTDTL)

C/Exec SQL
+ Select Count(QCGRP) Into :Count From FPTOTCTL
+ Where QCGRP = :$GROUP -- Count Group Records
C/End-Exec

If Count = 0, I know I have no group records and can notify the user.

C/Exec SQL
+ Select Count(QCORD#) Into :Count From FPTOTDTL
+ Where QCORD# = :$ORDER -- Count Order Records
C/End-Exec

Same here.

How do I use two externally described files for SQL in the one program having
duplicate field names? I have tried Prefix on the D-spec, qualifying the
name in the SQL statement and defining one file in the F-spec and renaming
the duplicated fields in the I-specs. None of these has worked so far. Any
solution to this?

Thanks,


Robert Munday
Munday Software Consultants
Montgomery, AL
having SQL fun in Dublin, OH


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGS5QDpcZsDl8OX6kRAgSXAJ9Eqr6sX0JlSzdcdlS5lNUYHChtxQCgjZHI
8TmVadOVVc8uLwG3cirS1HQ=
=ROno
-----END PGP SIGNATURE-----

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.