This Question is Possibly Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
33 Replies Last post: Nov 6, 2009 10:35 AM by TommyHolden   1 2 3 Previous Next
Click to view qgenesist's profile   8 posts since
Mar 16, 2009

Mar 16, 2009 6:02 PM

RPG Enhancements


Dear Barbara,

I am sorry I ruined the CAFE announcement (typical programmer I did, and then read the directions)

Regarding my post:

I would like to see a header spec...

H DBGVIEW(*SOURCE:(*STMT:)(*LIST:)(*COPY:)(*ALL:) (*NONE:)) to be ran from the compile, so that you dont have to rely on chgcmddft every version of the os, or where the chgcmddft is not available for security purposes, so that you dont get that problem on a day to day basis, you just copy in your standard headers from copybooks as most of us do....

Now STRDBG PGM(*NONE) is a wonderful default..... DBGVIEW(*NONE) is a heineous default.

while on that subject I would like to see some mechanism that would work for people who do packages that remove source code, but have like the #CVTFN tracepoints and so on like you all do in the OS. That is, a partial debug.

Also, can we start a thread on Bugs(features) we would like to see resolved?


Click to view barbara_morris's profile   96 posts since
Nov 13, 2008
1. Mar 17, 2009 5:42 PM Up Image in response to: qgenesist
Re: RPG Enhancements
About having a DBGVIEW keyword for the H spec, that would be nice. Unfortunately, the debug view processing has already started by the time the compiler reads the H spec keywords.
Click to view barbara_morris's profile   96 posts since
Nov 13, 2008
2. Mar 17, 2009 5:43 PM Up Image in response to: qgenesist
Re: RPG Enhancements
About having a thread for bugs, this forum isn't the right place to report bugs. That should be done through normal service mechanisms.
Click to view JPLamontre's profile   16 posts since
Mar 19, 2009
4. Mar 19, 2009 9:32 AM Up Image in response to: qgenesist
Re: RPG Enhancements

RPG has a pre-pre compiler : when you compile a SQLRPGLE pgm, you can invoke the RPG compiler to resolve /COPY & /INCLUDE before calling the SQL preprocessor

Does this help you in any way ?

I don't think : the DBGVIEW option is attached to the generation of the *MODULE, far before someone think to call the program.

Click to view hasilinz's profile   1 posts since
May 14, 2009
5. Jun 4, 2009 4:35 AM Up Image in response to: qgenesist
Re: RPG Enhancements

use the OPTION(*LSTDBG) on the CRTSQLRPG command

... thanks to bob cozzi ....

Click to view ArthurAdams's profile   10 posts since
Jun 16, 2008
6. Jul 8, 2009 6:55 AM Up Image in response to: qgenesist
Re: RPG Enhancements

I would like to see multiple assignments within the same statement (free format only, of course) so that instead of coding

X=0;
Y=0;
Z=0;

you would code:

X=Y=Z=0;

In a display file program with a subfile and using named indicators, you could have coding that would look like:

SFLDSPCTL=SFLDSP=SFLEND=*off;

I think this is easy to understand, yet would help to keep coding as succint as possible.
Click to view Matt_Tyler's profile   4 posts since
Jul 2, 2009
7. Jul 15, 2009 9:39 AM Up Image in response to: ArthurAdams
Re: RPG Enhancements

