How to change a field depending on a condition?
search cancel

How to change a field depending on a condition?

book

Article ID: 133982

calendar_today

Updated On:

Products

File Master Plus

Issue/Introduction

This article describes how to change the content of a field depending on the content of another field, using CA File Master and a COBOL copy book layout.


Environment

Release:


Component:

Resolution

CA File Master - update field with SELRECIF condition


Customize and run job *. CDBIJCL(CAWAIVP1)

Browse CUSTFILE

--------------------  CA File Master Plus -- Browse Dataset -------------------
COMMAND ===>                                                                 
                                                                               
Specify Dataset to Browse:                                                    
  Dataset name   ===> 'your.FM110.SEQ.CUSTFILE'                              
  Member name    ===>                                                         
  Volume         ===>                  If dataset not cataloged               
                                                                              
Record Layout for Formatted Displays:                                         
  Layout dataset ===> 'your.FM110.CDBISAMP'                                  
  Layout member  ===> CAWACUST                                                
                                                                              
Selection Criteria below  or  Selection Criteria Member ===>                  
===>                                                                          
===>                                                                          
===>                                                                           
                                                                              
Display mode  ===> S ( C Character S Single-rec Format M Multi-rec Format )   
Browse  mode  ===> B ( V View B Browse )                                       
                                                                              
Before update:

Browse your.FM110.SEQ.CUSTFILE                                                                                 Columns 00001 00083
COMMAND ===>                                                                                                       SCROLL ===> CSR
Record Number: 2        Record Length: 160   Record Layout: CAWACUST                                                               
   Field Name                        Pos  Format Value                                                                             
01 CUSTOMER-RECORD                     1     160                                                                                   
  03 CUST-REC-TYPE                     1 C     1 1                                                                                 
  03 CUST-ID                           2 C     7 0000113                                                                           
  03 CUST-NAME                         9 C    15 BARRY DILLER                                                                      
  03 CUST-STREET                      24 C    18 2383 FOREST ST.                                                                   
  03 CUST-CITY                        42 C    12 NEW HAVEN                                                                         


Changing CUST-STREET field from "2383 FOREST ST." to "2222 FOREST ST."  if CUST-NAME is "BARRY DILLER"

In CA File Master main menu select option "3.9"

-----------------------  CA File Master Plus -- Update  -----------------------
COMMAND ===>                                                                  
                                                                              
Specify Dataset to Update:                                                    
  Dataset name  ===> 'your.FM110.SEQ.CUSTFILE'                                
  Member name   ===>          ('*' = all members, blank/wildcard = mem list)  
  Volume serial ===>          (If dataset not cataloged)                      
                                                                              
Update / Preview Dataset (optional):                                          
  Dataset name  ===>                                                          
                                                                              
Update Parameters:                                                            
  Preview before update? ===> N         Y= Preview updates (Online only)      
  Input Format JCL       ===> N         Y= Maintain JCL Syntax for updates    
  Execution mode         ===> E         O=Online S=Submit JCL E=Edit JCL      
                                                                              
Record Layout:                                                                
  Layout dataset ===> 'your.FM110.CDBISAMP'                                   
  Layout member  ===> CAWACUST                                                
                                                                              
Selection Criteria below  or  Selection Criteria Member ===>                  
===> CUST-NAME EQ 'BARRY DILLER'                                              
===>                                                                          
===>                                                                           

--  CA File Master Plus -- Update Fields ------------------- Row 1 to 20 of 44
  COMMAND ===>                                                 SCROLL ===> CSR
                                                                                
                                                 From                          
    Field Name                 Pos    Format  OP To                            
 01 CUSTOMER-RECORD                1 C    160 __ ______________________________
                                                 ______________________________
 03 CUST-REC-TYPE                  1 C      1 __ ______________________________
                                                 ______________________________
 03 CUST-ID                        2 C      7 __ ______________________________
                                                 ______________________________
 03 CUST-NAME                      9 C     15 __ ______________________________
                                                 ______________________________
 03 CUST-STREET                   24 C     18 CO '2383 FOREST ST.'_____________
                                                 '2222 FOREST ST.'_____________
 03 CUST-CITY                     42 C     12 __ ______________________________
                                                 ______________________________


//SEARCH  EXEC PGM=CAWABATC,REGION=2M           
//STEPLIB   DD DSN=your.FM110.CDBILOAD,        
//             DISP=SHR                         
//SYSPRINT  DD SYSOUT=*                         
//SYSUDUMP  DD SYSOUT=*                         
//SYSUT1    DD DSN=your.FM110.SEQ.CUSTFILE,    
//             DISP=SHR                         
//SYSIN     DD *                                 
  UPDATE,                                       
    INFILE(SYSUT1),                             
    LAYOUTFILE(your.FM110.CDBISAMP(CAWACUST)), 
    SELRECIF(CUST-NAME,EQ,T'BARRY DILLER'),     
      REPLACE(CUST-STREET,CO,T'2383 FOREST ST.',
      T'2222 FOREST ST.')                       
/*                                              

After running the job:

Browse your.FM110.SEQ.CUSTFILE                                                                                 Columns 00001 00083
COMMAND ===>                                                                                                       SCROLL ===> CSR
Record Number: 2        Record Length: 160   Record Layout: CAWACUST                                                               
   Field Name                        Pos  Format Value                                                                            
01 CUSTOMER-RECORD                     1     160                                                                                   
  03 CUST-REC-TYPE                     1 C     1 1                                                                                
  03 CUST-ID                           2 C     7 0000113                                                                           
  03 CUST-NAME                         9 C    15 BARRY DILLER                                                                     
  03 CUST-STREET                      24 C    18 2222 FOREST ST.                                                                   
  03 CUST-CITY                        42 C    12 NEW HAVEN