Page 1 of 1

SAME RECORD AREA clause

PostPosted: Mon Apr 03, 2017 11:45 pm
by ramkumar1992sp
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.

Re: SAME RECORD AREA clause

PostPosted: Tue Apr 04, 2017 2:21 am
by BillyBoyo
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.

Re: SAME RECORD AREA clause

PostPosted: Tue Apr 04, 2017 7:45 pm
by ramkumar1992sp
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.

Re: SAME RECORD AREA clause

PostPosted: Wed Apr 05, 2017 7:12 pm
by Terry Heinze
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.

Re: SAME RECORD AREA clause

PostPosted: Thu Apr 06, 2017 3:29 am
by ramkumar1992sp
Thanks Terry!