Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

and/or relational checks in cobol 3

Status
Not open for further replies.

leewest

Programmer
Mar 19, 2007
6
US
I have the following COBOL statement.
004250 IF SW-PRINT = 1
AND HLD-REC-TYPE = '5' OR '4' OR '6'
R11725 MOVE PRT-LINE TO HD-LINE
R11725* MOVE STAA-PRT-LINE TO HD-LINE
004270 PERFORM P1000-HEADING
011725 MOVE HD-LINE TO PRT-LINE
R11725* MOVE HD-LINE TO STAA-PRT-LINE
004280 GO TO W0005-CONTINUE.

My understanding is;
If SW-PRINT = 1 the AND statements are checked.
if HOLD-REC-TYPE does not happen to be '5' the checks for '4' and '6' will not be executed because of
not having been enclosed with (). Is this the correct understanding or am I incorrect?
Thanks
 
Steve, that sounds like the COBOL E compiler running under DOS. We were running OS/MFT, which was larger. We may have had only 64K on the smaller machine. I know it did not also have room for HASP, so we had to start a reader, load a job, then when the job was doen, start a writer to print the results. It didn't even have room for the smaller OS reader or writer to be resident. We had two partitions on it. On was dedicated to running a BTAM parts inquiry system with about six terminals.
 
Steve said:
This was my first encounter with COBOL, running on a 360 model 30 with 64k of main
That was what we had running 1401 emulation mode. We had about 3 or 4 dozen machines doing this at an auto manufacturer.

All of our COBOL was being done on model 50 or above, though as I remember, it was possible to take the executable onto a smaller machine.

Tom Morrison
 
Gentlemen, clearly I should have qualified my statement by stating the example as psuedo code. The use of the term "array" was to illustrate a one dimensional data set in storage; 4,5, & 6.

Here is the code that was disassembled.

WORKING-STORAGE SECTION.

01 FILLER VALUE 'WORKING STORAGE STARTS HERE' PIC X(27).

01 FILLER.

05 SW-PRINT PIC 9(01) VALUE 0.
05 HLD-REC-TYPE PIC X(02) VALUE SPACE.

05 PRT-LINE VALUE 'PRINT LINE' PIC X(10).
05 HD-LINE PIC X(10) VALUE SPACE.

PROCEDURE DIVISION.

IF SW-PRINT = 1
AND (HLD-REC-TYPE = '5' OR '4' OR '6')
MOVE PRT-LINE TO HD-LINE
END-IF.
GOBACK.

*******************************************************

There is only one test because the purpose was to show the constants in storage.
 
jibdsnet: It is still not an array. It looks lilke a duck but doesn't walk like a duck or quack like a duck. There is no pointer to an array and consequently no pointer arithmetic. The literals are "5 ", "4 " and "6 ", in the reverse order they were listed in the source code. Also, the code is optimized, as the one-byte literals in the source are expanded to two bytes in the machine code to match the two-byte definition of HLD-REC-TYPE, and the comparison to SW-PRINT with a CLI as opposed to a CLC. And I wondered what the 10-byte MVC was for, now I see.

Had the definition of HLD-REC-TYPE been X(01), the references to it would also be CLI's with no constants in the literal pool, eliminating all semblance to an array.
 
Also, you still have not given any evidence to support your assertion that
IF SW-PRINT = 1
AND HLD-REC-TYPE = "5" OR "4" OR "6"
DO SOMETHING
END-IF.

Is equivalent to the statement:

IF SW-PRINT = 1 AND HLD-REC-TYPE = "5"
DO SOMETHING
END-IF.
 
Webrabbit,

Correct on both counts; it was known as the "E" compiler, and I believe it was DOS release 23 for that systems final years.

Tom,

That compiler did run on the mod 30, and we had an "F" compiler that ran as well, that is "F" being Full American National Standard COBOL, although it was not a fully functioning implementation, and the mod 30 was run as a pure batch machine with only the background partition active.


Steve
 
Grace Hopper is still well represented!
usshopr2.gif

The guided missile destroyer Hopper (DDG 70)​

Don't Mess with COBOL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top