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



As time goes by, I am certainly seeing the advantage of using sql to
access files, especially for search and display.

In an rpg program, what is a good way to use a sql defined file for
setll/read access?

Jim Horn

____________________________________________________
-----rpg400-l-bounces@xxxxxxxxxxxx wrote: -----

To: rpg400-l@xxxxxxxxxxxx
From: rpg400-l-request@xxxxxxxxxxxx
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
Date: 03/20/2009 03:33AM
Subject: RPG400-L Digest, Vol 8, Issue 211

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

To subscribe or unsubscribe via the World Wide Web, visit
[1]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: Weird problem with times. (Scott Klement)
2. miseries IFS authority (Butala, Nilesh)
3. Re: More, Re: Weird problem with times. (James H. H. Lampert)
4. Hallelujah and hosanna, Re: Erratic behavior in trigger
program, since unscheduled shutdown last night. (James H. H.
Lampert)
5. Re: Indicator name (Barbara Morris)
6. Re: Indicator name (Chamara Withanachchi)
7. RE: Less RPG in our shop (David FOXWELL)

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

message: 1
date: Thu, 19 Mar 2009 15:51:21 -0500
from: Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>
subject: Re: Weird problem with times.

hi James,

I'm very sorry. We all learn our lessons in life, we all make mistakes
and put bugs into production. In this case, it was my fault, though I
didn't put this code into production, I did publish it which amounts to
the same thing.

It has at least two bugs that I can point out:

>> D CEEUTCO PR opdesc
>> D Hours 10I 0
>> D Minutes 10I 0
>> D Seconds 8F

This prototype is missing the "fc" parameter (the same one you see on
the CEEDATM and CEELOCT APIs). That parameter is REQUIRED, and leaving
it off will cause memory corruption.

Granted, it might be unused memory and therefore go unnoticed. (And
this will be the most common result) But, it might also be used memory
and therefore cause "unpredictable results". (Which, I suspect, is the
cause of your woes)

D CEEUTCO PR opdesc
D Hours 10I 0
D Minutes 10I 0
D Seconds 8F
D fc 12a options(*omit)

When the routine is called, the extra parameter should be specified as
*OMIT.

C CALLP CEEUTCO(hours: mins: junk1: *omit)

Next problem... the CEEDATM API will return the date/time string in
the national language of the user who's running the program. However,
the Internet E-mail standard does not allow this. The date time string
is supposed to be standardized on English. Otherwise, E-mail clients
have to be written to interpret dates in every conceivable language --
which isn't practical. The internal format inside the messages should
always be English, and the mail client can interpret it and convert it
to the reader's native language before displaying it to them.

>> C CALLP CEEDATM(CurTime: rfc2822: Temp: *omit)
>> C RETURN Temp + ' ' + tz

I wrote an updated version of this routine, as follows (it has received
only light testing so far, though)

*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* SMTP_getTime(): Get the current date/time from the
* system clock, formatting in SMTP fashion
*
* For example: 'Mon, 15 Aug 2006 14:30:06 -0500'
*
* returns the date/time string.
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P SMTP_getTime B export
D SMTP_getTime PI 31A

D CEEUTCO PR opdesc
D Hours 10I 0
D Minutes 10I 0
D Seconds 8F
D fc 12A options(*omit)

D SUNDAY C d'1899-12-31'

D junk1 s 8F
D hours s 10I 0
D mins s 10I 0
D tz_hours s 2P 0
D tz_mins s 2P 0
D tz s 5A varying

D CurTS s Z
D CurTime s 8a varying
D CurDay s 2p 0
D CurYear s 4p 0
D CurMM s 2p 0
D CurMonth s 3a varying
D TempDOW s 10i 0
D CurDOW s 3a varying

D DateString s 31a

/free

//
// Calculate the Timezone in format '+0000', for example
// CST should show up as '-0600'
//

CEEUTCO(hours: mins: junk1: *omit);
tz_hours = %abs(hours);
tz_mins = mins;

if (hours < 0);
tz = '-';
else;
tz = '+';
endif;

tz += %editc(tz_hours:'X') + %editc(tz_mins:'X');

//
// Get the current time and convert it to the format
// specified for e-mail in RFC 2822
//

CurTS = %timestamp();

CurTime = %char(%time(CurTS): *HMS:);

