× 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.



Thanks for all of your comments. I have learned quite a bit from all of you.

As for this message:

I am gathering data on ASCII files in out IFS. I am using Scott Klement's book on reading/writing IFS files.

I am attempting to get the change date from the stat procedure. Can anyone tell me how to translate the value received from stat into a date and/or time?

Thanks,

Marvin

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of rpg400-l-request@xxxxxxxxxxxx
Sent: Thursday, May 08, 2008 10:00 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: RPG400-L Digest, Vol 7, Issue 382

Send RPG400-L mailing list submissions to
rpg400-l@xxxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.midrange.com/mailman/listinfo/rpg400-l
or, via email, send a message with subject or body 'help' to
rpg400-l-request@xxxxxxxxxxxx

You can reach the person managing the list at
rpg400-l-owner@xxxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of RPG400-L digest..."


*** NOTE: When replying to this digest message, PLEASE remove all text unrelated to your reply and change the subject line so it is meaningful.

Today's Topics:

1. RE: Join two files with different time format (Walden H. Leverich)
2. Re: Quick OPM RPG question (James Lampert)
3. Re: Quick OPM RPG question -- but does my solution have
potential side effects? (James Lampert)
4. Re: Integers outperform Packed in a big way (Mark S. Waterbury)
5. Re: Quick OPM RPG question (Mark S. Waterbury)


----------------------------------------------------------------------

message: 1
date: Thu, 8 May 2008 08:52:51 -0400
from: "Walden H. Leverich" <WaldenL@xxxxxxxxxxxxxxx>
subject: RE: Join two files with different time format

Coded that way (which is the "right" way) the "select *" will return all columns from both tables.

-Walden

--
Walden H Leverich III
Tech Software
(516) 627-3800 x3051
WaldenL@xxxxxxxxxxxxxxx
http://www.TechSoftInc.com

Quiquid latine dictum sit altum viditur.
(Whatever is said in Latin seems profound.)

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Esben Kiel S?rensen
Sent: Thursday, May 08, 2008 4:50 AM
To: RPG programming on the AS400 / iSeries
Subject: RE: Join two files with different time format

Hi,

Thanks for input!

If I put the join in, then I won't have to have it in my SELECT part, do I?

Select *

FROM
STPALV ALV INNER JOIN ATS002P SCD ON
ALV.EMPNUM = SCD.A2EMPNO AND
ALV.LOCN = SCD.A2LOCN AND
(YEAR(ALV.RSTDTE) * 10000) +
(MONTH(ALV.RSTDTE) * 100) +
(DAY(ALV.RSTDTE)) = SCD.A2DATE

WHERE

LVESTS = '5' AND
ALV.EMPNUM < 80000 AND
NOT EXISTS (SELECT * from ats006p WHERE ALV.LVCDE = A6LVCDE) and
ALV.LVCDE not in ('UNXAG', 'TUNAX', 'TUNXA')


Yours sincerely / Med venlig hilsen

Esben Kiel S?rensen
E-mail: eksor@xxxxxxxxxx




-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Armbruster, Tom
Sent: 8. maj 2008 00:55
To: RPG programming on the AS400 / iSeries
Subject: RE: Join two files with different time format

Character is a very slow and lofty join process in SQL, especially in a conversion.

Let's be clear, first, about the expression in question. This is not a join expression, it is a criteria expression. Join clauses occur in the body of the FROM statement.

You already have the formula for creating your join in your SELECT statement: (YEAR(ALV.RSTDTE)* 10000) + (MONTH(ALV.RSTDTE)* 100) + (DAY(ALV.RSTDTE)). Use this to create the join between the files. In other words:

FROM STPALV ALV INNER JOIN ATS002P SCD ON ALV.EMPNUM = SCD.A2EMPNO AND ALV.LOCN = SCD.A2LOCN AND (YEAR(ALV.RSTDTE) * 10000) + (MONTH(ALV.RSTDTE) * 100) + (DAY(ALV.RSTDTE)) = SCD.A2DATE

