0% found this document useful (0 votes)
77 views4 pages

Cob Questions

The NUMBER compiler option controls whether line numbers in source code are used in error messages and listings. If NUMBER is specified, line numbers must be numeric and in sequence. Out-of-sequence numbers will be reassigned with asterisks. When using COPY statements and NUMBER, source and copybook line numbers must be coordinated. With NUMBER and LIB, all programs in a batch compile are treated as a single file with line numbers in sequence.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views4 pages

Cob Questions

The NUMBER compiler option controls whether line numbers in source code are used in error messages and listings. If NUMBER is specified, line numbers must be numeric and in sequence. Out-of-sequence numbers will be reassigned with asterisks. When using COPY statements and NUMBER, source and copybook line numbers must be coordinated. With NUMBER and LIB, all programs in a batch compile are treated as a single file with line numbers in sequence.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

2.4.

34 NUMBER

Use the NUMBER compiler option if you have line numbers in your source code and
want those numbers to be used in error messages and SOURCE, MAP, LIST, and XREF
listings.

Click here to display pages in Accessible mode

+--- NUMBER option syntax -----------------------------------------------+


� �
� +-NONUMBER-+ �
� >>--+----------+---------------------------------------------------->< �
� +-NUMBER---+ �
� �
+------------------------------------------------------------------------+

Default is: NONUMBER

Abbreviations are: NUM|NONUM

If you request NUMBER, the compiler checks columns 1 through 6 to make sure that
they contain only numbers and that the numbers are in numeric collating sequence.
(In contrast, SEQUENCE checks the characters in these columns according to EBCDIC
collating sequence.) When a line number is found to be out of sequence, the
compiler assigns to it a line number with a value one higher than the line number
of the preceding statement. The compiler flags the new value with two asterisks and
includes in the listing a message indicating an out-of-sequence error. Sequence-
checking continues with the next statement, based on the newly assigned value of
the previous line.

If you use COPY statements and NUMBER is in effect, be sure that your source
program line numbers and the copybook line numbers are coordinated.

If you are doing a batch compilation and LIB and NUMBER are in effect, all programs
in the batch compile will be treated as a single input file. The sequence numbers
of the entire input file must be in ascending order.

Use NONUMBER if you do not have line numbers in your source code, or if you want
the compiler to ignore the line numbers you do have in your source code. With
NONUMBER in effect, the compiler generates line numbers for your source statements
and uses those numbers as references in listings.

---

Re: Difference in days between two dates(mmddyy).

by gugul � Thu Jan 13, 2011 8:37 pm

You can use DB2

set :ws-days = DAYS(DATE('2011-12-31')) - DAYS(DATE('2011-01-13'))

also use function integer-of-date or integer-of-month to extract the exact date or


month and then subtract the dates/add months.

------
MAIN-PARA.
COMPUTE OUTPUT1 = FUNCTION INTEGER-OF-DATE(DATE-TIME)
DISPLAY OUTPUT1.
STOP RUN.

argument-1
Must be an integer of the form YYYYMMDD, whose value is obtained from the
calculation (YYYY * 10,000) + (MM * 100) + DD, where:

* YYYY represents the year in the Gregorian calendar. It must be an integer


greater than 1600, but not greater than 9999.

* MM represents a month and must be a positive integer less than 13.

* DD represents a day and must be a positive integer less than 32, provided that
it is valid for the specified month and year combination.

Are you aware that "integer" in the context of the manual quote means a PIC 9(08)
variable? Using a group level as you are doing is not allowed -- hence the compile
error. Either use a REDEFINES or MOVE the group level variable to an elementary
variable.

have the date-time in 01 level elementary

---

how to get only chars from i-n-d-i-a

01 Y PIC S9(04) COMP VALUE 1.


