Hello,
IMHO Thomas is absolutely right!
LASO Software GmbH
Bernd Dworrak, Dipl.-Phys.
-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im Auftrag von thomas.raddatz@xxxxxx
Gesendet: Dienstag, 8. Oktober 2013 08:40
An: rpg400-l@xxxxxxxxxxxx
Betreff: Re: Free format H, F, D and P specs
I almost agree with Alan. Although I do not necessarily need a new compiler I think that IBM again missed a good chance to really modernize /free. For example from the day when IBM introduced procedures with V3, I wonder why we have to use P specs to start/end a procedure and D specs for the procedure interface. Using only P specs whould have been a lot easier and clearer (at least for me):
Prototype:
P startsWith...
P P N
P i_prefix 4096A const varying
P i_string 4096A const varying
Implementation:
P startsWith...
P B N export
P i_prefix 4096A const varying
P i_string 4096A const varying
/free
/end-free
P E
I do not believe that having done it this way would have have been much more expensive.
What I want to say is that on my opinion IBM tends to stay to close to the old things. IBM prefers using START/END tags where other languages uses brackets which are often clearer to read. For example:
ctl-opt dftactgrp(*no);
ctl-opt main(main);
dcl-proc main(caller_name char(10) const) {
dcl-c RECORD_LEN 80;
dcl-f qprint printer(RECORD_LEN);
dcl-ds prtDs len(RECORD_LEN) qualified {
*n char(6) inz('Hello'),
name char(50),
};
prtDs.name = transform(caller_name);
write qprint prtDs;
*inlr = '1';
dcl-proc varchar(50) transform(
name varchar(10) const options(*trim)) {
return '*** ' + name + ' ***';
};
Actually there is no need for 'dcl-pi'. There are only procedures and the main procedure is indicated by 'ctl-opt main(main)' or even just by name:
'main'.
I do not know much about building professionell parsers and compilers but I do not think that my example would have been that much expensive.
'dcl-proc' is the same and instead of 'end-proc' the compiler had to look for the closing curly bracket. 'dcl-pi' and 'end-pi' are replaced by brackets, too.
Just my two cents.
Thomas.
PS: Here is what I actually wished to get:
options dftactgrp(*no), main(main);
procedure main(caller_name char(10) const) {
const RECORD_LEN 80;
file qprint printer(RECORD_LEN);
structure prtDs len(RECORD_LEN) qualified {
*n char(6) inz('Hello'),
name char(50),
};
prtDs.name = transform(caller_name);
write qprint prtDs;
*inlr = '1';
procedure varchar(50) transform(
name varchar(10) const options(*trim)) {
return '*** ' + name + ' ***';
};
This is the RPG programming on the IBM i (AS/400 and 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.
--
IMPORTANT NOTICE:
This email is confidential, may be legally privileged, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone else is prohibited and may be a criminal offence. Please delete if obtained in error and email confirmation to the sender.
--
This is the RPG programming on the IBM i (AS/400 and 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.
As an Amazon Associate we earn from qualifying purchases.