|
From: rob@xxxxxxxxx
Reply-To: RPG programming on the AS400 / iSeries
<rpg400-l@xxxxxxxxxxxx>
To: RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
Subject: Re: Validate Data library name
Date: Tue, 15 May 2007 13:56:49 -0400
Keeping in mind that you said a "data" library. Also keep in mind that
you are going to access a file that is in that library to validate the
company number.
CHKOBJ on the object itself is one method. If you prompt it, move your
cursor to the title line and press F1 you can see what messages you can
monitor for. Anything from library doesn't exist to file doesn't
exist, etc. I'd check for the end file you are looking for.
Another method is to open the desired file manually
FDataFile IF E disk USROPN EXTFILE(TheName)
D TheName s 21a varying
/free
TheName=%trimr(library + '/' + File); // library came from prompt
screen
monitor;
Open DataFile;
on-error xxxxx; // replace xxxxx with the error code for library
doesn't exist
// see file/exception handling in the rpg reference and/or program
guide:Library
EndMon;
...
Another method
/free
x=0;
execsql select count(*) into :x
from qsys2/syscolumns
where system_column_name=:fieldName
and system_table_name=:FileName
and system_schema_name=:Library;
If x=0;
// column :fieldName from table :FileName is not in library
EndIf;
Rob Berendt
--
Group Dekko Services, LLC
Dept 01.073
PO Box 2000
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com
David Gibbs <david@xxxxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
05/15/2007 01:34 PM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
To
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> cc
Fax to
Subject
Re: Validate Data library name
derek gonsalves wrote:
I have a program wherein the user enters the data library name onlibrary.
the screen, and the company name. Now I first need to validate if
the library is a valid AS400 library and if yes then i need to
validate the company number from the company master file present in
that data
Any suggestions on how this can be handled??
QUSLOBJ API
(http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/quslobj.ht
m) will let you validate that the library exists.
david
--
Check out the midrange.com System i Wiki: http://wiki.midrange.com
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.