PROCEDURE DIVISION.
MAIN-PARA.
PERFORM VARYING X FROM 1 BY 1
UNTIL X > LENGTH OF WS-WORKING-VAR
IF WS-WORKING-VAR (X : 1) ALPHABETIC
MOVE WS-WORKING-VAR (X : 1) TO WS-FINAL-VAR (Y : 1)
ADD 1 TO Y
END-IF
END-IF

---

file status 44 :
Quote:
| | | 4 | A boundary violation exists because an attempt was made to rewrite a |
| | | | record to a file and the record was not the same size as the record being |

| | | | replaced. Or an attempt was made to write or rewrite a record that was |


| | | | larger than the largest or smaller than the smallest record allowed by |
| | | | the RECORD IS VARYING clause of the associated file-name.

---

The EXIT statement leaves files open in memory. The CANCEL statement closes the
files and releases the memory that the canceled program occupies,

The mode of a CALL statement (static or dynamic) is controlled by the


compiler option DYNAM and by form of the CALL statement i.e., whether the
subprogram to be called is specified through an identifier or through a literal.
for eg:
form of call mode
------------ ----
CALL identifier (dynam or nodynam) always dynamic
CALL literal with dynam dynamic
CALL literal with NODYNAM static
illustrations:
1. pgm compiled with DYNAM option AND having statement
CALL 'PGMA' using WS-AREA - dynamic call
2. pgm compiled with DYNAM option and having statement
MOVE 'PGMA' to WS-PGM
CALL WS-PGM using WS-AREA - dynamic call
3. program compiled with NODYNAM option and having statement
CALL 'PGMA' using WS-AREA - static call
4. program compiled with NODYNAM option and having statements
MOVE 'PGMA' to WS-PGM
CALL WS-PGM using WS-AREA - dynamic call
performance considerations of static and dynamic calls:
Because a statically called program is link-edited into the same load module as the
calling program, a static call is faster than a dynamic call. A static call is the
preferred method if your application does not require the services of the dynamic
all.
Statically called programs cannot be deleted (using CANCEL),

----

Example 1: Unloading all columns of specified rows


The control statement specifies that all columns of rows that meet the following
criteria are to be unloaded from table DSN8810.EMP in table space
DSN8D10A.DSN8S71E:
The value in the WORKDEPT column is D11.
The value in the SALARY column is greater than 25 000.
Figure 1. Example of unloading all columns of specified rows
//STEP1 EXEC DSNUPROC,UID='SMPLUNLD',UTPROC='',SYSTEM='DSN'

//SYSPRINT DD SYSOUT=*
//SYSIN DD *
UNLOAD TABLESPACE DSN8D10A.DSN8S81E
FROM TABLE DSN8A10.EMP
WHEN (WORKDEPT = 'D11' AND SALARY > 25000)
Example 2: Unloading specific columns by using a field specification list
The following control statement specifies that columns EMPNO, LASTNAME, and SALARY
are to be unloaded, in that order, for all rows that meet the specified conditions.
These conditions are specified in the WHEN clause and are the same as those
conditions in example 1. The SALARY column is to be unloaded as type DECIMAL
EXTERNAL. The NOPAD option indicates that variable-length fields are to be unloaded
without any padding.
UNLOAD TABLESPACE DSN8D10A.DSN8S81E NOPAD
FROM TABLE DSN8A10.EMP
(EMPNO, LASTNAME, SALARY DECIMAL EXTERNAL)
WHEN (WORKDEPT = 'D11' AND SALARY > 25000)
The output from this example might look similar to the following output:
000060@@STERN# 32250.00
000150@@ADAMSON# 25280.00
000200@@BROWN# 27740.00
000220@@LUTZ# 29840.00
200220@@JOHN# 29840.00
In this output:
'@@' before the last name represents the 2-byte binary field that contains the
length of the VARCHAR field LASTNAME (for example, X'0005' for STERN).
'#' represents the NULL indicator byte for the nullable SALARY field.

LASTNAME is unloaded as a variable-length field because the NOPAD option is


specified.

----

You might also like