Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Comparing two sequential files

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

New User


Joined: 12 Apr 2016
Posts: 15
Location: INDIA

PostPosted: Mon Apr 16, 2018 6:35 pm    Post subject: Comparing two sequential files
Reply with quote

Hi All,

I have two sequential files, one file with LRECL = 80 (FB) and other file LRECL = 3000 (VB).

The first file with LRECL = 80 is input where account number (key field) with other details will be provided.

I have to search the second file using the key fields and update the second file using the details/values of the first file.

I have followed below logic

START
Open INPUT first-file
Open I-O second-file


Read FIRST-FILE
PERFORM VERIFY-RECORDS (verification for the second file)

VERIFY-RECORDS.
Compared KEY values of the Input file with all records

IF matched then REWRITE the second-file

CLOSE FILES

END

somehow I am not getting desired results. Can anyone share other ideas please.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


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

PostPosted: Mon Apr 16, 2018 6:44 pm    Post subject: Reply to: Comparing two sequential files
Reply with quote

Quote:
somehow I am not getting desired results. Can anyone share other ideas please.
My first idea would be to post meaningful data. "not getting desired results" -- could mean, among other things:
- program abends with a system code
- program abends with a COBOL code
- program runs to normal completion but produces no results
- program runs to normal completion but produces incorrect results
- program generates a file status code during processing

Furthermore:
- are the two files sorted on the key?
- if not, why are you not sorting them before starting the process? Unsorted, you have to read the second file from the beginning for each record to find the match so you have to do a lot more work.
- what results do you desire?
- how do the actual results differ from what you desire?
- is your desired results what the system can produce or are you wanting something impossible to produce?
Back to top
View user's profile Send private message
Mohan Kothakota

New User


Joined: 12 Apr 2016
Posts: 15
Location: INDIA

PostPosted: Mon Apr 16, 2018 7:19 pm    Post subject: Reply to: Comparing two sequential files
Reply with quote

Hi Robert,

Sorry for the confusion. Please find my response

- Program abends with System code.

- Files have been sorted before running the program.

- I have record in the second file but I want to update some fields in it. So I am using the first file as Input.
Using the Input, the second file needs to be updated.

The desired result is the second file needs to get updated same as first file values.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Mon Apr 16, 2018 7:37 pm    Post subject:
Reply with quote

Quote:
- Program abends with System code.
OK -- WHAT SYSTEM CODE DID IT ABEND WITH?
Your answer is responsive but meaningless. A system abend S0C7 is quite different from a system abend S001 is quite different from a system abend SB37 and each has a different resolution. There are hundreds, if not thousands, of system abend codes and without telling us which one, there is nothing we can do to help you.
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 298
Location: Maryland

PostPosted: Tue Apr 17, 2018 1:49 am    Post subject:
Reply with quote

Looks like the ABEND code is equal to the word "SYSTEM", isn't it? icon_fU.gif
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 298
Location: Maryland

PostPosted: Tue Apr 17, 2018 1:49 am    Post subject:
Reply with quote

Preliminary my guess is that using any of standard SORT utilities for this task requires approx. 300 times less coding compared to COBOL solution, isn't it?

My second guess: SORT utility can provide 100 times better performance on huge datasets, compared to primitive hand-made COBOL code.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2002
Location: UK

PostPosted: Tue Apr 17, 2018 2:38 am    Post subject: Reply to: Comparing two sequential files
Reply with quote

You are comparing two sequential data sets. Did you follow the logic in the "sticky" topic (among the first 5 topics in this part of the forum) - amende for your particular requirement?
Back to top
View user's profile Send private message
Mohan Kothakota

New User


Joined: 12 Apr 2016
Posts: 15
Location: INDIA

PostPosted: Tue Apr 17, 2018 3:47 pm    Post subject: Reply to: Comparing two sequential files
Reply with quote

Hi Robert,

I am getting SOC7,

Below is the Input

Code:
05  IPD350-ACTUALS.                           
   10  IPD350-HOURS             PIC  S9(05)V99.
   10  IPD350-DOLLARS           PIC  S9(07)V99.
   10  IPD350-UNITS             PIC  S9(07)
.


Values of Input

Code:
IPD350-HOURS       :   14.39 
IPD350-DOLLARS     :   148.22
IPD350-UNITS       :   275   


I am moving to below fields

