IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

COBOL Program to Read two Infiles


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
raj4neo
Warnings : 1

New User


Joined: 12 May 2006
Posts: 51
Location: India

PostPosted: Tue Sep 15, 2015 4:37 am
Reply with quote

Hi ,

I have a Requirement of two read two input files

File A have Record Layout I1 I2 , I3 , I4 , I5 , I6 where I4 , I5 , I6 Is of Array data having 5 occurs

File A have Record Layout I1 I7 , I8 , I9 , I10 , I11 where I7 , I8 , I9 , I10, 1II Is of Array data having 20 occurs

I HAVE TO MATCH THE I1 in both file and write the output layout as

O1 , O2 , O3 , O4 , O5 , O6 , O7 ,O8,O9,O10,O11 , ALL THE OUTPUT ARRAY FILED 04-011 SHOULD HAVE ONLY ARRAY OF 5 OCCURS

could you please let know any sample code

Thanks in advance
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Sep 15, 2015 5:08 am
Reply with quote

I have never heard of sample code for such a requirement -- so basically you are asking for us to give you the code. This is a HELP forum, not a WRITE-THE-CODE-FOR-YOU forum. If / when you have specific questions about specific problems, post them and we will (usually) be able to help.

Questions I would be asking:
1. Are the files sorted by I1 already?
2. What are the I1, I2, ... ? Are they separate records (and if so, how are records identified?)? If not, does every record have the same data (that is, does every record of file A have I1, I2, I3, I4, I5, I6 in sequence or can one -- or more -- of them be missing)?
3. What are the record lengths for file A, file B, and the output file?
Back to top
View user's profile Send private message
raj4neo
Warnings : 1

New User


Joined: 12 May 2006
Posts: 51
Location: India

PostPosted: Tue Sep 15, 2015 5:57 am
Reply with quote

I am not asking for Full code

Yes Both the Input files are in Sorted order

First File is having the Lrecl 5662 FB FORMAT

Second file is having the Lrecl 9000 FB Format

I1 is the Key Record and

I1 / I2 ARE THE SEPERATED RECORDS
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Tue Sep 15, 2015 7:23 am
Reply with quote

Only If you had 'Googled', you would have got plenty of "sample codes" icon_evil.gif

You can do it even now and after that, as Robert suggested, come back with specifics of the issues you face.

.
Back to top
View user's profile Send private message
raj4neo
Warnings : 1

New User


Joined: 12 May 2006
Posts: 51
Location: India

PostPosted: Tue Sep 15, 2015 7:28 am
Reply with quote

Oh OK
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Sep 15, 2015 7:43 am
Reply with quote

It sounds like you need to sit down and work through what to do -- create some test records for file A and file B (with matches on I1 and non-matches on I1), and manually use pen and paper to walk through what should happen. This can be a VASTLY helpful exercise as it gives you a feel for what the logic needs to be. Things to be resolved:
- what if an I1 in file A does not have a match in file B?
- what if an I1 in file B does not have a match in file A (usually the same thing but sometimes not)?
- how long will the output record be?
- how many records in file A and B? How many output records do you expect from those records?

Many programmers tend to start coding way too early, before they fully understand the data to be processed. When this happens, they either have to scrap some of what they've written and write correct code (which often they don't want to do after investing the time in the code), or (FAR more frequently) they attempt to shoehorn the written code into the needed process, causing continuing issues since the code doesn't really fit the data.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3049
Location: NYC,USA

PostPosted: Wed Sep 16, 2015 2:40 am
Reply with quote

I could get nothing. Please give us sample input,output . This is so high level.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Sep 16, 2015 1:46 pm
Reply with quote

Sounds like a standard 2-file match
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Sep 16, 2015 2:14 pm
Reply with quote

Yes, Nic, to me also. Even if a modified one (the the subsequent records don't have a key).

Depending on whether the tables (COBOL doesn't have arrays) coincide, chopping down 20 to five may be simple. But, we can't tell.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts Error to read log with rexx CLIST & REXX 11
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top