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



>> What would be the simplest way to find the last day of the next month?

The following will calculate the end of month date for any arbitrary date.
If only two parms are passed it will calculate the end of the month for the
date passed. If you wish to advance by a number of months then pass the
third parm and specify the number of months to advance. So for the next
month you pass 1 as the third parm.

The routine could easily be adapted for the first day of the month by
changing:
%SubDt(InpDate : *D) to ( %SubDt(InpDate : *D) - 1 ).

P EndOfMonth B
D PI D DatFmt(*USA)
D inpDate D DatFmt(*USA) Value
D mthsToAdv 3i 0 Value Options(*NoPass)


/free
If %Parms = 3;
inpDate = inpDate + %Months( mthsToAdv + 1 );
Else;
inpDate = inpDate + %Months(1);

EndIf;

Return InpDate - %Days( %SubDt(InpDate : *D) );

/end-free

P EndOfMonth B

Jon Paris
Partner400

www.Partner400.com

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
rpg400-l-request@xxxxxxxxxxxx
Sent: Tuesday, June 19, 2007 9:45 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: RPG400-L Digest, Vol 6, Issue 631

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: Adding parameters to procedures (Alan Campin)
2. RE: Adding parameters to procedures (Wilt, Charles)
3. RE: Adding parameters to procedures (Joe Pluta)
4. Re: Adding parameters to procedures (Scott Klement)
5. Re: Calling a Pgm on a Remote i5 using RPG
(Sarvapriya_Tripathi@xxxxxxxxx)
6. Numeric to alpha (Mike Berman)
7. Re: Numeric to alpha (Peter.Colpaert@xxxxxxxxx)
8. Last day of the next month (derek gonsalves)
9. Re: Last day of the next month (Michael Ryan)
10. Re: Last day of the next month (Michael_Schutte@xxxxxxxxxxxx)


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

message: 1
date: Mon, 18 Jun 2007 10:23:29 -0700
from: "Alan Campin" <Alan.Campin@xxxxxxxxxxxxxxxx>
subject: RE: Adding parameters to procedures

<snip>
Each procedure uses a DS for entry and another for output
parameters. If a new parameter has to be added it is just
added to the DS in question.
</snip>

Sorry but this whole concept makes my stomach turn.



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

message: 2
date: Mon, 18 Jun 2007 13:37:40 -0400
from: "Wilt, Charles" <WiltC@xxxxxxxxxx>
subject: RE: Adding parameters to procedures

Nice to know...

But some explanation would be more helpful I think....

Charles


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Alan Campin
Sent: Monday, June 18, 2007 1:23 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: RE: Adding parameters to procedures

<snip>
Each procedure uses a DS for entry and another for output
parameters.
If a new parameter has to be added it is just added to the DS in
question.
</snip>

Sorry but this whole concept makes my stomach turn.

--
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 e-mail transmission contains information that is
intended to be confidential and privileged. If you receive
this e-mail and you are not a named addressee you are hereby
notified that you are not authorized to read, print, retain,
copy or disseminate this communication without the consent of
the sender and that doing so is prohibited and may be
unlawful. Please reply to the message immediately by
informing the sender that the message was misdirected. After
replying, please delete and otherwise erase it and any
attachments from your computer system. Your assistance in
correcting this error is appreciated.



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

message: 3
date: Mon, 18 Jun 2007 12:45:04 -0500
from: "Joe Pluta" <joepluta@xxxxxxxxxxxxxxxxx>
subject: RE: Adding parameters to procedures

From: Alan Campin

Sorry but this whole concept makes my stomach turn.

From: Wilt, Charles

Nice to know...

But some explanation would be more helpful I think....


Nah, I really don't want any more explanation about Alan's
stomach <grin>

Joe




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

message: 4
date: Mon, 18 Jun 2007 14:10:44 -0500
from: Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>
subject: Re: Adding parameters to procedures

This is a really bad idea. You may as well use CALL/PARM and
*ENTRY PLIST, you're throwing away all of the value of using
prototypes by passing these data structures.

Your code guarantees that all callers (whether they use the
new fields or not) must be recompiled every time a data
structure changes, drastically increasing the amount of
maintenance that's required.