Code:
10  RLD-CUR-MTH-ACTUALS       COMP-3.       
    15  RLD-CMA-HOURS   PIC  S9(05)V99.     
    15  RLD-CMA-DOLLARS PIC  S9(07)V99.     
    15  RLD-CMA-UNITS   PIC  S9(07).   



I tried with and without COMP-3 for Input but still getting SOC7.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10457
Location: italy

PostPosted: Tue Apr 17, 2018 4:52 pm    Post subject: Reply to: Comparing two sequential files
Reply with quote

show the hexadecimal values of the input ...
NOT an edited value
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Apr 17, 2018 5:13 pm    Post subject: Reply to: Comparing two sequential files
Reply with quote

Have you done the elementary debugging of figuring out which line of code and which variable(s) are causing the S0C7? If not, start by finding the line of code and the variable(s) involved. You may need to rewrite the code to prevent the S0C7.
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 298
Location: Maryland

PostPosted: Tue Apr 17, 2018 7:28 pm    Post subject: Re: Reply to: Comparing two sequential files
Reply with quote

Robert Sample wrote:
Have you done the elementary debugging of figuring out which line of code and which variable(s) are causing the S0C7? If not, start by finding the line of code and the variable(s) involved. You may need to rewrite the code to prevent the S0C7.


Just recently the topic starters with low level of understanding in IT technologies were directed straightforward to the Beginners Forum.

The level of this question is even worse than "zero degree"; does it make sense to carefully explain here the very standard, and obvious steps in program coding, and debugging?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Apr 17, 2018 9:30 pm    Post subject:
Reply with quote

Mohan Kothakota, I concur with sergeyken -- you need to stop posting on this forum and visit Beginners and Students Forum instead. The types of questions you are posting, and the responses you provide to questions, indicate that you have no place on an Experts Forum such as this one. You would be far better off switching, no matter how much "experience" you claim to have.
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 972
Location: Richmond, Virginia

PostPosted: Wed Apr 18, 2018 1:13 am    Post subject:
Reply with quote

Note that Robert has correctly written your abend as S0C7 (with a zero), not SOC7 (with an oh) as you have it.

Picky, picky, picky, right? Well, that's the nature of this kind of work.

We DO pronounce it sock7, but it's a zero in the code.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Apr 18, 2018 1:19 am    Post subject:
Reply with quote

As another example of why you belong on the Beginners Forum, if the input data is truly as you have it listed (with decimal points), then that explains why you got the S0C7 -- decimal points are not numeric and will cause S0C7 abends when encountered in numeric MOVE statements and arithmetic operations. The V in a COBOL PICTURE clause is an IMPLIED decimal point -- as in, it does not really exist in the data. Furthermore, 14.39 being read into a PIC S9(05)V99 should be coming in as 000143I (which is 1439 with an overpunched plus sign on the last byte, as is normal and proper for zoned decimal signed values). It could be read in as 0001439 (without a sign) -- but in any case, it needs to be read with leading zeros and no decimal point.
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 298
Location: Maryland

PostPosted: Wed Apr 18, 2018 3:51 am    Post subject:
Reply with quote

Robert Sample wrote:
As another example of why you belong on the Beginners Forum, if the input data is truly as you have it listed (with decimal points), then that explains why you got the S0C7 -- decimal points are not numeric and will cause S0C7 abends when encountered in numeric MOVE statements and arithmetic operations. The V in a COBOL PICTURE clause is an IMPLIED decimal point -- as in, it does not really exist in the data. Furthermore, 14.39 being read into a PIC S9(05)V99 should be coming in as 000143I (which is 1439 with an overpunched plus sign on the last byte, as is normal and proper for zoned decimal signed values). It could be read in as 0001439 (without a sign) -- but in any case, it needs to be read with leading zeros and no decimal point.


Just answering that 2 + 2 = 4 wouldn't help in similar cases.
Tomorrow you'll get seriously a question like this: "Sorry, I'm new to COBOL; how can I calculate 3 + 3 ? "

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 SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am
No new posts How to build one file from two input ... daniele DFSORT/ICETOOL 5 Tue Feb 27, 2018 6:45 pm
No new posts To get Non matching row after compari... vinu78 DB2 7 Fri Jan 05, 2018 5:43 pm
No new posts Compare two PS files using ICE TOOL f... SENTHIL MURUGAAN DFSORT/ICETOOL 5 Sun Dec 24, 2017 1:26 pm
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us