IBM COBOL400

  Home  Mainframes  IBM COBOL400


“IBM COBOL400 frequently Asked Questions in various IBM COBOL400 job Interviews by interviewer. Get preparation of IBM COBOL400 job interview”



19 IBM COBOL400 Questions And Answers

2⟩ What is PERFORM? and its types?

to execute set of statement elsewhere in the prgram.

types :

perform para-name.

perform para1 until condition.

perform para1 n times.

perform para1 thru para4 until condition.

inline perform.

perform varying i from 1 by 1 until condition.

perform para1 with test before/after until condition.

 130 views

3⟩ What is comp?

"COMP" in Cobol = Binary storage format(if -ve bit is ON,

if +ve bit is OFF)

COMP-1 = Single precision floating point. Uses 4 bytes.

COMP-2 = Double precision floating point. Uses 8 bytes.

COMP-3 = packed decimal format. Uses 4 bytes.

Example 01 WS-VAR USAGE COMP-1.

 125 views

4⟩ What is the difference between comp & comp-3?

Comp : Store the data in Binary formate, it will take less

space compare to Comp-3.

Comp-3 : Store the data in Pack decimal,it will take more

space compare to Comp.

Example :

S9(18)

Comp : takes 4 bytes

Comp-3: takes 10 bytes

 132 views

5⟩ How array can be declare in cobol?

Array can be declared in cobol using the OCCURS clause.

Syntax is,

For one dimensional array,

01 Arrays.

05 Var1 PIC X(10) Occurs 10 times.

For two dimensional array,

01 Arrays.

03 AAA Occurs 10 times

05 BBB Occurs 10 times

07 Value PIC 9(3).

 139 views

7⟩ What are Fillers?What is the actual use of Fillers? With mall/simple Example?

When a programmer is not intended to use any fields in a record structure, it can be defined as Filler.

This can’t be initialized or used in any operation of the procedure division.

Eg: if a record contains the following fields

05 EMP-REC.

10 EMP-KEY PIC XXX.

10 EMP-NAME PIC X(32).

10 EMP-SEX PIC X.

10 EMP-DEPT PIC X(10)

10 EMP-DESIG PIC X(5).

10 EMP-SAL PIC 9(7).

If the programmer is not intended to use , name ,dept and sal in the program the u can define the structure as follows

05 EMP-REC.

10 EMP-KEY PIC XXX.

10 FILLER PIC X(32).

10 EMP-SEX PIC X.

10 FILLER PIC X(10)

10 EMP-DESIG PIC X(5).

10 FILLER PIC 9(7).

 134 views

11⟩ What is the difference between SEARCH and SEARCHALL?

Search verb searches an item in a sequential manner. But

Search All searches an item by using Binary search, so it

is more efficient and faster than its counter part. One

thing required in Search All verb is the array must be

sorted.

 141 views

12⟩ How can i change the below code in SQL to cobol/400?EXEC SQL SELECT COUNT(*) INTO WS-COUNT FROM Db file WHERE Field 1 = WS-VAR AND Field 2 = WS-USERID END-EXEC

Declare below three variables in working storage section.

77 WS-COUNT PIC 99. VALUE ZEROS.

77 WS-VAR PIC X(10) VALUE "WELCOME".

77 WS-USERID PIC x(5) VALUE "AAAAA".

Decalre one indicator for end of file.

04 EOF-DB-FILE PIC X VALUE "N".

88 EOF-DB-FILE VALUE "Y".

Read each record from input file(Db file) and increase

count if the conditions are satisfied.

PROCEDURE DIVISION.

OPEN INPUT DB-FILE.

READ Db-file

AT END MOVE "Y" TO EOF-DB-FILE

GO TO 1000-EXIT.

IF FIELD1 = WS-VAR AND FIELD2 = WS-USERID

ADD 1 TO WS-COUNT

END-IF

GO TO 1000-EXIT.

DISPLAY WS-COUNT

CLOSE DB-FILE.

STOP RUN.

 168 views

16⟩ How to Convert 2010/02/11 to m/dd/yyy.. with string and without string if any other method... code?

The above issue can be resolved by using REDEFINES clause.

01 DATE-FIELD

05 DATE-YYYY PIC 9(04).

05 DATE-MM PIC 9(02).

05 DATE-DD PIC 9(02).

01 DATE-CONT REDEFINES DATE-FIELD

05 DATE-MM-CONT PIC 9(02).

05 DATE-DD-CONT PIC 9(02).

05 DATE-YYYY-CONT PIC 9(04).

I guess the above declaration will resolve it. I have not

tested it.

 174 views

17⟩ Define sort? and its syntax?

Here the sort is considered as an internal sort that is we

want to manipulate the data before feeding it to sort.Else

in rest of the cases we use external sort.

The syntax is :

SORT SORTFILE ON ASCENDING/DESCENDING KEY

USING FILE1,FILE2/ INPUT PROCEDURE PARA-1

GIVING FILE3/ OUTPUT PROCEDURE PARA-2

 147 views

19⟩ What is redefine and its syntax?

REDEFINE is a Cobol Verb.

It is similar to RENAME Verb.

It uses the same WORKING-STORAGE memory of a data name

With another data name programmer want instead.

Syntax.

WORKING-STORAGE SECTION.

01 WS-NAME PIC x(15).

01 WS-AGE PIC 99.

05 NAME REDIFINES WS-NAME.

 142 views