SAME RECORD AREA clause



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

SAME RECORD AREA clause

Postby ramkumar1992sp » Mon Apr 03, 2017 11:45 pm

Hello Experts,
I was trying to understand 'SAME RECORD AREA Clause" and below is the link I referred.

https://www.ibm.com/support/knowledgece ... iossra.htm

In one of my COBOL program,we are using this clause as below.

FILE-CONTROL.
    SELECT  SEC-WKFL ASSIGN TO DA-R-SYS052.  
     SELECT  SEC-FLWK ASSIGN TO DA-R-SYS052    
         ACCESS RANDOM NOMINAL KEY NOM.        
     SELECT  T4-WKFL  ASSIGN TO DA-R-SYS056.  
     SELECT  T4-FLWK  ASSIGN TO DA-R-SYS056    
         ACCESS RANDOM NOMINAL KEY MON.        
 
 I-O-CONTROL.                                  
     SAME RECORD AREA FOR T4-WKFL T4-FLWK      
     SAME RECORD AREA FOR SEC-WKFL SEC-FLWK.  


FILE SECTION.
FD  SEC-WKFL                                            
    RECORDING MODE F                                    
    LABEL RECORDS STANDARD                              
    DATA RECORD IS S-WKREC.                              
01  S-WKREC.                                            
    03  FILLER                  PIC X(9).                
    03  S-CRSNR                 PIC X(4).                
    03  FILLER                  PIC XX.                  
    03  S-SECNR                 PIC XX.                  
    03  FILLER                  PIC X(63).              
FD  SEC-FLWK                                            
    RECORDING MODE F                                    
    LABEL RECORDS STANDARD                              
    DATA RECORD IS S-RCDWK.                              
01  S-RCDWK.                                            
    03  FILLER                  PIC X(80).              



060-WRITE-WKFL.                          
    WRITE S-WKREC FROM SEC-RCDIN.        



With the above WRITE statement, will S-RCDWK also have the same value as s-WKREC ?

I was advised by the experts here ibm-cobol/topic11463.html that I would need to convert the direct access file to either KSDS or RRDS.I'm converting it to RRDS.

Here both SEC-WKFL & SEC-FLWK refer to the same DD.Since I need to convert it to VSAM,I split it such that both the files will have individual DD statements in JCL. SEC-WKFL will be a QSAM file and SEC-FLWK will be a RRDS file.

Now will SAME RECORD AREA behave in a different manner.When I was testing it,it looks like it did.

Can someone please explain me SAME RECORD AREA clause in more detail ? I'm not very sure if I explained the issue well here.
ramkumar1992sp
 
Posts: 71
Joined: Sat Jul 23, 2016 8:52 am
Has thanked: 40 times
Been thanked: 0 time

Re: SAME RECORD AREA clause

 

Re: SAME RECORD AREA clause

Postby BillyBoyo » Tue Apr 04, 2017 2:21 am

It's an application, or part of an application, of an old memory/CPU-saving trick. There's other stuff going on (see the same DDNAMEs, how did you deal with those?).

Your boss either needs a consultant with considerable experience, including the many techniques which were only resorted-to due to resource constraints, or you need to do a lot of "reworking" to get rid of all the code you and your colleagues don't understand, and a lot of thorough testing to make sure it does the same thing, or a lot of data-analysis to capture the current business requirements.

You can't just patch up that stuff. It was written 40 or more years ago, likely for a different OS, and you won't have much clue of what it did originally, and what it does or doesn't do now. Same applies to all the code you don't recognise in these programs. If you try to cut your way through it with minimal changes, I don't think you'll reach any targets with working systems. Too many unknowns. Don't try to patch-up what isn't understood, it needs to be reworked for you to stand a chance.

These users thanked the author BillyBoyo for the post:
ramkumar1992sp (Tue Apr 04, 2017 7:41 pm)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: SAME RECORD AREA clause

Postby ramkumar1992sp » Tue Apr 04, 2017 7:45 pm

Thanks BillyBoyo,Yes,I was trying to get this done with minimal changes.This program isn't that big.It's just reading data from couple of files and copying it to 2 other files .I will rework on this and test it thoroughly or may even try to replace the COBOL program with a SORT.
ramkumar1992sp
 
Posts: 71
Joined: Sat Jul 23, 2016 8:52 am
Has thanked: 40 times
Been thanked: 0 time

Re: SAME RECORD AREA clause

Postby Terry Heinze » Wed Apr 05, 2017 7:12 pm

See the Language Reference Manual, Input-Output Section, I-O-CONTROL paragraph. As has been said, it's an old technique used to save memory during execution. Used when DOS VSE was prevalent. If it's a simple program, best to simply recode it from scratch using current capabilities of COBOL.
.... Terry
Terry Heinze
 
Posts: 188
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 10 times
Been thanked: 11 times

Re: SAME RECORD AREA clause

Postby ramkumar1992sp » Thu Apr 06, 2017 3:29 am

Thanks Terry!
ramkumar1992sp
 
Posts: 71
Joined: Sat Jul 23, 2016 8:52 am
Has thanked: 40 times
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post