On the line multiple assignments, I would also like to see the ability to assign a value to a variable within the call to a program/sub-procedure and continue to use the new variable value after the call. For example, Result = RtvFmtMsg(('USR0022' :(Msgdta = UserName + DeviceID)); This situation I think would require the parameter to be a read only parameter.

Thanks, Matt

Click to view barbara_morris's profile   96 posts since
Nov 13, 2008
8. Jul 17, 2009 10:49 AM Up Image in response to: Matt_Tyler
Re: RPG Enhancements
Matt, about being able to do an assignment as part of passing a parameter, RPG would need a new syntax to distinguish between assignment and comparison for equality. The expression (Msgdta = UserName + DeviceID) is already valid as a comparison expression, with a value of '1' or '0'.

But aside from that ... I'm wondering what would be the benefit of having the assignment inside the call, rather than on a separate statement before the call.
Click to view Matt_Tyler's profile   4 posts since
Jul 2, 2009
9. Jul 17, 2009 11:55 AM Up Image in response to: barbara_morris
Re: RPG Enhancements
Barbara,

I did not truly think about the sample being a comparison evaluation so I can see how the compiler would have a hard time knowing the difference other than the type of parameter the evaluation is being coded for, but then I guess CONST would cause the compiler fits since a logical '1' or '0' can be passed into a character parameter.

I was merely looking for a way to compact code. We use qualified data structures as parameter definitions for prototyped calls inside copy books (that way we do not have to always define parameter fields in programs that use the copy books). Some of these data structure/sub-field names can get long and when there are many parameter (up to 5 or more is what i consider many) the code to load the parameters and then call can make the source expand. The use of a data structure instead of several parameters is not always the best option especially when we want optional parameter passing and cumbersome when used to call CL programs.

So instead of :
Pcr10ec.Subj = *Blanks;
Pcr10ec.Mesg = *Blanks;
Pcr10ec.Email = 'Y';
Pcr10ec.Toaddr = '*USER';
Callp Pcr10ecl(P#Pcr :P#Pcrvsn :Pgmnam :Pcr10ec.Email
:Pcr10ec.Toaddr :Pcr10ec.Subj :Pcr10ec.Mesg);

I was kind of hoping there could be a benefit to code as:
Callp Pcr10ecl(P#Pcr :P#Pcrvsn :Pgmnam :Pcr10ec.Email = 'Y'
:Pcr10ec.Toaddr = '*USER' :Pcr10ec.Mesg = *Blanks :Pcr10ec.Subj = *Blanks);

On CONST parameters we can send in a value like *BLANKS, ' ', %CHAR(%DATE() :*USA) or what ever value that can be typed to a character and not have to load a parameter first then specify that parameter on the call. However, when there is no reference to what the parameter is that is excepting a CONST value like 'Y' all I know is the parameter is going to accept the value Y but I have no clue what if the value will control some logic or just update the database unless I specify the parameter as in the first sample. Now I know I can go reference our copy book, which we have all agreed upon to add sample uses of the call but I do not like having to continually flip back and forth between source or have numerous members open just for look ups.

Anyway, I hope I explained my reason for the inline evaluation on CALLPs.

Thanks, Matt Tyler

Click to view barbara_morris's profile   96 posts since
Nov 13, 2008
10. Jul 17, 2009 2:49 PM Up Image in response to: Matt_Tyler
Re: RPG Enhancements
Matt, I see what you mean. What you proposed would give you a way of self-documenting what the parameter values mean.

I have sometimes wished that RPG's parameters were more like CL commands, where you can name each parameter if you want.
   cpyf f1 f2 a* ...

vs
   cpyf fromfile(f1) tofile(f2) frommbr(a*) ...


I'd rather have RPG support parameter naming, than have it support assignment within the passed parameter. Say the prototyped parameters were called name, addr, city, it would be nice to be able to code like this, and have the compiler verify that if the parameter was named, that the name was correct.
   myproc (name(custname) : addr(custaddr) 
         : city(*blanks));

or maybe some special syntax would have to be used to say that this is a tagged parameter
   myproc (name?custname : addr?custaddr 
        : city?*blanks);
Click to view Matt_Tyler's profile   4 posts since
Jul 2, 2009
11. Jul 17, 2009 3:16 PM Up Image in response to: barbara_morris
Re: RPG Enhancements

Barbara,

Yes, exactly. Now when can you have it in (GRIN)?

I like the bracketing with parentheses better than the question mark.

Thanks, Matt Tyler

Click to view barbara_morris's profile   96 posts since
Nov 13, 2008
12. Jul 17, 2009 3:53 PM Up Image in response to: Matt_Tyler
Re: RPG Enhancements
Matt,

Yep, I prefer the bracketing with parentheses too. The parameter names would have to be different from any prototypes or arrays, but maybe that would be preferable to having some ugly syntax.
Click to view Brian_May's profile   12 posts since
Nov 21, 2008
13. Jul 17, 2009 4:27 PM Up Image in response to: barbara_morris
Re: RPG Enhancements

Barbara,

Perhaps if you used square brackets [] instead of parenthesis () you would not need to worry about name collision with other arrays or prototypes.

Just a thought,

Brian

Click to view barbara_morris's profile   96 posts since
Nov 13, 2008
14. Jul 17, 2009 5:26 PM Up Image in response to: Brian_May
Re: RPG Enhancements
Brian, that would work except that the square brackets are variant characters, and except for @ # and $ (which were grandfathered in), RPG IV doesn't use any variant characters in its syntax.

I think if the square brackets were invariant, they would probably have already been taken for array indexing.
Bottom Banner