81⟩ How is sign stored in a COMP field?
It is stored in the most significant bit. Bit is ON if -ve, OFF if +ve.
“Cobol Interview Questions and Answers will guide us now that COBOL is one of the oldest programming languages in computer history. COBOL name is an acronym for COmmon Business-Oriented Language, defining its primary domain in business, finance, and administrative systems for companies and governments. Learn COBOL programming basic and advance concepts or get preparation of COBOL based jobs interview by our this Cobol Interview Questions and Answers Guide.”
It is stored in the most significant bit. Bit is ON if -ve, OFF if +ve.
COMP-1 - Single precision floating point. It uses 4 bytes.
COMP-2 - Double precision floating point. It uses 8 bytes.
It will take 4 bytes to occupy. Sign is stored as hex value in the last nibble. General formula is INT((n/2) + 1)), where n=7 in this example.
Packed Decimal fields: Sign is stored as a hex value in the last nibble (4 bits) of the storage. Zoned Decimal fields: As a default, sign is over punched with the numeric value stored in the last bite.
Basically you need to correct the offending data. Many times the reason for SOC7 is an un-initialized numeric item. Examine that possibility first. Many installations provide you a dump for run time ABEND’s (it can be generated also by calling some subroutines or OS services thru assembly language). These dumps provide the offset of the last instruction at which the ABEND occurred. Examine the compilation output XREF listing to get the verb and the line number of the source code at this offset. Then you can look at the source code to find the bug. To get capture the runtime dumps, you will have to define some datasets (SYSABOUT etc) in the JCL. If none of these are helpful, use judgment and DISPLAY to localize the source of error. Some installation might have batch program debugging tools. Use them.
Does nothing! If used, must be the only sentence within a paragraph.
They appear to be similar, that is, the control goes to the next sentence in the paragraph. But, Next Sentence would take the control to the sentence after it finds a full stop (.). Check out by writing the following code example, one if sentence followed by 3 display statements (sorry they appear one line here because of formatting restrictions) If 1 > 0 then next sentence end if display ‘line 1' display ‘line 2' display ‘line 3'. *** Note- there is a dot (.) only at the end of the last 2 statements, see the effect by replacing Next Sentence with Continue ***
Yes. Redefines just causes both fields to start at the same location. For example: 01 WS-TOP PIC X(1) 01 WS-TOP-RED REDEFINES WS-TOP PIC X(2). If you MOVE ‘12' to WS-TOP-RED, DISPLAY WS-TOP will show 1 while DISPLAY WS-TOP-RED will show 12.
Performing a SECTION will cause all the paragraphs that are part of the section, to be performed. Performing a PARAGRAPH will cause only that paragraph to be performed.
In a binary search, the table element key values must be in ascending or descending sequence. The table is ‘halved’ to search for equal to, greater than or less than conditions until the element is found. In a sequential search, the table is searched from top to bottom, so (ironically) the elements do not have to be in a specific sequence. The binary search is much faster for larger tables, while sequential works well with smaller ones. SEARCH ALL is used for binary searches; SEARCH for sequential.
Comp is a binary usage, while comp-3 indicates packed decimal. The other common usage’s are binary and display. Display is the default.
INITIALIZE moves spaces to alphabetic fields and zeros to alphanumeric fields. The REPLACING option can be used to override these defaults.
DB2 precompiled (if embedded SQL used), CICS translator (if CICS pgm), COBOL compiler, Link editor. If DB2 program, create plan by binding the DBRMs.
The PERFORM and END-PERFORM statements bracket all COBOL II statements between them. The COBOL equivalent is to PERFORM or PERFORM THRU a paragraph. In line, PERFORM’s work as long as there are no internal GO TOs, not even to an exit. The in line PERFORM for readability should not exceed a page length - often it will reference other PERFORM paragraphs.
In non-CICS environment, it is possible. In CICS, this is not possible.
EVALUATE can be used in place of the nested IF THEN ELSE statements.
The parameters passed in a call by context are protected from modification by the called program. In a normal call, they can be modified.
An external sort is not COBOL; it is performed through JCL and PGM=SORT. It is understandable without any code reference. An internal sort can use two different syntax’s 1.) USING, GIVING sorts are comparable to external sorts with no extra file processing; 2) INPUT PROCEDURE, OUTPUT PROCEDURE sorts allow for data manipulation before and/or after the sort.
Write JCL cards to a dataset with xxxxxxx SYSOUT= (A, INTRDR) where ‘A’ is output class, and dataset should be opened for output in the program. Define a 80 byte record layout for the file.
Move a value to RETURN-CODE register. RETURN-CODE should not be declared in your program.