Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Extract the records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
arunmozhicholan

New User


Joined: 07 Feb 2007
Posts: 27
Location: chennai

PostPosted: Wed May 21, 2008 12:15 pm    Post subject: Extract the records
Reply with quote

FileA:
--------
Account-number - 5 bytes
Quantity - 3 bytes

FileB:
---------
Account-Number - 5 Bytes
Invoice No: - 8 bytes
Invoice date - 8 bytes
Unit Price ($) - S9(09)V99 Comp-3


File C:
---------
Account-Number - 5 Bytes
Invoice No: - 8 bytes
Invoice date - 8 bytes
Sales amount ($) - S9(09)V99 Comp-3 (Unit price of File B * Quantity of FileA)

Extract the records from File B for the account number from File A and write into File C.
can anybody give me the solution .
Back to top
View user's profile Send private message

the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Wed May 21, 2008 12:30 pm    Post subject:
Reply with quote


    1. OPEN INPUT FILE1, FILE2.
    2. OPEN OUTPUT FILE3.
    3. READ FILE2.
    4. MOVE ACCOUNT-NO2 TO ACCOUNT-NO1.
    5. READ FILE1 RECORD KEY IS ACCOUNT-NO1.
    6. COMPUTE THE VALUE OF SALES-AMOUNT.
    7. WRITE FILE-REC3.
    8. CLOSE FILE1, FILE2, FILE3.
Back to top
View user's profile Send private message
arunmozhicholan

New User


Joined: 07 Feb 2007
Posts: 27
Location: chennai

PostPosted: Wed May 21, 2008 12:52 pm    Post subject: Reply to: Extract the records
Reply with quote

thnks gautam
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed May 21, 2008 7:05 pm    Post subject:
Reply with quote

Hello,

This will only work well if file1 is a vsam file.

If these are both qsam files, you could use a 2-file match/merge to get the result you want.

If you are not familiar with this, there is a "Sticky" near the top of the COBOL section of the forum. Download the sample code, review it, and post back here if there are any questions. The sample is bvery close to your requirement.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the Extract Function in JCL dharmaraok JCL & VSAM 3 Wed Jun 14, 2017 9:12 am
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us