Re: language Translater



In pI5xe.81321$gc6.36806@okepread04">news:pI5xe.81321$gc6.36806@okepread04,
Kees Boer <keesboer@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> Hi, Andrew!
>
> No, I don't use COBOL any more, but I kind of liked the language in
> the sense that if you don't mind typing, I liked how it was so easy
> to read and understand what was going on. What I didn't like was all
> the moving and picture statements. Actually, I think my favorite
> language for database processing has got to be the old dBase/FoxPro
> language. I worked with that for 8 or 9 years and got to be very good
> at it and fast.
>
> I could put a system together in 4 hours with menus and everything. I
> still wonder, why it all has got to become so complicated. In dBase
> if you want to open a database file, you would just say: "use
> inventor." There was no connecting and all of the other stuff you had
> to do. With Foxpro, you could use SQL statements, but you were able
> to make them in their query manager and then just copy and paste them
> right into the code. For some reason, it all has gotten a lot more
> complicated. I don't understand, because it was supposed to be gotten
> simpler.

I learnt coding using cobol and pascal, and the dataease dbms which was
pretty lovely to use.

> Oh, well, I'm rambling. It's 2:45 AM here.
>
> Thank you for the code! I appreciate it. How do you do skip to the
> next record and position yourself at the top?

To break out of the current itteration and start the next itteration use
'continue'.

To exit the loop completely use 'break'.

> I need to do that,
> because I need to write a Ctrl-Break type program. If I have gotten
> 32 records processed, I need to start a new webpage.

I'm not exactly sure what you need but:-

// Read all lines in the file into an array, one line per array element.
$lines = file('filename');
// Cycle through the array starting at the first element (first line in the
file)
// $line_num is the current array element/line number.
// $line is the contents of the array element
foreach ($lines as $line_num => $line) {
// Process until 32nd line
if (($line_num + 1) == 32) {

// Exit loop
break;
}
process $line...
}

OR:

$lines = file('filename');
for ($c = 1; $c < count($lines); $c++) {
if ($c == 32) {

break;
}
process $lines[$c]...
}

If you want to start a new table at record 32 try:

$lines = file('filename');
echo "<table>\n";
for ($c = 0; $c < count($lines); $c++) {
echo "<tr><td>".$lines[$c]."</td></tr>\n";
if ($c == 32) {

echo "</table>\n<table>"
}
}

Or every 32nd record:

$lines = file('filename');
echo "<table>\n";
for ($c = 0; $c < count($lines); $c++) {
echo "<tr><td>".$lines[$c]."</td></tr>\n";
// Use modulus to test if current line cleanly divides into 32
// I may have cocked this bit up as I haven't tested any
// of this code, but I'm sure you get the idea.
if (32 % $c) {
echo "</table>\n<table>"
}
}

--
Andrew @ Rockface
np: Blind Willie Johnson - Mother's Children Have A Hard Time
www.rockface-records.co.uk


.



Relevant Pages

  • Re: Java compatibility issues (WAS: MF having issues?)
    ... language it can do most of what C, C++, and Java can do. ... 2002 COBOL standard addresses that, but having a standard is a far ... Some flavours do have libraries. ... On the IBM mainframe we have Language Environment but it does ...
    (comp.lang.cobol)
  • Re: COBOLs Influence on C
    ... Cobol is the only language that has this problem. ... sure that the libraries containing ANYTHING that might be called are on ... And that is one reason why installations have Local Standards... ...
    (comp.lang.cobol)
  • Re: Java is becoming the new Cobol
    ... """If you're a Java developer, now's the time to invest in new ... It is even truer for COBOL developers. ... The question then is: Is Java just another fad language in the range: ... Sometimes it appears they'll use whatever the Fad Language Of The Month Club sent last ...
    (comp.lang.cobol)
  • Re: Wang COBOL alive and well as Wang VS makes a comeback
    ... I fought to the last to keep COBOL at least peripherally in the ... will be the next language du jour... ... This contributes to the stability of programming efforts ... level of COBOL to another can be as big a deal as migrating across platforms ...
    (comp.lang.cobol)
  • Re: Is Cobol Dead? <190937416 5303721544.634709nocannedmeat.casey.obrien.r-gmail.com@news.gigane
    ... Perhaps Anonymous is referring to the "new envelope" which COBOL was never ... complete redevelopment in a new language. ... Ada is one to look at then. ... assuming the programmer bothered to analyse it. ...
    (comp.lang.cobol)