Even worse, the compiler won't protect you against passing
the wrong data structure. You can have a completely
different data structure in one program and pass it to the
other, and there won't be any errors.
It'll just let it happen, causing all sorts of nasty problems.

Yet worse than that, the subprocedures in your service
program have no way to detect that they're passed the wrong
length parameters. If you add a new field to a data
structure and forget to recompile a caller, you won't get any
errors, you'll simply write into undefined memory,
potentially corrupting other parameters, in the same or
different programs. Just a really, really, bad thing to do.

Why not pass individual parameters? Why do you want to pass
data structures?


David Foxwell wrote:
We are looking at the possibility of standardizing our procedures in
the manner described at the link below.

The aim is to avoid touching any procedures that don't use a
parameter that has been added to an exported procedure. We just
recompile everything.

Each procedure uses a DS for entry and another for output
parameters.
If a new parameter has to be added it is just added to the DS in
question.

I have a problem with this : it gives rise to horribly long
parameter
names ( I've simplified in the example) and debugging is annoying.
But my biggest concern is what else are we missing? Someone
out there
MUST have already tried this system.

Any comments would be greatly appreciated.


http://code.midrange.com/index.php?id=703f46126a



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

message: 5
date: Mon, 18 Jun 2007 16:27:11 -0400
from: Sarvapriya_Tripathi@xxxxxxxxx
subject: Re: Calling a Pgm on a Remote i5 using RPG

Thanks a lot Matt, CRTSQLPKG did the trick....

Matt Haas wrote....
Did you create the stored procedure definition on the remote machine?
The program also has to be on the remote machine. You will
also need to
create an SQL package for the program that is connecting to the remote
machine or it will not work. Here's an example:

CRTSQLPKG PGM(mylib/mypgm) RDB(remotedb) USER(user) PASSWORD(password)

The CRTSQLPKG command must be run on the local machine.

Additionally, if you enter STRDBG UPDPROD(*YES) and then run your
program, the job log will give you detailed information about what's
happening.



Regds
Sarvapriya
**************************************************************
****************

The information contained in this electronic communication and any
accompanying document is confidential, may be attorney-client
privileged,
and is intended only for the use of the addressee. It is the
property of
Ryder System, Inc. Unauthorized use, disclosure or copying of this
communication, or any part of it, is strictly prohibited and may be
unlawful. If you have received this communication in error,
please notify
the sender immediately by return email, and destroy this
communication and
all copies of it, including all attachments. Electronic
communication may
be susceptible to data corruption, interception and
unauthorized tampering
and Ryder disclaims all liability of any kind for such actions or any
consequences that may arise directly or indirectly therefrom.
**************************************************************
****************


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

message: 6
date: Tue, 19 Jun 2007 06:29:29 -0700 (PDT)
from: Mike Berman <mikeba777@xxxxxxxxx>
subject: Numeric to alpha

HI - I have a field that is defined as numeric. In the new
EDI file formats this particular field is now alpha. For some
reports that already exist we have to convert via changing
field names mostly but here obviously there is a problem.

What are some apporaches to handling this issue?

Thank you,
Mike


---------------------------------
Fussy? Opinionated? Impossible to please? Perfect. Join
Yahoo!'s user panel and lay it on us.

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

message: 7
date: Tue, 19 Jun 2007 15:32:32 +0200
from: Peter.Colpaert@xxxxxxxxx
subject: Re: Numeric to alpha

Mike,

I'd have a look at the %editc() built-in function.

Best regards,

Peter Colpaert
Application Developer
PLI - IT - Kontich, Belgium
-----
Yoda of Borg are we. Futile is resistance, assimilated will you be.
-----



Mike Berman <mikeba777@xxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
19/06/2007 15:29
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
rpg400-L@xxxxxxxxxxxx
cc

Subject
Numeric to alpha






HI - I have a field that is defined as numeric. In the new EDI file
formats this particular field is now alpha. For some reports
that already
exist we have to convert via changing field names mostly but here
obviously there is a problem.

What are some apporaches to handling this issue?

Thank you,
Mike






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

message: 8
date: Tue, 19 Jun 2007 13:43:13 +0000
from: "derek gonsalves" <d_gons@xxxxxxxxxxx>
subject: Last day of the next month


Hi everyone,

What would be the simplest way to find the last day of the next month?
I have a requirement, wherein i need to update a particular
field with the
first day of the next
month and another field with the last day of the next month.
I have done this using the following -

@CDate Ds
@CC 1 1 0
@CY 2 3 0
@Str51 4 4 Inz('/')
@CM 5 6 0
@Str52 7 7 Inz('/')
@CD 8 9 0

dW@dat s d



*CYMD Movel @CDate W@dat
AddDur 1:*M W@dat
*CYMD Movel W@dat @CDate

Eval cent = @CC
Eval year = @CY
Eval mont = @CM
Eval day = 01

Now this handles the first day of the next month,
How will i handle the last day of the next month. Any suggestions?

Thanks in advance
Derek

_________________________________________________________________
Who's that on the Red Carpet? Play & win glamorous prizes.
http://club.live.com/red_carpet_reveal.aspx?icid=REDCARPET_hot
mailtextlink3



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

message: 9
date: Tue, 19 Jun 2007 09:47:59 -0400
from: "Michael Ryan" <michaelrtr@xxxxxxxxx>
subject: Re: Last day of the next month

Add two months to the current month, set the day to 1, and
subtract 1 day.

On 6/19/07, derek gonsalves <d_gons@xxxxxxxxxxx> wrote:

Hi everyone,

What would be the simplest way to find the last day of the
next month?
I have a requirement, wherein i need to update a particular
field with the
first day of the next
month and another field with the last day of the next month.
I have done this using the following -

@CDate Ds
@CC 1 1 0
@CY 2 3 0
@Str51 4 4 Inz('/')
@CM 5 6 0
@Str52 7 7 Inz('/')
@CD 8 9 0

dW@dat s d



*CYMD Movel @CDate W@dat
AddDur 1:*M W@dat
*CYMD Movel W@dat @CDate

Eval cent = @CC
Eval year = @CY
Eval mont = @CM
Eval day = 01

Now this handles the first day of the next month,
How will i handle the last day of the next month. Any suggestions?

Thanks in advance
Derek

_________________________________________________________________
Who's that on the Red Carpet? Play & win glamorous prizes.

http://club.live.com/red_carpet_reveal.aspx?icid=REDCARPET_hot
mailtextlink3

--
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: 10
date: Tue, 19 Jun 2007 09:50:26 -0400
from: Michael_Schutte@xxxxxxxxxxxx
subject: Re: Last day of the next month

D EndOfMnths S 2 0 DiM(12) CTDATA PERRCD(1)
D CurYear S 4 0
D CurMnth S 2 0
D NextMnthEnd S 2 0

* Check For Leap Year
C Eval CurYear = %SubDT(%Date():*YEARS)
C Eval CurMnth = %SubDT(%Date():*MONTHS)
C If %Rem(CurYear:4) = 0
C Eval EndOfMnths(2) += 1
C EndIf
C Eval NextMnthEnd = EndOfMnths(CurMnth + 1)



** EndOfMnths
31
28
31
30
31
30
31
31
30
31
30
31




Michael Schutte
Admin Professional
Bob Evans Farms, Inc.
What's the secret? Find out at your Bob Evans Restaurant on May 17!


rpg400-l-bounces@xxxxxxxxxxxx wrote on 06/19/2007 09:43:13 AM:


Hi everyone,

What would be the simplest way to find the last day of the
next month?
I have a requirement, wherein i need to update a particular
field with
the
first day of the next
month and another field with the last day of the next month.
I have done this using the following -

@CDate Ds
@CC 1 1 0
@CY 2 3 0
@Str51 4 4 Inz('/')
@CM 5 6 0
@Str52 7 7 Inz('/')
@CD 8 9 0

dW@dat s d



*CYMD Movel @CDate W@dat
AddDur 1:*M W@dat
*CYMD Movel W@dat @CDate

Eval cent = @CC
Eval year = @CY
Eval mont = @CM
Eval day = 01

Now this handles the first day of the next month,
How will i handle the last day of the next month. Any suggestions?

Thanks in advance
Derek

_________________________________________________________________
Who's that on the Red Carpet? Play & win glamorous prizes.

http://club.live.com/red_carpet_reveal.aspx?icid=REDCARPET_hot
mailtextlink3

--
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)
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 6, Issue 631
****************************************



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.