SQL doesn't care about the native data type in numeric comparisons. Converting the data to match type is an unnecessary use of IO and processor.

There is yet another "radical" approach to this problem. Convert the decimal date to a real date or add a field to the file in question that contains a real date version of the data with a trigger.

One thing I've learned over time is that numeric date fields provide NO support for date validation outside of the programming language that writes the record. If you attempt to write July 32nd, for example, to a numeric date field, the database doesn't care. It's just another number. A date field, however, will throw an exception. I say this with the greatest sympathy for programmers that have to deal with this anomaly. Our predecessors created 6 digit numeric fields for dates in mmddyy format. There is no greater undertaking in the world of RPG and/or SQL than to compare two drastically unlike data types. You may be able to reduce the overhead by the conversion methods suggested, but your best bet in the long run is to make the data types the same in the file.

Tom Armbruster

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Peter Dow (ML)
Sent: Wednesday, May 07, 2008 2:34 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Join two files with different time format

Hi Esben,

Try converting the date to decimal, or both the date and the decimal date to character, e.g.

dec(char(ALV.RSTDTE,ISO),8,0) = ALV.A2DATE

or

char(ALV.RSTDTE,ISO) = digits(ALV.A2DATE)


*Peter Dow* /
Dow Software Services, Inc.
909 793-9050
pdow@xxxxxxxxxxxxxxx <mailto:pdow@xxxxxxxxxxxxxxx> /

Esben Kiel S?rensen wrote:
Hi all,

I'm trying to join two files, but the problem is that the files don't have the same date format. One is an 8 digits decimal date, and the other is a "real" data field '2008-04-25'.. How can i join these?

I tried:

DECLARE A CURSOR FOR
SELECT 'D' , ALV . EMPNUM , ALV . LVCDE , ( YEAR ( ALV . RSTDTE ) *
10000 ) + ( MONTH ( ALV . RSTDTE ) * 100 ) + ( DAY ( ALV . RSTDTE ) )
, ALV . RSTTME , ALV . LVEDUR , SCD . A2SSHIFT , ALV . SDTALV +
19000000 , : H , : H , ' ' , : H , : H

FROM STPALV ALV , ATS002P SCD

WHERE ALV . EMPNUM = SCD . A2EMPNO AND
ALV . LOCN = SCD . A2LOCN
AND LVESTS = '5' AND
ALV . RSTDTE = DATE ( INSERT ( INSERT ( DIGITS ( A2DATE ) , 5 , 0 , '-' ) , 8 , 0 , '-' ) )
AND ALV . EMPNUM < 80000 AND NOT EXISTS ( SELECT * FROM ATS006P WHERE ALV . LVCDE = A6LVCDE )
AND ALV . LVCDE NOT IN ( 'UNXAG' , 'TUNAX' , 'TUNXA' ) FOR READ ONLY

RSTDTE is the field defined like 10 L and A2DATE is a 8.0 decimal.

This works, but is take like for ever to prepare this cursor... Any suggestions, on how to make this perform better?
Yours sincerely / Med venlig hilsen

Esben Kiel S?rensen
Software Developer
E-mail: eksor@xxxxxxxxxx



--
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.

--
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.



------------------------------

message: 2
date: Thu, 08 May 2008 08:38:35 -0800
from: James Lampert <jamesl@xxxxxxxxxxxxxxxxx>
subject: Re: Quick OPM RPG question

Keith Carpenter wrote:

1) Always pass the MODS parm to program. Optional parms are often just
an easy way to avoid maintenance of other programs.

In this case, a program that hasn't required maintenance in the past
DECADE, and for which I had to retrieve the source member from a box
that hadn't been powered up (aside from its weekly exercise cycle) in
over a year.

