|
John, there is actually a reason for the semi colon. You can continue
statements in C/Java/Pascal on as many lines as you want and the compiler
doesn't care, because it knows that the end of the statement is the ;
In RPG we can do this with the Eval statement, but we can do it because
the compiler knows if there are statements without an OP code it must be
a continuation of an Eval statement.
If (Not %EOF) And (Continue) And
(CusNum = ThisCus) And (CompNo = ThisComp);
/copy something
EndIf;
And as for the GOTO statement, I do not use it. Ever. Period.
Regards,
Jim Langston
John Taylor wrote:
>
> Folks,
>
> News/400 is hosting a feedback forum related to the new enhancements within
> the upcoming release of RPG 5. The forum is sponsored by IBM, and includes
> the participation of both Barbara, and Hans.
>
> As most of you are aware, the biggest enhancement to the new release is the
> free-format "CF-spec" that has been discussed at length on this list. Here
> is an example, straight from an article written by George Farr, of how we
> would code the new free-format statements:
>
> /free
>
> Read(n) MASTER;
> If (not %EOF);
> /copy something
> For i = 0 to num;
> x = y(i);
> EndFor;
> EndIf;
>
> /endfree;
>
> I'd like you to take notice of the semi-colon at the end of each statement.
> According to the new rules, each program statement MUST terminate with a
> semi-colon - ala C/Java.
>
> The only reason that Java required this at all is because it was designed to
> closely resemble C syntax, in order to facilitate adoption of the language
> by existing C programmers. Why C had it in the first place is beyond me. But
> now we're being shackled with the same superfluous baggage.
>
> There is no shortage of free-format languages that have managed to do the
> job without requiring the programmer to type an explicit end of statement
> character. Why does RPG need one? Think about this folks. EVERY SINGLE LINE
> of code needs the new terminator. How many extra keystrokes will that amount
> to in a given day of coding? And what is it gaining you? NOTHING!
>
> One other point that should be brought to your attention is the elimination
> of the GOTO statement from the free-format specifications. How many of you
> have code that looks like this:
>
> P DataOk B
> PI N
>
> * Clear error conditions
> C Clear GlobalErrStruct
>
> * Perform an edit
> C If Not SomeCondition
> C Eval MsgID = 'ERR1000'
> C Eval MsgData = 'MyDiagData'
> C Eval CursorOnField1= *On
> C Goto Proc_Error
> C Endif
>
> * Perform a bunch of other edits
>
> * Clean up & Exit
> C Return *On
>
> * Errors found
> C Proc_Error Tag
> C Eval GenErrorID = *On
> C CallP SndDiagMsg( MsgID: MsgData: '*CALLER')
> C Return *Off
>
> P DataOk E
>
> Granted, it's not the only way to accomplish the goal, but (IMO) it is clean
> and simple. You may choose to do it using nested IF's, or one big SELECT, or
> a handful of other ways. But the point is that you have a choice. Now, IBM
> has decided to take away one of our choices in the matter.
>
> If any of you have an opinion with respect to either of these limitations, I
> urge you to speak up now. Once released, the chances of us getting this
> changed will be slim for the GOTO, and absolutely NONE for the statement
> terminator.
>
> Ideally, you can participate in the feedback forum at www.as400network.com
> to share your opinions. If you can't do that, then please share them on this
> list; since we know that Hans & Barbara monitor it.
>
> Regards,
>
> John Taylor
> Canada
>
> +---
> | This is the RPG/400 Mailing List!
> | To submit a new message, send your mail to RPG400-L@midrange.com.
> | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
> | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator: david@midrange.com
> +---
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.