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


  • Subject: Re: Odp: RE: Is this the Free-Format that we asked for?
  • From: Jim Langston <jimlangston@xxxxxxxxxxxxxxxx>
  • Date: Fri, 03 Nov 2000 09:02:30 -0800
  • Organization: Pacer International

Okay, you need to realize, the statements are:

if (condition) (statement);
else (statement) ;

The true statements on one line are:

if some_condition statement1;
else statement2;

in C format.

The way it is broken up is done by programers to make it more legible, which is
why you see:

if some_condition
   statement1;
else
   statement2;

That is actually 2 statements on 4 lines.

It all depends on what the if structure will be in RPG.  Most likely
if (condition);
  (statement);
      .
      .
      .
endif;

in which case, yes, it would be coded as

if some_condition;
   statement1;
else;
   statement2;
endif;

C gets around only being able to have one statement per if statement with
the fact that many statements enclosed in brackets { } are considered one
statement.

So it could be coded as (in C):

if some_condition 
  {
  statement1;
  statement1a;
  statement1b;
  }
else
  {
  statement2;
  statement2b;
  }

C uses brackets { }, RPG uses EndXX's

Regards,

Jim Langston

Marcin Sagan wrote:
> 
> >>> "Stone, Brad V (TC)" <bvstone@taylorcorp.com> 11/02 4:00  >>>
> >>>How about use a semicolon if you have more than one instruction on a line.
> >>>Otherwise you don't need it..<<<
> 
> That's my point.
> 
> Marcin Sagan
> 
> >>> "Janell Haskins" <jhaskins@KNITRITE.COM> 11/02 7:54  >>>
> >>>  if some_condition;
> >>>    statement1;
> >>>  else;
> >>>    statement2;
> >>>  endif;
> >>> I have no problems with the semicolons at the end of the 2nd, 4th, and 5th
> >>> lines, but my experience with C, Pascal, and Java tells me that the
> >>> semicolons at the end of the 1st and 3rd lines just DON'T LOOK RIGHT.
> 
> Agreed. Really, if we have to have semicolons lets do it like we are use to 
>in other languages.
> My 0.02
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                          !
>    !
> 
> +---
> | 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 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.