I am "bilingual" and was involved in the compiler design for the current RPG and COBOL compilers for the 400. SO I like each for its strengths and work with the compiler folks to suggest places where features of one can be used in the other. The LIKE keyword in COBOL and the new date support in the language being examples of the kind of thing I mean. Other replies below and that's it - as much fun as it is, this wastes too much time. Howard Weatherly <email@example.com> on 12/02/99 10:14:44 AM Please respond to COBOL400-L@midrange.com To: COBOL400-L@midrange.com cc: (bcc: Jon Paris/HAL/IT) Subject: COBOL and RPG was Welcome new members Jon, +-999,999,999,999,999,999 is a rather large number, unless we are talking about how much money the government wastes....:-) File erors are trapped by using Declaratives and yes the declarations can trap or do anything! <<< You mean you know someone who can actually make that feature do something useful! I always code for file status - its far simpler.<<< You certainly can have duplicate names in multiple structures as long as you qualify the name using the structure, the structure can ascend to the file name for file data and to the 1 level for storage data. You can not have duplicate level 77 items, no way to qualify, you can have duplicate 1 levels as long as you provide redefinition (although this is not very useful, there are times when 1 levels are coppied as file records which are qualified to the file). The corresponding is very useful for element extraction when you want to rearrange data without writing a novel, and example is dates (move corr date1 to date2 where date1 is mmddyyyy and date2 is yyyymmdd) or if I dont want replication, (move corr field1 to field2 where field1 has 10 fields A thru J and field 2 has every other of A C E...). <<< I'm very familiar with these features and can't think what I said to prompt this comment. Qualification of reference can be very useful, but the notion that one name = one piece of data is fundamental to the RPG language and cannot easily be changed. When designing RPG IV we looked at a number of ways of bringing this into the langauge while maintaining compatibility but couldn't come up with a good one. Effectively Move Corresponding is a code generating statement and similar syntax should be possible in RPG - maybe one day. Interstingly enough, I was responsible for the addition of the ability to have the COBOL 400 compiler list the fields that "corresponded". Why did we add it? becuase 90% of all the COBOL programmers we talked to did not use Move corresponding because they couldn't work out what did and did not correspond!<<< While I am not sure what you mean by prototyping, I suspect you mean define it once use it everywhere? Yes we can! (copy something replacing X by Y) and for subprocedures? I do not know what you mean here, but whatever it is, it can be done! <<< Prototyping is the ability to define what the parameters and return value on a call should look like. That way the compiler can validate that the call is correct (and in some circumstances can generate temporary fields and move the data to ensure a match. COBOL _cannot_ do this in any dialect I have ever seen. Subprocedures provide an ability to extend the scope of the langauge (much like C functions). If I have a subprocedure that calculates the day of the week given a date then in RPG I can code: Eval DayNumber = DayOfWeek(TheDate). In COBOL this can only be done through CALL 'DayOfWeek" Using TheDate Returning DayNumber. Not quite so elegant is it - and the RPG will validate the parameters the COBOL cannot.<<< Now let me say this about both COBOL and RPG, I like RPG when it is used for reports, that is where it makes the most sense to me, I like the Cycle doing the work and the ease with which reports can be modified. The fact that you may need some calcs does not bother me either, I can also tolerate a forced read now and agian and some file extensions for table processing, but once the line is crossed (and this line is different for everyone) I find that RPG wil lose its ability to be coherent (to me) whereas a well written COBOL program (the key word is "well written") has the ability to allow me to understand the process(s) without being familliar with the system. I can not do that with an RPG program, of course if maybe I used RPG as much as I use COBOL, my tolerance line would shift probably. <<< I can't help feel that you're comparing RPG II with COBOL. I _never_ use the RPG cycle and it is not taught in most of the schools these days. An RPG program written with the same degree of skill as a COBOL one should be every bit as easy to understand<<< Jon.Paris@halinfo.it wrote: > For the most part I agree that there are still a number of features that are > present in COBOL that RPG lacks. As to your individual comments: > > - Indented code > > This is supported to a limited degree in D specs and C specs. There will likely > be full support in C specs in the next RPG release. > > - long field names (and be able to use them in calcs) > > You mean 2056 characters isn't enough <grin>. In practice I find the current > (practical) limit of 14 to be more than adequate. If I recall correctly the > COBOL maximum is 30 but I never used them all. By contrast RPG supports 30 digit > numerics while COBOL's default behavior is still 18. Now that _is_ a limitation > that I have hit. > > - record handling > > Not clear what you mean by this. By using RPGIV's externally described DS > support together with the Prefix keyword I can handle things at the record > level. > > - error trapping in free-format calcs (like EVAL x=y * z ON ERROR do something > else) > > This has been "announced" by IBM in the form of the MONITOR group, which in many > ways is superior to COBOL's On error (which doesn't handle all errors by the > way). They are considering the possibility of allowing this to be more granular > (a la COBOL) but MONITOR is probably better since in general I don't care if a > single statement "blows" I want to know if anything goes wrong in a logically > related group of statements. > > - data replication: move CORR to replicate data to fields of same name in other > records > > There has never been a need for this in absolute terms since you cannot have two > fields of the same name in different structures. I would love to see them do a > similar thing though where the field prefix governed which fields were alike. > > - (and the converse: unlike RPG, dont replicate the data if the programmer > doesnt want to!) > > You can already handle this with Prefix at the file level. > > The one biggie that COBOL is missing for me is prototyping of program calls and > the ability to define subprocedures. These have made a huge difference in my RPG > coding but I can't do it in COBOL. > > +--- > | This is the COBOL/400 Mailing List! > | To submit a new message, send your mail to COBOL400-L@midrange.com. > | To subscribe to this list send email to COBOL400-L-SUB@midrange.com. > | To unsubscribe from this list send email to COBOL400-L-UNSUB@midrange.com. > | Questions should be directed to the list owner/operator: firstname.lastname@example.org > +---END +--- | This is the COBOL/400 Mailing List! | To submit a new message, send your mail to COBOL400-L@midrange.com. | To subscribe to this list send email to COBOL400-L-SUB@midrange.com. | To unsubscribe from this list send email to COBOL400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: email@example.com +---END +--- | This is the COBOL/400 Mailing List! | To submit a new message, send your mail to COBOL400-L@midrange.com. | To subscribe to this list send email to COBOL400-L-SUB@midrange.com. | To unsubscribe from this list send email to COBOL400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: firstname.lastname@example.org +---END
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.