This is a short and simple example how to replace a value in a field in an IMS DB segment.
Easytrieve controlled processing and "DLI ... REPL" statement is being used in this sample.
The document includes
- CA Easytrieve compile&go sample JCL
- CA Easytrieve sample program source to display data from the DI21PART sample data base
- CA Easytrieve sample program source to replace the value
- the output of these samples
Easytrieve Report Generator, release 11.6
- Easytrieve compile&go JCL sample - it could be customized and used for the two following sample programs
//your_jobcard...
//EZTIMS EXEC PGM=DFSRRC00,REGION=4096K,
// PARM='DLI,EZT,DFHSAM24,,,,,,,,,,,N,N,'
//STEPLIB DD DISP=SHR,DSN=your.IMSY.SDFSRESL
// DD DISP=SHR,DSN=your.EZTP.R116.CBAALOAD
//EZTVFM DD UNIT=SYSDA,SPACE=(CYL,(3,1))
//EZOPTBL DD DISP=SHR,DSN=your.EZTP.R116.EZOPTBL
//IMS DD DISP=SHR,DSN=your.IMS.DBDLIB.V10
// DD DISP=SHR,DSN=your.IMS.PSBLIB.V10
//IEFRDER DD DISP=SHR,DSN=your.IMSDB.LOG1,
//DFSRESLB DD DISP=SHR,DSN=your.IMSY.SDFSRESL
//DI21PART DD DISP=SHR,DSN=your.IMS.DI21PART
//DI21PARO DD DISP=SHR,DSN=your.IMS.DI21PARO
//SYSPRINT DD SYSOUT=*,LRECL=133
//SYSOUT DD SYSOUT=*
//DFSVSAMP DD *
512,8
1024,8
2048,4
4096,4
8192,4
//SYSIN DD *
...insert source samples here - see below please...
- Easytrieve sample program source to retrieve all PARTROOT records from the DI21PART sample data base and display them.
The automatic input method is being used in this case.
FILE PARTFILE DLI (DI21PART)
DBD-NAME 1 8 A
SEG-LEVEL 9 2 A
STATUS-CODE 11 2 A
PROC-OPTIONS 13 4 A
RESERVE-DLI 17 4 B
SEG-NAME-FB-KEY 21 8 A
LENGTH-SENS-SEGS 29 4 B
NUMB-SENS-SEGS 33 4 B
KEY-FB-AREA 37 60 A
RECORD PARTROOT 50 KEY (PARTKEY 1 17)
PARTKEY 1 17 A
PARTDESC 18 20 A
*
*-------------------------------------------------------------------*
JOB INPUT (PARTFILE) NAME MYPROG
*
RETRIEVE PARTFILE SELECT (PARTROOT)
DISPLAY 'PARTKEY = ' PARTKEY ' DESC = ' PARTDESC
This is the DISPLAY output - before running REPL
...
PARTKEY = 00000000000000001 DESC = THIS IS A PARTROOT
PARTKEY = 00000000000000002 DESC = THIS IS A PARTROOT
PARTKEY = 00000000000000003 DESC = TEST01 REPL NOV.06
PARTKEY = 00000000000000004 DESC = THIS IS A PARTROOT
PARTKEY = 00000000000000005 DESC = THIS IS A PARTROOT
PARTKEY = 00000000000000006 DESC = THIS IS A PARTROOT
PARTKEY = 00000000000000007 DESC = THIS IS A PARTROOT
PARTKEY = 00000000000000008 DESC = THIS IS A PARTROOT
PARTKEY = 00000000000000009 DESC = THIS IS A PARTROOT
PARTKEY = 00000000000000010 DESC = THIS IS A PARTROOT
...
- Easytrieve sample program source to replace the value if PARTKEY is 3.
The controlled processing method is being used in this sample.
In case of error the job will terminate with RC=0020.
FILE PARTFILE DLI (DI21PART)
DBD-NAME 1 8 A
SEG-LEVEL 9 2 A
STATUS-CODE 11 2 A
PROC-OPTIONS 13 4 A
RESERVE-DLI 17 4 B
SEG-NAME-FB-KEY 21 8 A
LENGTH-SENS-SEGS 29 4 B
NUMB-SENS-SEGS 33 4 B
KEY-FB-AREA 37 60 A
RECORD PARTROOT 50 KEY (PARTKEY 1 17)
PARTKEY 1 17 A
PARTDESC 18 20 A
*
SSA1 S 37 A VALUE 'PARTROOT(PARTKEY =00000000000000003)'
*
*-------------------------------------------------------------------*
JOB INPUT (NULL) NAME EZIMSR01
*
DLI PARTFILE PARTROOT 'GHU ' SSA(SSA1)
*
MOVE 'TEST02 REPL NOV.06' TO PARTDESC
DLI PARTFILE PARTROOT 'REPL'
PERFORM CHK-STATUS
*
CHK-STATUS. PROC
IF STATUS-CODE NOT SPACE AND STATUS-CODE NE 'GE'
DISPLAY 'JOB TERMINATED, IMS STATUS CODE = ' STATUS-CODE
RETURN-CODE = 20
STOP
ELSE
DISPLAY 'PARTKEY = ' PARTKEY ' DESC = ' PARTDESC +
' STATUS-CODE = ' STATUS-CODE
STOP
END-IF
END-PROC
This is the DISPLAY output of the REPL program if no error occurred:
...
PARTKEY = 00000000000000003 DESC = TEST02 REPL NOV.06 STATUS-CODE =
...
Running the DISPLAY program sample again you will see:
...
PARTKEY = 00000000000000001 DESC = THIS IS A PARTROOT
PARTKEY = 00000000000000002 DESC = THIS IS A PARTROOT
PARTKEY = 00000000000000003 DESC = TEST02 REPL NOV.06
PARTKEY = 00000000000000004 DESC = THIS IS A PARTROOT
PARTKEY = 00000000000000005 DESC = THIS IS A PARTROOT
PARTKEY = 00000000000000006 DESC = THIS IS A PARTROOT
PARTKEY = 00000000000000007 DESC = THIS IS A PARTROOT
PARTKEY = 00000000000000008 DESC = THIS IS A PARTROOT
PARTKEY = 00000000000000009 DESC = THIS IS A PARTROOT
PARTKEY = 00000000000000010 DESC = THIS IS A PARTROOT
...