I have program P1 which calls file F1 which has 100 records
and following structure
001 ..................
002 ..................
003 ..................
098 ....................
099 ...................
100 ....................

Now I want to read these files and write these records in
file F2 in following manner.

001 ...... 051 .....
002 ...... 052 .....
003 ...... 053 .....
.......... .......
.......... .......
.......... .......
048 ........ 098 ......
049 .......... 099 .......
050 .... 100 ......

Answers were Sorted based on User's Feedback



I have program P1 which calls file F1 which has 100 records and following structure 001 ..........

Answer / ch. ranveer singh

//Aaaaaaaa JOB ,'ADC',NOTIFY=&SYSUID
BY CH . RANVEER SINGH GURJAR




//STEP1 EXEC PGM=SORT
//SORTIN DD DSN=WW.W.AHOC.ADC.P1,DISP=SHR
//SORTOF1 DD DSN=WW.W.AHOC.ADC.P2,DISP=SHR
//SORTOF2 DD DSN=WW.W.AHOC.ADC.P3,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL FILES=(1,2),SPLITBY=50
/*
//

Is This Answer Correct ?    4 Yes 3 No

I have program P1 which calls file F1 which has 100 records and following structure 001 ..........

Answer / krishnan a

1.first use JCL to sort the file then split the file into
two or read the file first 50 record by using count after
reached 50 then move to one file then remaining 50 move to
other file then read file1 and write by using write para
(PERFORM FILE1-WRITE1) then READ SECOND file then write
second FILE2 record(PERFORM FILE2-WRITE2)into the same
output file.

Is This Answer Correct ?    2 Yes 2 No

I have program P1 which calls file F1 which has 100 records and following structure 001 ..........

Answer / vaneesh

Hi Krishnan A

How will how will you split the file into 50-50. Please let
me know with the sort card.

Vaneesh

Is This Answer Correct ?    0 Yes 0 No

I have program P1 which calls file F1 which has 100 records and following structure 001 ..........

Answer / gm

Simple. Read the input file in sequence.
Store the first 50 records in a table.
When you start reading from 51st record,
Build your output record with one half of
the record from the table (record 1) and the
other half from the input that u have read (51)
and write the output record.
Loop thru till end.

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More COBOL Interview Questions

Can printer files (having 133 characters) be of variable length?

3 Answers  


HOW TO MOVE REDEFINES CLAUSE FROM INPUT TO OUTPUT ?

1 Answers  


what is sysncpoint?

1 Answers   IBM,


write a program to eliminate duplicate records in a input file and send them to output file.

2 Answers   IBM,


What is a scope terminator? Give examples.

2 Answers  






What is the difference between a binary search and a sequential search?

3 Answers  


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?

2 Answers   IBM,


COBOL program to read the string ' BOMBAY' in reverse order as 'YABMOB'

8 Answers   Barclays, IBM,


Suppose a program has the following code. What will be the output? MAIN-PARA. DISPLAY 'MAIN-PARA' PERFORM SECTION-A. STOP RUN. SECTION-A. PARA-A1. DISPLAY 'SECTION A PARA A1'. PARA-A2. DISPLAY 'SECTION A PARA A2'.

4 Answers  


can we use COPY statement in w-s section? how?

3 Answers  


after udatingg first 110 rows, my job abends. now how do i change my cobol program so that when i restart the Job it will start updating from 111th row ( i.e in next run I di=ont want to update those 110 rows which are already been updated in the first run before job abend)

7 Answers   Allianz, Wipro,


How to pass return codes from cobol to jcl?

5 Answers  


Categories