COBOL Interview Questions
Questions Answers Views Company eMail

how to remove leading spaces and zeroes in a cobol variable.is there any easy way to do it

2 20559

How to use the same COBOL program in Batch and CICS on lines? explain with an example

IBM,

1883

In my table having 3000 Records. How can I delete the 500th row? (we don't know what is data inside the table)

Keane India Ltd,

3 8831

sample code for read a 2nd record from last in flatfile how can do?

iNautix,

4 12362

A cobol program to read a file , match it with other if. If match occurs then write it to an output file. If no match then no need to write it.Error log created by program to track any error.

1 6397

what is lrec=f,what is difference between f,fb,v,vb?what is default value?how do we came to know that records are in f,fb,v,vb?

IBM, Wipro,

2 20406

I had 100 records and i want to execute last three records by using cobol programming?what will be coding?

IBM,

4 9636

How do get the result of your program directly on your pc?

UST,

1848

What is diff between vsam and db2?what is advantage of db2 over vsam?which is best suited one?

Fidelity,

1 8346

Hi................... I have records like this aaaa cccc bbbb And i want output like this bbbb cccc aaaa How can it possible ?. Note:Please make sure records are in unsorted order. somebody plzzz help me.

1 5349

what is difference between cobol and cobol/400

HCL,

1 21493

In file1 have 80 records are like d1,d2,d3......D80. File2 have 1000records are like a1d1,a1d2,a3d3.....Etc. I want matching records in file3 ? Plse tell me the matching logic???I want answer only in cobol ?Not using any tool or jcl?

CSC,

1 4315

have in 100 records in a file i want to read first 3 records and skip next 3 records and agan i want to read 3 records and again i want to skip 3 records...

ITC Indian Tobacco Company, PNP, TCS,

2 8880

i have n records in one file and in this file there is some fields and i want to count that how many sharma in my file so plz give the coding that how we read sharma ?

2 5798

have in 100 records in a flat file i want to move records like 1,3,5,7,9,11,.. to Output file1 and 2,4,6,8,10,12,14 .. records moved to Output file2..Pls Provide real time answer..

TCS,

5 10775


Post New COBOL Questions

Un-Answered Questions { COBOL }

2 input fles: 2 flat files, with different number of records. both are having unique key for each record and already sorted in ascending order . match these files using unique key and in output only matching key value has to be written. please procide cobol logic

2062


In COBOL programming, what is PERFORM? What is VARYING?

650


Which division and paragraphs are mandatory for a COBOL program?

689


Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?

784


What is the problem of ordered sequential files access?

671






How to use the same COBOL program in Batch and CICS on lines? explain with an example

1883


how can i see junk values in dclgen or in hostvariable of comp ?

2515


IDENTIFICATION DIVISION. PROGRAM-ID. UPDT. AUTHOR.anbu. DATE-WRITTEN. AUG 13. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT CMSTR ASSIGN TO CINP1 ORGANIZATION IS INDEXED ACCESS IS SEQUENTIAL RECORD KEY CM2-KEY FILE STATUS IS WS-CMSTR-FST. SELECT CTAB ASSIGN TO CINP2 ORGANIZATION IS ACCESS IS SEQUENTIAL RECORD KEY VSAM-WHSE- KEY FILE STATUS IS WS-CTAB- FST. DATA DIVISION. FILE SECTION. FD CMSTR. COPY RXCYFC20. FD CTAB. COPY AITYWHSE. ************************************************************ ****** *** WORKING STORAGE VARIABLES *** ************************************************************ ****** WORKING-STORAGE SECTION. 01 WS- VARIABLES. 05 WS-EB PIC X(02) VALUE ZEROES. 05 WS-DIV PIC 9(03) VALUE ZEROES. 05 WS-CMF-RECS-REWRITTEN PIC 9(01) VALUE ZERO. *** FILE STATUS VARIABLES *** 05 WS- FILESTATUS. 10 WS-CMSTR-FST PIC 9(02) VALUE ZEROES. 10 WS-CTAB-FST PIC 9(02) VALUE ZEROES. *** END OF FILE VARIABLES *** 05 WS-CMSTR-EOF PIC X(01) VALUE 'N'. 88 WS-CMSTR-EOF-YES VALUE 'Y'. 88 WS-CMSTR-EOF-NO VALUE 'N'. 05 WS-CTAB-EOF PIC X(01) VALUE 'N'. 88 WS-CTAB-EOF-YES VALUE 'Y'. 88 WS-CTAB-EOF-NO VALUE 'N'. **** ERROR VARIABLES **** 05 WC-ABEND-900 PIC 9(03) VALUE 900. 05 WE-ERR-CODE PIC 9(02) VALUE ZEROES. 05 WE-ABEND-CODE PIC 9(03) VALUE ZEROES. ************************************************************ **** ********* PROCEDURE DIVISON ********** ************************************************************ **** PROCEDURE DIVISION. 0000- BEGIN. PERFORM 1000-INITIALISE THRU 1000- EXIT. PERFORM 2000-PROCESS THRU 2000- EXIT UNTIL WS-CMSTR-EOF- YES. DISPLAY 'WS-CMF-RECS-REWRITTEN :' WS-CMF-RECS- REWRITTEN. PERFORM 5000-CLOSE THRU 5000- EXIT. GOBACK. 0000- EXIT. EXIT. 1000- INITIALISE. OPEN I-O CMSTR. EVALUATE WS-CMSTR- FST WHEN 00 WHEN 97 CONTINUE WHEN OTHER DISPLAY 'ERROR IN READING INPUT FILE: ' DISPLAY WS-CMSTR-FST MOVE WS-CMSTR-FST TO WE-ERR-CODE PERFORM 9999-ABEND-PARA THRU 9999-EXIT END-EVALUATE. OPEN INPUT CTAB. EVALUATE WS-CTAB-FST WHEN 00 WHEN 97 CONTINUE WHEN OTHER DISPLAY 'ERROR IN READING INPUT FILE: ' DISPLAY WS-CTAB-FST MOVE WS-CTAB-FST TO WE-ERR-CODE PERFORM 9999-ABEND-PARA THRU 9999-EXIT END-EVALUATE. 1000-EXIT. EXIT. 2000-PROCESS. READ CMSTR. EVALUATE WS-CMSTR-FST WHEN 00 CONTINUE WHEN 10 SET WS-CMSTR-EOF-YES TO TRUE GO TO 2000-EXIT WHEN OTHER DISPLAY 'ERROR IN READING INPUT FILE: ' DISPLAY WS-CMSTR-FST MOVE WS-CMSTR-FST TO WE-ERR-CODE PERFORM 9999-ABEND-PARA THRU 9999-EXIT END-EVALUATE IF CM2-RECORD-TYPE-SOLD-TO MOVE CM2-ENTERING-BRANCH TO WS-EB PERFORM 3000-READ THRU 3000-EXIT UNTIL WS-CTAB-EOF-YES END-IF. 2000-EXIT. EXIT. 3000-READ. MOVE WS-EB TO VSAM-WHSE-CD. MOVE 'WHSE' TO VSAM-WHSE-ID. READ CTAB. EVALUATE WS-CTAB-FST WHEN 00 MOVE WHSE-DIV-CODE TO WS-DIV PERFORM 4000-REWRITE-CMF THRU 4000-EXIT WHEN 10 SET WS-CTAB-EOF-YES TO TRUE GO TO 3000-EXIT WHEN OTHER DISPLAY 'ERROR IN READING TABLE FILE: ' DISPLAY WS-CTAB-FST MOVE WS-CTAB-FST TO WE-ERR-CODE PERFORM 9999-ABEND-PARA THRU 9999-EXIT END- EVALUATE. 3000- EXIT. EXIT. 4000-REWRITE- CMF. IF WS-DIV = 250 OR 252 MOVE 'F' TO CM2-FREIGHT- TYPE MOVE 1 TO CM2-FREIGHT-THRESHOLD- AMT ADD +1 TO WS-CMF-RECS- REWRITTEN REWRITE CM2-SOLD-TO- RECORD DISPLAY 'RECORD UPDATED' END- IF. * EVALUATE WS-CMSTR- FST * WHEN 00 * CONTINUE * WHEN OTHER * DISPLAY 'FILE NOT UPDATED' * DISPLAY WS-CMSTR- FST * MOVE WS-CMSTR-FST TO WE-ERR-CODE * PERFORM 9999-ABEND-PARA THRU 9999-EXIT * GO TO 4000-EXIT * END-EVALUATE. 4000-EXIT. EXIT. 5000-CLOSE. CLOSE CMSTR CTAB. 5000-EXIT. EXIT. 9999-ABEND-PARA. COMPUTE WE-ABEND-CODE = WC-ABEND-900 + WE-ERR-CODE CALL 'ILBOABN0' USING WE-ABEND-CODE GO TO 5000-CLOSE. 9999-EXIT. EXIT. 5000-CLOSE. CLOSE CMSTR CTAB. 5000-EXIT. EXIT. 9999-ABEND-PARA. COMPUTE WE-ABEND-CODE = WC-ABEND-900 + WE-ERR-CODE CALL 'ILBOABN0' USING WE-ABEND-CODE GO TO 5000-CLOSE. 9999-EXIT. EXIT. //this program is giving maxcc=0, but not updating..

3306


input= ,,,, mainframe training ,,, hyderabad .... location.... output1=$ mainframe training in hyderabad location$ output2=**** mainframe training in hyderabad location ****. In this pgn when we give input considering the spaces the output is displayed in this format.Like in the place of ,,,, $ should be displayed likewise.So please helpmeout.

1754


Explain the configuration section of a cobol program with examples of syntax.

627


here is my requirement A1 is alphanumeric with value 'A1B2C3D4' as defined below 05 A1 PIC X(8) VALUE IS 'A1B2C3D4' but i need to have A2,A3 as ABCD & 1234 repectively...... A2 = ABCD A3 = 1234 Can you please explain me what are the different ways to do it?

6738


How do get the result of your program directly on your pc?

1848


Difference between array and sub-script ?

1133


What type of SDLC u followed? Why?

1494


How do we get current date from system with century in COBOL?

758