CurDay = %subdt(CurTS: *DAYS);
CurYear = %subdt(CurTS: *YEARS);
CurMM = %subdt(CurTS: *MONTHS);

select;
when CurMM = 1;
CurMonth = 'Jan';
when CurMM = 2;
CurMonth = 'Feb';
when CurMM = 3;
CurMonth = 'Mar';
when CurMM = 4;
CurMonth = 'Apr';
when CurMM = 5;
CurMonth = 'May';
when CurMM = 6;
CurMonth = 'Jun';
when CurMM = 7;
CurMonth = 'Jul';
when CurMM = 8;
CurMonth = 'Aug';
when CurMM = 9;
CurMonth = 'Sep';
when CurMM = 10;
CurMonth = 'Oct';
when CurMM = 11;
CurMonth = 'Nov';
when CurMM = 12;
CurMonth = 'Dec';
endsl;

TempDOW = %diff( %date(CurTS) : SUNDAY : *DAYS );
TempDOW = %rem( TempDOW : 7 );

Select;
when TempDOW = 0;
CurDOW = 'Sun';
when TempDOW = 1;
CurDOW = 'Mon';
when TempDOW = 2;
CurDOW = 'Tue';
when TempDOW = 3;
CurDOW = 'Wed';
when TempDOW = 4;
CurDOW = 'Thu';
when TempDOW = 5;
CurDOW = 'Fri';
when TempDOW = 6;
CurDOW = 'Sat';
endsl;

DateString = CurDOW + ', '
+ %editc( CurDay: 'X' ) + ' '
+ CurMonth + ' '
+ %editc( CurYear: 'X' ) + ' '
+ CurTime + ' '
+ tz;

return DateString;

/end-free
P E

Hope that helps...

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

message: 2
date: Thu, 19 Mar 2009 16:08:37 -0500
from: "Butala, Nilesh" <NButala@xxxxxxxxxxxxxxx>
subject: miseries IFS authority

We having problem setting up authority for ifs subfolder on iSeries.

We have,
/JE_upload folder at root level.
Authority at root level folder is as follows

Data --Object Authorities--
Opt User Authority Exist Mgt Alter Ref

*PUBLIC *RWX X X X X
QSECOFR *RWX X X X X
QDIRSRV *X



Data -------------Data Authorities-------------

Opt User Authority Objopr Read Add Update Delete Execute



*PUBLIC *RWX X X X X X X

QSECOFR *RWX X X X X X X

QDIRSRV *X X X




Now we don't want Canada user to see USA folder and USA user to Canada
folder. So we setup authority for both the folder

Under JE_upload folder we have subfolder
/Canada
Data --Object Authorities--

Opt User Authority Exist Mgt Alter Ref



JEUPLD_CAN *RWX X

Opt User Authority Objopr Read Add Update Delete Execute



JEUPLD_CAN *RWX X X X X X X


/USA
Data --Object Authorities--

Opt User Authority Exist Mgt Alter Ref



QDIRSRV *X

TAYLORDA *RWX

VRANESAC *RWX

Data -------------Data Authorities-------------

Opt User Authority Objopr Read Add Update Delete Execute



QDIRSRV *X X X

TAYLORDA *RWX X X X X X X

VRANESAC *RWX X X X X X X

The issue we are having is if VRANESAC want to move (CUT) all the files
from /JE_upload/USA folder to her PC folder (paste), system is copying
the file to her PC folder but not deleting the file from /JE_UPLOAD/USA
folder. We found that user TAYLORDA has created file in the same folder
and VARNESAC don't have authority to delete his files.

How can we setup authority so that user who has access to /JE_upload/USA
folder can do cut and past or delete each others files.

Thanks

Nilesh

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

message: 3
date: Thu, 19 Mar 2009 14:40:44 -0700
from: "James H. H. Lampert" <jamesl@xxxxxxxxxxxxxxxxx>
subject: Re: More, Re: Weird problem with times.

Correction to earlier information:

It seems that when I removed and reestablished the trigger, the place
where the CPF1850 occurs DOES move. So to speak.

After IPL, the exception is thrown by the first TIME statement following
a call to the published MailDate procedure. (Incidentally, the MailDate
procedure is in the same module.)

But after removing and reestablishing the trigger, it's thrown by the
first TIME statement encountered, period.

Also, there's a pattern to where it reports itself as occurring:

Consider:

Procedures FOO and BOZ both call procedure BAR. The TIME statement is in
BAR.

