I hv ten records in ps file and i hv say some 15 records in
vsam file .i hv empno and age in ps file n
empno,empname,dept n desig in vsam file. i hv 2 read the ps
file n check wid matching empno in vsam file and then
insert all fields from ps and vsam into db2 table....plz
help in writin the procedure division



I hv ten records in ps file and i hv say some 15 records in vsam file .i hv empno and age in ps fi..

Answer / vaneesh

File FD for PS
01 PS-FILE
05 PS-EMP-NO
05 PS-EMP-AGE
File FD for VSAM
01 VSAM-FILE
05 VSAM-EMP-NO-------->RECORD KEY
05 VSAM-EMP-NAME
05 VSAM-EMP-DEPT
PROCEDURE DIVISION

PERFORM UNTILL END OF PS FILE
READ PS FILE

READ VSAM-FILE KEY IS PS-EMP-NO
IF VSAM-FILE-STAUTS = '00'

EXEC SQL
INSERT INTO TABLE EMPLOY WITH VALUE 'PS-EMP-NO', 'PS-EMP-
AGE', 'VSAM-EMP-NAME' 'VSAM-EMP-DEPT'
END-EXEX
END-PERFORM.

Is This Answer Correct ?    4 Yes 0 No

Post New Answer

More COBOL Interview Questions

comp-3 field occupy?

5 Answers  


Explain complete concept of table handling in COBOL with an example?

2 Answers   IBM, TCS, Wipro,


have in 100 records in a file i want to move only matched records to one output_file1 and nonmathed records are moved to another output_file2 ... any one can provide logic code

3 Answers  


if we have " ibm mainframe ",in that how to remove first and last leading space eg:"ibm mainframe" like that the answer we need

1 Answers  


What is the difference between NEXT SENTENCE and CONTINUE?

2 Answers   Mphasis,


What is the significance of the PROGRAM-ID paragraph? If this name doesnt match with the name of the COBOL program, does it make a difference? Is the name specified in the PROGRAM-ID paragraph used as a name for the load module or any such thing?

4 Answers   IBM,


) how do u code after getting data?

1 Answers   IBM,


What is the difference between binary search and sequential search?

1 Answers  


Can a Search can be done on a table with or without Index?

1 Answers  


What type of Call you would use if you don;t want the control back to the calling program?

8 Answers   TCS,


what is record label is empty or standard in file description of data division?

2 Answers   HCL,


What are the cobol coding sheets?

1 Answers  


Categories