hi,
i am krishna,
i have a requirement like this.
i have 9 input put files with the same recordlayout like this.
header details
details records:
trailer details
in this each input sequntial files trailer details have TOT-AMT, TOT-RECS fields
here TOT-AMT specifies total amount value of detail records
TOT_RECS specifies number of details records
here we dont want any modifications on header details
now i want to merge tht total in put files into one output file.
in this out put file i want to calculate TOT-AMT, TOT-RECS values.
so pls send me code ASAP.
hi mergeing the seqfiles in cobol.. pls help me urgent...
Moderators: dbzTHEdinosauer, Moderator Group
-
- Member
- Posts: 6
- Joined: Mon Aug 27, 2007 2:39 pm
Since this is in the COBOL forum, I need to ask, does this need to be done through a COBOL program? If not, and you have DFSORT, ask the question in the DFSORT forum. Frank Yeager is the guru of gurus and sure to have a solution. If this needs to be accomplished via COBOL code, plesae come back.
David,
David,
-
- Member
- Posts: 6
- Joined: Mon Aug 27, 2007 2:39 pm
hi david,
My requirement is to do this in cobol programonly,
for this iam trying with the following logic if any one good in login pls help me.
first in jcl i concatenate the all 9 files in to one mainfile.
next i am taking this mainfile as input into my cobol program
next i will careate one output file and will open these 2 files.
next i wll read mainfile and find the total and number of records
and moved into output file
in this pls ask any doubts
My requirement is to do this in cobol programonly,
for this iam trying with the following logic if any one good in login pls help me.
first in jcl i concatenate the all 9 files in to one mainfile.
next i am taking this mainfile as input into my cobol program
next i will careate one output file and will open these 2 files.
next i wll read mainfile and find the total and number of records
and moved into output file
in this pls ask any doubts
-
- Member
- Posts: 6
- Joined: Mon Aug 27, 2007 2:39 pm
hi david,
My requirement is to do this in cobol programonly,
for this iam trying with the following logic if any one good in login pls help me.
first in jcl i concatenate the all 9 files in to one mainfile.
next i am taking this mainfile as input into my cobol program
next i will careate one output file and will open these 2 files.
next i wll read mainfile and find the total and number of records
and moved into output file
in this pls ask any doubts
My requirement is to do this in cobol programonly,
for this iam trying with the following logic if any one good in login pls help me.
first in jcl i concatenate the all 9 files in to one mainfile.
next i am taking this mainfile as input into my cobol program
next i will careate one output file and will open these 2 files.
next i wll read mainfile and find the total and number of records
and moved into output file
in this pls ask any doubts
Krishna,
Find below the steps and some briefing on it as how to achieve what you have asked for.
GET BACK TO US IF IN CASE YOU NEED SOME MORE INFO.
Thanks,
Veera.
Find below the steps and some briefing on it as how to achieve what you have asked for.
Code: Select all
STEP1
********
YOU WILL CONCATENATE ALL THE 9 FILES INTO 1 OUTPUT FILE SO NOW WE HAVE ONLY ONE OUTPUT FILE.
STEP2
********
COBOL PROGRAM -> YOU WILL READ THE ABOVE I/P FILE.
LOGIC
********
READ EACH RECORD FROM THE INPUT FILE
THERE SHOULD BE SOME MEANS OF IDENTIFYING THE HEADER RECORD AND TRAILER RECORD.
MAY BE BY USING THE RECORD CODE OR SOME FIELD IDENTIFIER.
A -> WHEN YOU READ THE FIRST HEADER RECORD WRITE INTO OUTPUT FILE AS IT IS.
B -> WHEN YOU READ OTHER RECORDS APART FROM HEADER AND TRAILER WRITE THE RECORDS AS IT IS.
-> YOU DON'T WANT TO CHANGE ANYTHING IN THESE DETAIL RECS AS PER YOUR REQUIREMENT.
C -> NOW WHEN EVER YOU READ THE FIRST TRAILER REC MOVE RECORD TOTALLY INTO SOME WORKING STORAGE VARIABLES AND HOLD THE ENTIRE DATA FOR THE TRAILER LAYOUT.
NOTE : DO NOT WRITE THE RECORD JUST HOLD THE DATA IN SOME WORKING STORAGE HERE.
D -> NOW WHEN EVER YOU READ THE REST OF TRAILER RECS ,THAT IS YOU WILL HAVE REST 8 TRAILER RECORDS WHAT YOU DO IS ADD THE TOT-AMT AND TOT-RECS OF THAT PARTICULAR TRAILER RECORDS VALUES TO THE FIRST HOLD TOT-AMT AND TOT-RECS IN THE WORKING STORAGE.
E -> KEEP WRITING THE OTHER RECORDS APART FROM TRAILER AND HEADER UNTIL YOU REACH END OF FILE.
F -> WHEN YOU REACH THE END OF FILE, NOW WRITE THE LAST REC THAT IS ONE TRAILER RECORD FOR THE ENTIRE FILE FROM HOLD VARIABLES FROM THE WORKING STORAGE WHICH HAS THE ENTIRE TRAIILER RECORD LAYOUT.
( AND WE ALSO HAVE TOT-AMT AND TOT-RECS OF ALL THE 9 TRAILER RECORDS ACCUMULATED).
Thanks,
Veera.
abcdef1234,
Sorry it took so long to get back to you. Looks like your logic and Veera's Pseudo logic will work fine, unless you need the detail records inside to be in order, and then you will need other, merge logic.
Does it matter the order the detail records are in? In our shop, I cannot think of an occurrence that it does not matter.
David
Sorry it took so long to get back to you. Looks like your logic and Veera's Pseudo logic will work fine, unless you need the detail records inside to be in order, and then you will need other, merge logic.
Does it matter the order the detail records are in? In our shop, I cannot think of an occurrence that it does not matter.
David
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page