In both instances, the error actually occurs in BAR, called by FOO, but
in the first instance, the joblog shows a CPF1850 being thrown from
QWCCVTDT to QRNXUTIL, immediately followed by an RNQ0202 claiming that
"the call to FOO ended in error," while in the second instance, the
CPF1850 is immediately followed by an RNQ0202 claiming that "the call to
BAR ended in error."

None of the intervening calls are reported, and the only statement
number reported in my code is the call to FOO or to BOZ.

Sharon: Thanks for the suggestion, but even saving *and restoring* the
entire library seems to have made no difference.

And Scott, your apology is unnecessary, but accepted gratefully. I
already added the FC parameter, as per Bruce Vining's message on the
sister thread on the MIDRANGE list. No joy, as you might imagine from
the above discovery.

--
JHHL

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

message: 4
date: Thu, 19 Mar 2009 15:45:04 -0700
from: "James H. H. Lampert" <jamesl@xxxxxxxxxxxxxxxxx>
subject: Hallelujah and hosanna, Re: Erratic behavior in trigger
program, since unscheduled shutdown last night.

Elvis Budimlic wrote:
> - Have you signed off/signed back on since you've recompiled your
trigger
> program? Perhaps DB is working with the copy out of QRPLOBJ.

I just did that, right before reading your message.

I tried recompiling the trigger program with a TIME statement positioned
to be executed immediately. And it threw the CPF1850 immediately. With a
structurally-identical file in a completely different library.

Then I tried reworking the test program as a rudimentary trigger, but
before recompiling it, I executed it once again from the command line.
Wonder of wonders, it was throwing the exception, where before, it had
steadfastly refused to do so. So I didn't bother recompiling that one.

So I thought, well, maybe there's something in the job that was
corrupted by whatever was causing the exception in the first place
(whether it was Elvis's need for an extra character on the receiver, or
the inherited coding error Bruce spotted), that would be reset if I
signed off and signed back on.

So I signed off and back on. The test program was back to steadfastly
refusing to throw the exception. Tripping the trigger in the alternate
library also refused to throw the exception. So I reapplied the trigger
to the file where the problem had first shown up (I'd had to remove it
because somebody else needed the file), and tripped it there.

STILL DIDN'T THROW THE EXCEPTION! BY GOLLY *SOMETHING* MUST HAVE WORKED
AFTER ALL!

Since I have no way of knowing whose suggestion(s) solved the problem,
I'd like to thank EVERYBODY who responded.

Somehow, the prospect of trying to get technical support for a V4R4 box,
or having to bump it up a whole bunch of release levels at once if the
OS was screwed up and we couldn't find anybody willing and able to help
us unscrew it, didn't exactly appeal to me.

--
JHHL

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

message: 5
date: Thu, 19 Mar 2009 19:27:54 -0400
from: Barbara Morris <bmorris@xxxxxxxxxx>
subject: Re: Indicator name

Craig Jacobsen wrote:
> I'm writing a program (green screen) that uses a write and read
with a
> data structure name to the workstation.
> Actually I'm trying to write this program as a skeleton program for
the rest
> of the programmers on staff.
> I am using Eval-Corr to move data back and forth from input, output,
and
> disk (using likerec).
> Is there a way to rename an indicator in the output buffer?
> Right now, I have to Out02.in33 = *On; to protect a screen field on
add (33
> protect n33 underline in dds).
> I would like to use a named indicator like ProtectStatus.
>

Craig, if you change to use an externally-described DS instead of using
LIKEREC, you can rename the indicator subfields.

D outDs E ds extname(myfile:myrec:*output)
D qualified
D ProtectStatus...
D E extfld(*in33)

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

message: 6
date: Fri, 20 Mar 2009 05:46:57 +0000
from: "Chamara Withanachchi" <chamaraw@xxxxxxxxxx>
subject: Re: Indicator name

Check www.rpgiv.info - rpg tips page.

Regards,

Chamara Withanachchi
IBM Certified Power System Expert
RPG Programmer
(owner of www.rpgiv.info)

WWW.RPGIV.INFO
Mob: +971 50 5698644
Tel: +971 6 5595887
chamaraw@xxxxxxxxxx
www.rpgiv.info
i want to be future ready. i want control. i want an i.

Sent from my BlackBerry? wireless device

-----Original Message-----
From: "Craig Jacobsen" <CraigJacobsen@xxxxxxxxxxx>

