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
 
Unpredictable results while dealing with DATA-RECORD

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

New User


Joined: 17 Mar 2009
Posts: 30
Location: Bangalore.India

PostPosted: Wed Jul 07, 2010 6:49 pm    Post subject: Unpredictable results while dealing with DATA-RECORD
Reply with quote

Hello everyone
I am confused with below scenario -
Input 1 :
Code:
 
FD INPUT1                       
     RECORDING MODE IS F         
     DATA RECORD IS P-REC.   
01 P-REC  PIC  X(200).     


Input 2 :
Code:
 
FD INPUT2                       
     RECORDING MODE IS F         
     DATA RECORD IS T-REC.   
01 T-REC  PIC  X(200).     


Inside program :
Code:
 
IF T-REC = P-REC


Will it cause any problem when I compare directly DATA-RECORD ?
Ideally, we always READ input file into working storage record and then play with working storage record only. We should not play with file description (FD) record.. (Correct me if wrong !!)
In my case, above IF condition sometimes work fine and sometimes wont.. I should not compare DATA-RECORDS.
Please let me know whether my understanding is correct or I am missing something.
Back to top
View user's profile Send private message

Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Jul 07, 2010 7:56 pm    Post subject: Re: Unpredictable results while dealing with DATA-RECORD
Reply with quote

swapnilushinde wrote:
Ideally, we always READ input file into working storage record and then play with working storage record only. We should not play with file description (FD) record.. (Correct me if wrong !!)
The word "Ideally" can get questionable, there is no thumb-rule of this sort - though it can be a site standard. You can use them directly.

Quote:
In my case, above IF condition sometimes work fine and sometimes wont.. I should not compare DATA-RECORDS.
in what cases did it work and in it did not? Did it work "ideally" when you use working-storage variables?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Wed Jul 07, 2010 8:07 pm    Post subject:
Reply with quote

The basic reasons for using workarea option is
you can initialize/manipulate/question the workarea without regard to file status.

this enables for smother logic - not having to qualify everything with a
IF FILE IS OPEN AND STATUS IS OK.

also means when jr programmers follow with maintenance,
there is less worry about inadvertently 'adding' a bug.

with the speed of machines and memory availability
most professionals use the workarea-option when working with files to prevent S0C4's.

and if all works correctly with workarea option,
then there is little need to revert to using the datarecord.
Back to top
View user's profile Send private message
ridgewalker58

New User


Joined: 26 Sep 2008
Posts: 51
Location: New York

PostPosted: Wed Jul 07, 2010 8:08 pm    Post subject: Reply to: Unpredictable results while dealing with DATA-RECO
Reply with quote

In my experience, using the "data records" (the 01 level that is contained within the FD file section) ALWAYS works.

PROVIDED that I have successfully opened the files and read a record from the files. AND have not reached an end of file condition.

When I can avoid the READ ________ INTO method, I avoid it.
This is because when I do the READ of the file with the INTO clause--
1. The record is available in the 01 level area and
2. AFTER the record is in the 01 level area it is COPIED
INTO the area that I specified (extra time to process data)
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Wed Jul 07, 2010 8:24 pm    Post subject: Re: Reply to: Unpredictable results while dealing with DATA-
Reply with quote

ridgewalker58 wrote:
In my experience, using the "data records" (the 01 level that is contained within the FD file section) ALWAYS works.

good for you!
ridgewalker58 wrote:

PROVIDED that I have successfully opened the files and read a record from the files. AND have not reached an end of file condition.

and therein lies the rub, especially for jr's following.
ridgewalker58 wrote:

When I can avoid the READ ________ INTO method, I avoid it.
This is because when I do the READ of the file with the INTO clause--
1. The record is available in the 01 level area and
2. AFTER the record is in the 01 level area it is COPIED
INTO the area that I specified (extra time to process data)


very true for simple programs, and process time is important on a small machine.

but, if one is performing a 2 or more file match merge,
the logic is much easier if the workarea option is used.

and if there is a large difference in file sizes,
the time saved by not using the workarea-option
can be eaten up and lost by the extra IF OPEN STATUS-OK
tests.
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 Jul 07, 2010 8:43 pm    Post subject:
Reply with quote

Hello,

Quote:
We should not play with file description (FD) record.. (Correct me if wrong !!)

In my case, above IF condition sometimes work fine and sometimes wont.. I should not compare DATA-RECORDS.
Please let me know whether my understanding is correct or I am missing something.
It looks like you are missing something. Done correctly, the compare will work correctly every time - either way. . .
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 File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 0 Tue Sep 26, 2017 3:35 am
No new posts Question related to Data dictionary f... rexx77 SYNCSORT 3 Thu Aug 31, 2017 7:23 am
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am
No new posts Extract Data till prev hour balaji81_k DB2 16 Fri Aug 25, 2017 9:25 pm

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