Example:
A IMS database IMSTEST, has three segments (SEG01, SEG02, SEG03). The IMS Database Definition (DBD) is in a PDS member referenced by DD:DBDLIB, and the segment layouts are in three members (IMSSEG01, IMSSEG02 and IMSSEG03 respectively) of the PDS referenced by DD:IMSSEG.
Copy some of the fields from each source segment into one delimited target datastore.
-- IMS DBD Description --
DESCRIPTION IMSDBD DD:IMSDBD(IMSTEST) AS IMSTEST;
-- Define the IMS Segment layouts --
BEGIN GROUP IMS_SEG;
DESCRIPTION COBOL DD:IMSSEG(IMSSEG01)
AS IMSSEG01
FOR SEGMENT IMSSEG01
IN DATABASE IMSTEST;
DESCRIPTION COBOL DD:IMSSEG(IMSSEG02)
AS IMSSEG02
FOR SEGMENT IMSSEG02
IN DATABASE IMSTEST;
DESCRIPTION COBOL DD:IMSSEG(IMSSEG03)
AS IMSSEG03
FOR SEGMENT IMSSEG03
IN DATABASE IMSTEST;
END GROUP;
-- Define the IMSTEST database as an Input Datastore
DATASTORE IMSTEST
OF IMSDB
AS CDCIN
DESCRIBED BY GROUP IMS_SEG;
-- Define a Delimited Target Datastore --
DATASTORE DD:OUTPUT
AS OUTPUT
OF DELIMITED
;
-- Perform the copy from the source IMS datastore to the target delimited datastore
PROCESS INTO OUTPUT
SELECT
{
OUTPUT.SEG01FLD1 = SEG01FLD1
OUTPUT.SEG01FLD2 = SEG01FLD2
OUTPUT.SEG02FLD1 = SEG02FLD1
OUTPUT.SEG02FLD2 = SEG02FLD2
OUTPUT.SEG03FLD1 = SEGO3FLD1
OUTPUT.SEG03FLD2 = SEG03FLD2
}
FROM IMSTEST;