Sei sulla pagina 1di 2

COBOL Points

There is one more section apart from WORKING-STORAGE SECTION & LINKAGE i.e. LOCALSTORAGE SECTION.
IF ITEM = A DISPLAY VALUE OF ITEM IS ITEM ADD 1 TO TOTAL. MOVE C TO ITEM DISPLAY VALUE OF ITEM IS NOW ITEM IF ITEM = B ADD 2 TO TOTAL.

The MOVE statement and the DISPLAY statement after it are performed regardless of the value of ITEM, despite what the indentation indicates, because the first period terminates the IF statement. COMP , COMP-4 and binary are synonymous. o 1 4 : 2 Bytes o 5 - 9 : 4 Bytes o 10-18 : 8 Bytes Cannot use VALUE clause with edited pic. You can code the EVALUATE statement to handle the case where multiple conditions lead to the same processing by using the THRU phrase and by using multiple WHEN statements.
EVALUATE MARITAL-CODE WHEN M ADD 2 TO PEOPLE-COUNT WHEN S WHEN D WHEN W ADD 1 TO PEOPLE-COUNT END-EVALUATE

Above code is same as THRU , they are all in OR .


Evaluate True Also True When Age < 13 Also Sex = M Move Young Boy To Description When Age < 13 Also Sex = F Move Young Girl To Description When Age > 12 And Age < 20 Also Sex = M Move Teenage Boy To Description When Age > 12 And Age < 20 Also Sex = F Move Teenage Girl To Description When Age > 19 Also Sex = M Move Adult Man To Description When Age > 19 Also Sex = F Move Adult Woman To Description When Other Move Invalid Data To Description End-Evaluate

Here both should be satisfied. Error code = 39 if mismatch between JCL file attribute and FD section . Generally sequential access is more efficient than random

Put a D in column 7 of each DISPLAY statement to convert it to a comment line. When you want to reactivate these statements, include a WITH DEBUGGING MODE clause in the ENVIRONMENT DIVISION; the D in column 7 is ignored and the DISPLAY statements are implemented. Compiler Options : Syntax errors such as duplicate data names (NOCOMPILE) Missing sections (SEQUENCE) Invalid subscript values (SSRANGE) Index has to be updated when adding record in indexed file and one or more index has to be read thats why sequential file is better than indexed If a file is opened for dynamic access , you must include the NEXT on the Read statement to access the records sequentially . If not , random access is assumed . In relative file sequential read , then the program must skip these empty areas and it happens automatically. Common type completion codes : o 0C1 : Operation exception ,reading or writing to an closed file o 0C4 : Protection Exception , invalid index or subscript o 0C5 : Addressing Exception , wrong address reference , main storage that isnt available o 0C7 : Data Exception , Numeric field has invalid data o 0CA : Decimal Overflow Exception o 0CB : Decimal divide exception , divide by zero

Potrebbero piacerti anche