What really sucks is that the program with the optional parameter
doesn't actually USE the multi-occurrence data structure; it was added
because that program now calls a program (a customized, closed-source
variation on Dave McKenzie's UNDEL2, if you must know) that DOES use it.

"MODS"? What does the MI instruction to modify the attributes of a space
have to do with multi-occurrence data structures? :-p

--
James H. H. Lampert
Touchtone Corporation



------------------------------

message: 3
date: Thu, 08 May 2008 09:04:46 -0800
from: James Lampert <jamesl@xxxxxxxxxxxxxxxxx>
subject: Re: Quick OPM RPG question -- but does my solution have
potential side effects?

Given that the program that's crashing doesn't actually use the MULTDS
it is passed, but merely passes it, if available, to a customized
UNDEL2, and given that everything in an OPM program call is passed by
reference, I tried this:

I changed the optional parameter to a simple 1-character field.

Now, if the MULTDS is received (in the 1-character field), it is passed
on to the custom UNDEL2. If it isn't, it isn't. And it looks like the
custom UNDEL2 is getting the whole MULTDS.

*************

*BUT I'M WORRIED.* This MULTDS can potentially have 9999 occurrences of
186 bytes each. Could there be side effects of passing a reference as if
it were only one byte?

--
James H. H. Lampert
Touchtone Corporation



------------------------------

message: 4
date: Thu, 08 May 2008 12:59:08 -0400
from: "Mark S. Waterbury" <mark.s.waterbury@xxxxxxx>
subject: Re: Integers outperform Packed in a big way

Hi, Joe:

Packed decimal arithmetic is inherently a CISC kind of operation.
Machines without microcode
and the ability to execute whole subroutines in microcode (including the
PowerPC family) are at
a disadvantage, because the compiler must either generate a call to
runtime routines or generate
quite a few in-line instructions to do the job.

Some time ago, Mr. Dave McKenzie posted some details on the MI400 list.
Here is a link:

http://archive.midrange.com/mi400/200703/msg00003.html

Stop speculating, and do some reading. Educate yourselves. :-)

Enjoy!

Mark S. Waterbury

Joe Pluta wrote:
Walden H. Leverich wrote:

I assume you mean you doubt the MI codes use the wrong instructions. I
doubt it too, but they why such a difference? I guess it's just a nature
of the beast given that the integer math is mostly shift and other
low-cycle (single-cycle) operations where the packed math is
multi-cycle. But I would have assumed that the built-in hardware was
optimized for just that purpose, almost an ASIC on a CPU. :)


Perhaps when the machine was moved from CISC to RISC, any CPU-level
packed decimal opcodes were removed.

Joe



------------------------------

message: 5
date: Thu, 08 May 2008 13:00:59 -0400
from: "Mark S. Waterbury" <mark.s.waterbury@xxxxxxx>
subject: Re: Quick OPM RPG question

Hi, James:

I thought exactly the same thing. (The MI MODS instruction ...)


Then I remembered that "MODS" is also an RPG acronym for

Multi-Occurance Data Structure

Cheers,

Mark

James Lampert wrote:
Keith Carpenter wrote:


1) Always pass the MODS parm to program. Optional parms are often just
an easy way to avoid maintenance of other programs.


In this case, a program that hasn't required maintenance in the past
DECADE, and for which I had to retrieve the source member from a box
that hadn't been powered up (aside from its weekly exercise cycle) in
over a year.

What really sucks is that the program with the optional parameter
doesn't actually USE the multi-occurrence data structure; it was added
because that program now calls a program (a customized, closed-source
variation on Dave McKenzie's UNDEL2, if you must know) that DOES use it.

"MODS"? What does the MI instruction to modify the attributes of a space
have to do with multi-occurrence data structures? :-p




------------------------------

--
This is the RPG programming on the AS400 / iSeries (RPG400-L) digest 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.



End of RPG400-L Digest, Vol 7, Issue 382
****************************************

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.