.How to add one input & one Out file in existing cobol
program.
how approach tell me step by step.


Answers were Sorted based on User's Feedback



.How to add one input & one Out file in existing cobol program. how approach tell me step b..

Answer / nimsatprasad

IDENTIFICATION DIVISION.
PROGRAM-ID. ADDFILES.
AUTHOR. PRASAD.
DATE-WRITTEN. 2007/07/26.
DATE-COMPILED. 2007/07/26.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-370.
OBJECT-COMPUTER. IBM-370.
SPECIAL-NAMES.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INPUT-FILE1 ASSIGN TO INPUT1
FILE STATUS IS WS-INPUT1-STATUS.
SELECT INPUT-FILE2 ASSIGN TO INPUT2
FILE STATUS IS WS-INPUT2-STATUS.
* HERE INPUT-FILE2 IS NEWLY ADDED
SELECT OUTPUT-FILE1 ASSIGN TO OUTPUT1
FILE STATUS IS WS-OUTPUT1-STATUS.
SELECT OUTPUT-FILE2 ASSIGN TO OUTPUT2
FILE STATUS IS WS-OUTPUT1-STATUS.
* HERE OUTPUT-FILE2 IS NEWLY ADDED
DATA DIVISION.
FILE SECTION.

FD INPUT-FILE1
RECORD CONTAINS 71 CHARACTERS
RECORDING MODE IS F
DATA RECORD IS XXX-RECORD.
01 INPUT-REC1 PIC X(71).

FD INPUT-FILE2
RECORD CONTAINS 71 CHARACTERS
RECORDING MODE IS F
DATA RECORD IS YYY-RECORD.
01 INPUT-REC2 PIC X(71).
* NEWLY ADDED FD.

FD OUTPUT-FILE1
RECORD CONTAINS 71 CHARACTERS
RECORDING MODE IS F
DATA RECORD IS AAA-RECORD.
01 OUTPUT-REC1 PIC X(71).

FD OUTPUT-FILE2
RECORD CONTAINS 71 CHARACTERS
RECORDING MODE IS F
DATA RECORD IS BBB-RECORD.
01 OUTPUT-REC2 PIC X(71).
* NEWLY ADDED FD.

WORKING-STORAGE SECTION.
--
--
--
PROCEDURE DIVISION.
...
...
...

THE BELOW INFORMATION ALSO IS USEFUL FOR THE DECLERATION.

Fixed Block File
• Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE
IS F, BLOCK CONTAINS 0.

Fixed Unblocked
• Use ORGANISATION IS SEQUENTIAL. Use RECORDING
MODE IS F, do not use BLOCK CONTAINS

Variable Block File
• Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE
IS V, BLOCK CONTAINS 0. Do not code the 4 bytes for record
length in FD i.e. JCL REC length will be max REC length
in PGM + 4

Variable Unblocked
• Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE
IS V, do not use BLOCK CONTAINS. Do not code 4 bytes for
record length in FD i.e. JCL REC length will be max REC
length in PGM + 4.

ESDS VSAM file
• Use ORGANISATION IS SEQUENTIAL.

KSDS VSAM file
• Use ORGANISATION IS INDEXED, RECORD KEY IS,
ALTERNATE RECORD KEY IS

RRDS File
• Use ORGANISATION IS RELATIVE, RELATIVE KEY IS

Printer File
• Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE
IS F, BLOCK CONTAINS 0. (Use RECFM=FBA in JCL DCB).

*** IF ANY THING WORNG REGARD THIS LET ME KNOW, THANKS.

Is This Answer Correct ?    7 Yes 3 No

.How to add one input & one Out file in existing cobol program. how approach tell me step b..

Answer / aniket potwekar

Add File-control para in environment division with select
clause for input and output file.Declare there organization
and access mode.
then in data division add file descriptor entry for each
file.These must be in file section.
Then use these files in procedure division.

Is This Answer Correct ?    3 Yes 3 No

Post New Answer

More COBOL Interview Questions

What are the different rules of SORT operation?

0 Answers  


A s9(4). B v9(4) value 0.21 can i move this?

3 Answers  


How to change size of Initial number of records to *NOMAX for ALL PF files from perticular library, how can I do that

0 Answers  


input:- 12233344445555566666... output:- 1=1,2=4,3=9... Here firstno i.e 1 should be displayed and after that the alikeno.s should be added n displayed.i.e 2+2=4 like tat it goeson.

1 Answers  


How to remove the spaces at end of each record in the output file Via COBOL program? note: The file has a VB length

3 Answers   TCS,






What is rmode(24)

0 Answers  


What will happen if you code GO BACK instead of STOP RUN in a stand-alone COBOL program i.e. a program which is not calling any other program ?

3 Answers  


can we display comp-3 variables. if we want to display what we have to do . give me one example

6 Answers   CGI, Deloitte,


there is a file whose ORGANISATION is INDEXED.you want to read the records from the file in RANDOM fashion as well as sequentially.then which of the access mode would you specify? a.SEQUENTIAL b.RANDOM c.DYNAMIC D.ACCESS MODE has nothing to do with it

3 Answers   TCS,


how many bytes do SPPPP999 will store?

18 Answers  


What is amode(24), amode(31), rmode(24) and rmode(any) (applicable to only mvsesa enterprise server) ?

0 Answers  


If A>B next sentence end-if display 1 display 2. display 3. If a>b, it will display only 3.(the next sentence, ie., after fullstop/period) ____________________________________ if a>b continue end-if display 1 display 2. display 3. If a>b, it Will display 1 2 3 (the next statement) ____________________________________ if a>b continue display 1 end-if display 2 display 3. display 4. If a>b, Will it display 2 3 4 (or) 1 2 3 4 ?

8 Answers   UST,


Categories