Date: Thu, 19 Mar 2009 12:50:28
To: 'RPG programming on the IBM i / System i'<rpg400-l@xxxxxxxxxxxx>
Subject: Indicator name

I'm writing a program (green screen) that uses a write and read with
a
data structure name to the workstation.
Actually I'm trying to write this program as a skeleton program for the
rest
of the programmers on staff.
I am using Eval-Corr to move data back and forth from input, output, and
disk (using likerec).
Is there a way to rename an indicator in the output buffer?
Right now, I have to Out02.in33 = *On; to protect a screen field on add
(33
protect n33 underline in dds).
I would like to use a named indicator like ProtectStatus.

Any suggestions?

Thanks in advance,

Craig


--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: [2]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 [3]http://archive.midrange.com/rpg400-l.

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

message: 7
date: Fri, 20 Mar 2009 09:12:52 +0100
from: David FOXWELL <David.FOXWELL@xxxxxxxxx>
subject: RE: Less RPG in our shop

I realise that I would not have had a problem if the program responsable
for the display was also in RPG. The problem I have with the XSL is that
some of the business programming is taking place within it. For
instance, the XSL needs to compare database fields that have been
written into XML documents using the same constants that are declared
throughout our RPG programs.

For example, a page header that is formatted depending on the client
type.
In RPG we might have in a copybook

D gCLIENT_TYPE_ONE C CONST('X001')

And in XSL I see something like <xsl:if test
select="$myVariable='X001'">

We are actually generating pdf files using XSL in conjunction with fo.
Would there be a solution in RPG for this ?

Thanks

-----Message d'origine-----
De : rpg400-l-bounces@xxxxxxxxxxxx
[[4]mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de Adam Glauser
Envoy? : mercredi 18 mars 2009 18:34
? : rpg400-l@xxxxxxxxxxxx
Objet : Re: Less RPG in our shop

> On 18/03/2009, at 11:35 PM, David FOXWELL wrote:
>> I wrote a post recently where I mentioned that I was using XSL in
>> conjunction with XML documents created by RPG programs.
>>
>> I am worried when I see the amount of programming in the XSL files
>> that is effectively taken out of the RPG program.
>> I would like your opinions on this subject. Am I wrong to say that
>> the RPG program should do as much of the processing as possible?

Simon Coulter wrote:
> Ask yourself this: If you were using RPG and display files would you
> do the editing of dates or numeric values in the RPG or in the DDS?
> It's the same here. Separation of duties is always a good thing--let
> the presentation manager handle presenting the data according to how
> the user wants to see it. This is really just another form of MVC. Who
> is responsible for editing data? The Model, the View, or the
Controller?

I agree with Simon on this point, but I think it's worth noting that you
could still have an all-RPG solution as well as keeping a nice modular
design.

You could have an RPG program that reads the XML and produces HTML, as
well as another RPG program that reads the XML and writes it to a
display file.

Essentially it comes down to the question of using the right tool for
the job. If XSL has advantages in such as speed of development,
maintainability or flexibility, then you need to decide whether those
advantages justify the added cost of learning the new language and/or
having it as a hiring requirement.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: [5]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
[6]http://archive.midrange.com/rpg400-l.

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

--
This is the RPG programming on the IBM i / System i (RPG400-L) digest
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: [7]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 [8]http://archive.midrange.com/rpg400-l.

End of RPG400-L Digest, Vol 8, Issue 211
****************************************

This email is intended only for the person or entity
to which it is addressed and may contain information
that is privileged, confidential or otherwise protected
from disclosure. If you are not the named addressee
or an employee or agent responsible for delivering
this message to the named addressee, you are not
authorized to read, print, retain copy, and disseminate
this message or any part of it. If you have received this
message in error please notify us immediately by email,
discard any paper copies and delete all electronic files
of this message.

References

Visible links
1. http://lists.midrange.com/mailman/listinfo/rpg400-l
2. http://lists.midrange.com/mailman/listinfo/rpg400-l
3. http://archive.midrange.com/rpg400-l
4. mailto:rpg400-l-bounces@xxxxxxxxxxxx
5. http://lists.midrange.com/mailman/listinfo/rpg400-l
6. http://archive.midrange.com/rpg400-l
7. http://lists.midrange.com/mailman/listinfo/rpg400-l
8. http://archive.midrange.com/rpg400-l

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.