|
I have a situation where I would like to run an embedded RPGLE SQL
over an audit database file where the actual file name can change.
The audit files are created by a 3rd party programs and I just have to
use what they give me. I have to go through a couple of files to
determine the current file name and library (library does not usually
change except between environments). File names are typically
M3DJD00002, M3DJD00005, Etc. depending on the file being audited.
I have tried variations of the following, but can not seem to make it
work. Can the file names be variables?
AuditFile = DBXLIB + '.' + DBXFIL;
/End-Free
C/EXEC SQL
C+ Declare C1 Cursor for
C+ Select * from AUDITFILE
C+ Where CRDY = :RunDate
C+ Order by SEQU
C+ for Fetch Only
C/END-Exec
Position 26 Column definitions for table AUDITFILE in
*LIBL not found.
I have also tried
C+ Select * from :DBXLIB.:DBXFIL
Token : was not valid. Valid tokens: (TABLE LATERAL <IDENTIFIER>
C+ Select * from :DBXLIB/:DBXFIL
Token : was not valid. Valid tokens: (TABLE LATERAL <IDENTIFIER>
Just to make it easier, if someone adds a field to be audited, the
file definition is changed and my fetch into a data structure is
likely to get a level check.
Any suggestions?
Thanks
Dave
Reading the XML-document
works fine, but is it possible to create an XML-document with Expat
and put it on the IFS again ? If so, can anyone can help me with some
examples ?
Hi Mike,it
You say one of the files is different. Different in what way? Does
have different fields that are used for different purposes?this:
You mention using an IF statement so I'm expecting something like
right?
if FileType='ORANGE';
read ORANGEFIL;
else;
read APPLEFIL;
endif;
And, okay, that will work as far as it goes. But now which fields
have been loaded into the program? And what needs to be done
differently with the fields from ORANGEFIL vs APPLEFIL? I'm assuming
there must be something substantially different about the fields,
otherwise you'd have changed ORANGEFIL so that it works exactly the
same as APPLEFIL (or whatever your files happened to be named).
If the fields are substantially different and therefore require
separate code to handle them, then how can you call one a substitute
for the other? AT some point, there must be a common denominator,
life.
Personally, I'd try to find the common denominator. Write a service
program that encapsulates the differences between the files to
(probably the wrong word) "normalize" the file access. Then use that
service program instead of reading the file directly.
Make sense?
Mike wrote:
I need to bounce this off you guys to see if there is a better way.is
This
bugging every aspect of me and am looking for ideas to simplify my
one
I have two sets of files. Out of the 5 files in the set of files,
only
file in the set is different. So now I have a maintenance nightmare
of having two programs exactly the same (and keep the same) except
for the files they use. Is there a way I can make this one program?
I could use a flag and put an if statement on every
read/write/update/delete, but could there be a better way? The other
file is similar, but different enoughthat
I think it would be best just to maintain two programs.
--
Mike Wills
Midrange Programmer/Analyst
Sick of corporate radio and hungry for something new?
http://thenextgenerationofradio.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.
Hi Bruce,
I'm no expert, I'm trying to figure this stuff out. I'm looking at
the following page of the Information Center:
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/rbam6/pass
p.htm
Here's a quote from that page:
- -
When calling an original program model (OPM) CL program, the number of
parameters that are passed to it must exactly match the number that is
expected by the program. The number that is expected is determined at
the time the program is created. (The operating system prevents you
from calling a program with more or fewer parameters than the program
expects). When calling an ILE program or procedure, the operating
system does not check the number of parameters that are passed on the
call. In addition, the space where the operating system stores the
parameters is not reinitialized between procedure calls. Calling a
procedure that expects "n" parameters with "n-1" parameters makes the
system use whatever is in the parameter space to access the "nth"
parameter. The results of this action are very unpredictable. This
also applies to procedures written in other ILE languages that call CL
procedures or are called by CL procedures.that
- -
That paragraph states "When calling an ILE program or procedure", then
proceeds to say the space is not reinitialized between calls. Now
I'm reading this again after you've told me I'm wrong, I do see that
it uses the verbiage "procedure calls"... but the fact that (before
that) it says "program or procedure" makes this paragraph very easy to
interpret the way I originally interpreted it (that it applies to both
program and procedure calls).right?
As usual, IBM documentation is anything but clear.
Bruce Vining wrote:
Hi, Scottcall will get you the exception. There was a bug along these lines a
Should have stopped on your first note lol. The code path for a
*PGM
loooong time ago, but it has been corrected (perhaps as long as two
years ago?).
Bruce
Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx> wrote:
...and in ILE CL, the parameter storage isn't reinitialized
between calls, is it? So you couldn't rely on the MCH3601 being
generated each time, unless *OMIT is passed from the CALL command,
I'm with Francis. Use a command front-end. Or, if it's REALLY
important that you use the CALL command, put an RPG front-end over
your CL program.
Scott Klement wrote:
Hi Bruce,
Wouldn't you still get a "Parameters passed on CALL do not match
those required." error when you tried to call this? Unless you used
ILE CL, that is?
Bruce Vining wrote:
Sure. But it does need to be a *PGM.
PGM PARM(&PARM1)
DCL VAR(&PARM1) TYPE(*CHAR) LEN(1) DCL VAR(&TEST) TYPE(*CHAR)
LEN(1) CHGVAR VAR(&TEST) VALUE(&PARM1) MONMSG MSGID(MCH3601)
EXEC(DO) RCVMSG MSGTYPE(*LAST) SNDPGMMSG MSG('Not sent')
TOPGMQ(*EXT) RETURN ENDDO IF COND(&PARM1 = Y) + THEN(SNDPGMMSG
MSG('Sent') TOPGMQ(*EXT)) ELSE CMD(SNDPGMMSG MSG('Sent but no Y')
+
TOPGMQ(*EXT))
ENDPGM
Bruce Vining
--
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.
Help !
gMs = %SUBDT ( AFinDt : *MONTHS );
But gMs is 2 character field.
I naively tried %EDITC 'X' which obviously gives me '00'
%CHAR gives '40' if the date is April.
--
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.
I've declared a data structure based on the DSPF that is already in
the F specs of my program. ( what I really wanted was to do a LIKEREC
format name ).
David FOXWELL wrote:If you use INDARA on your display file, that will alleviate some of the
I've declared a data structure based on the DSPF that is already in
the F specs of my program. ( what I really wanted was to do a LIKEREC
format name ).
I don't think external data structures based on display files are a
great idea ... or even if they will work at all ... primarily because
indicators are defined in the DDS and thus imported included in the
generated structure.
-----Original Message-----[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
From: rpg400-l-bounces@xxxxxxxxxxxx
On Behalf Of Francis LapeyreEdit
Sent: Tuesday, June 17, 2008 9:44 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: Get month from date zone
David:
Try this:
gMs = %editc(%SUBDT( AFinDt : *MONTHS ):'X');
%SUBDT returns an integer, so you need to convert it to character.
Code<David.FOXWELL@xxxxxxxxx>
'X' will do that (with a leading zero).
On Tue, Jun 17, 2008 at 8:35 AM, David FOXWELL
wrote:mailing
Help !
gMs = %SUBDT ( AFinDt : *MONTHS );
But gMs is 2 character field.
I naively tried %EDITC 'X' which obviously gives me '00'
%CHAR gives '40' if the date is April.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L)
listlist
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.
--
Francis Lapeyre
Nullum gratuitum prandium.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
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-2025 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.