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



Not what I mean, PHP isn't a utility, C# isn't a utility, python isn't a
utility, all support the HereDoc concept. It would be nice if RPG
supported it as well. If you look closely at my initial suggestion, you
may notice that the syntax is surprisingly like free form RPG4, in fact
the first example is free form RPG4. I am speaking of being able to code
the HereDoc directly in the RPG code.

Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx



From: Dennis <iseries@xxxxxxxxxxxx>
To: RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
Date: 01/20/2011 11:43 AM
Subject: Re: HereDoc
Sent by: rpg400-l-bounces@xxxxxxxxxxxx



It does (my prior point) - in the same manner as those other utilities
that you refer to as languages.

Where it is lacking is not RPG, but the interactive interface from which
your program is called.

Example HEREDOC from a shell script:

mypgm <<EOF
this is data
this is more data
EOF

mypgm could be a program in any language, and it would see the data as
stdin.

If that is not what you meant, please elaborate.

"Mark Murphy/STAR BASE Consulting Inc." <mmurphy@xxxxxxxxxxxxxxx> wrote:

Many languages do. Wouldn't it be nice if RPG did?

Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx



From: Dennis <iseries@xxxxxxxxxxxx>
To: RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
Date: 01/20/2011 10:33 AM
Subject: Re: HereDoc
Sent by: rpg400-l-bounces@xxxxxxxxxxxx



CL has had the equivalent of Here docs since S/38 CPF R1 circa 1977.

See //DATA in the CL reference manual.

"Mark Murphy/STAR BASE Consulting Inc." <mmurphy@xxxxxxxxxxxxxxx>
wrote:

Some time ago I learned PHP, and was introduced to a concept called
HereDoc. Essentially a way to insert a string inline. Didn't really
see
the use of it, and never really thought about it much until now. I
have a
piece of code where it would be highly useful for improving the
readability of my program. Unfortunately The use is in an RPG
program,
and the feature does not exist there.

Anyway here is what I was thinking. I am using dynamic SQL in a
particular program (so that I can use set schema to direct unqualified

references to the environment of my choice). Some of the SQL commands
are
quite complex, and I have to double quotes in my string literals. the

whole thing degenerates into a bunch of extra quotes and continuation
marks that would not be necessary with a HereDoc.

Consider the following (very simple, but serves to make the point):

updateStmt =
'Update MCPSRV Set SESCLS=''O'', ' +
' semdat = Date_As_Cymd(Current_Date), ' +
' semtim = time_As_Hms(Current_Time), seuser = user, ' +
' sempgm = ''SQL'' ' +
'Where SEICD9=''V2020Z''';

With a HereDoc I could write something like:

updateStmt = <<<DOC
Update MCPSRV Set SESCLS='O',
semdat = Date_As_Cymd(Current_Date),
semtim = time_As_Hms(Current_Time), seuser = user,
sempgm = 'SQL'
Where SEICD9='V2020Z'
<<<DOC

Even with a simple example the lack of superfluous quotes and
continuation
marks makes the second far more readable than the first.

Any thoughts?

Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx
--
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: 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.

--

Sent from my Android phone with K-9 Mail. Please excuse my brevity.
--

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: 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 IBM i / System i (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 thread ...

Follow-Ups:
Replies:

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.